Well it is not a bug but is kinds undeed source you have in the menu hook. The menu in drupal 6.* is caches and is rebuild only when you go to admin/build/modules or in the admin you select to rebuild menu with the devel module. All the rest cases the menu is cached and actually if you start fresh install of the module and then add some indexes then "search/main_index" and "search/main_index/%" paths will not be added to the menu before you rebuild it. All this source from the menu hook :
$res = db_query('SELECT iid, display_name, path FROM {sphinx_indexes} WHERE active = 1');
while ($indexes = db_fetch_object($res)) {
$items['search/'. $indexes->path] = array(
'title' => t('Search !index', array('!index' => $indexes->display_name)),
'description' => t('Search !index', array('!index' => $indexes->display_name)),
'page callback' => '_sphinx_search_page',
'page arguments' => array(1, ''),
'access callback' => user_access('use index '. $indexes->display_name .'('. $indexes->iid .')'),
'type' => ($indexes->path == variable_get('sphinx_default_index', '')) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
);
$items['search/'. $indexes->path. '/%'] = array(
'title' => t('Search !index', array('!index' => $indexes->display_name)),
'description' => t('Search !index', array('!index' => $indexes->display_name)),
'page callback' => '_sphinx_search_page',
'page arguments' => array(1, 2),
'access callback' => user_access('use index '. $indexes->display_name .'('. $indexes->iid .')'),
'type' => ($indexes->path == variable_get('sphinx_default_index', '')) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
);
}
is kinda unneded cause it will always call the _sphinx_search_page with the appropriate arguments.
Well that is just a suggestion for a cleaner code :)
Comments
Comment #1
johsw CreditAttribution: johsw commentedThere is no official d6 release yet.
Comment #2
johsw CreditAttribution: johsw commentedI do it this way to make it possible to have per index permissions (that could be done with a custom access function), but it also allows a MENU_DEFAULT_LOCAL_TASK
Please send me a patch, if you've got a cleaner way to do it.
Comment #3
johsw CreditAttribution: johsw commentedComment #4
nestor.mata CreditAttribution: nestor.mata commentedThis is fixed in version 6.x-1.2.
I still want to do it in a cleaner way, but for the moment, any modification on the indexes rebuilds the menu, which solves the problem.
~Nestor
Comment #5
nestor.mata CreditAttribution: nestor.mata commentedClosing ticket