Problem/Motivation

Server memory limited. Modules should only load that code which is likely to be required in a page call. Search404 module has too many functions in it's .module file that are not required with each page call. Therefore it is unnecessary using memory.

Proposed resolution

Move all functions to a (designated) include file if they are not frequently used on regular page calls. For example:

search404.page.inc

  • search404_page()
  • search404_search_engine_query()
  • search404_search_engine_query()
  • search404_goto()

search404.admin.inc

  • search404_settings()

Remaining tasks

User interface changes

API changes

Comments

pebosi’s picture

StatusFileSize
new30.3 KB

Created a patch to move menu callback functions to proposed include files. Removed access callback "user_access", because it's the default.

Please review.

pebosi’s picture

Status: Active » Needs review
amitgoyal’s picture

Status: Needs review » Needs work

I am getting following issue while applying the patch on 7.x-1.x,

$ git apply -v 2170323-move-menu-callbacks-file.patch
Checking patch search404.admin.inc...
Checking patch search404.module...
error: while searching for:

$items['search404'] = array(
'title' => 'Page not found',
'access callback' => TRUE,
'page callback' => 'search404_page',
'type' => MENU_LOCAL_TASK
);

$items['admin/config/search/search404'] = array(

error: patch failed: search404.module:13
error: search404.module: patch does not apply
Checking patch search404.page.inc...

pebosi’s picture

Try patch -p1 < path/file.patch

pebosi’s picture

Status: Needs work » Needs review
amitgoyal’s picture

Status: Needs review » Needs work

Still failed,

$ patch -p1 < 2170323-move-menu-callbacks-file.patch
patching file search404.admin.inc
patching file search404.module
Hunk #1 FAILED at 13.
Hunk #3 FAILED at 117.
Hunk #4 succeeded at 263 (offset 16 lines).
2 out of 4 hunks FAILED -- saving rejects to file search404.module.rej
patching file search404.page.inc

gerzenstl’s picture

StatusFileSize
new30.81 KB

I added a new patch for 7.x-1.x, that contains the changes to move the callback functions.

I tested the patch myself:

$ git apply --check move-menu-callbacks-file-2170323-7.patch

$ git apply -v move-menu-callbacks-file-2170323-7.patch
Checking patch search404.admin.inc...
Checking patch search404.module...
Checking patch search404.page.inc...
Applied patch search404.admin.inc cleanly.
Applied patch search404.module cleanly.
Applied patch search404.page.inc cleanly.

gerzenstl’s picture

Status: Needs work » Needs review
sutharsan’s picture

Status: Needs review » Reviewed & tested by the community

Code looks good, callbacks tested. Not much that can go wrong here.

damienmckenna’s picture

deanflory’s picture

Not able to be applied in either order with this patch: search_by_alias-2125299-3.patch

Can be applied along with this patch: search404-remove-notice-2365389-2.patch

But not all 3 together.

anish_zyxware’s picture

StatusFileSize
new36.44 KB

The given patch no longer applies as I merged much other patches and fixed some issues.

Created a new patch.

  • anish_zyxware committed 2cae3dd on
    #2170323 - Move callback to seperate file to reduce memory footprint
    
anish_zyxware’s picture

anish_zyxware’s picture

Assigned: Unassigned » anish_zyxware
Status: Reviewed & tested by the community » Closed (fixed)