I think the fix in #1392710: Call to undefined function xmlsitemap_link_frontpage_settings() was not complete/correct.
Let me explain...
We currently call
module_load_all_includes('inc', 'xmlsitemap');
it loops all modules and eventually also works on xmlsitemap itself. It then calls
module_load_include($type = 'inc', $module = 'xmlsitemap', $name = 'xmlsitemap');
which calls:
$file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module = 'xmlsitemap') . "/$name.$type";
Which in my opinion(mental PHP parser) evaluates to e.g. ==> '/var/www/sites/all/modules/contrib/xmlsitemap/xmlsitemap.inc
See below for the function definitions.
The issue #1316822: Move xmlsitemap.xmlsitemap.inc functions() to correct location which was closed as duplicate has some more background....
There is a 'xmlsitemap.inc' and an 'xmlsitemap.xmlsitemap.inc' in this module.
I guess that xmlsitemap_link_frontpage_settings() function can sometimes be loaded because the xmlsitemap.xmlsitemap.inc file also contains classes and is referenced in the .info file.
There are multiple ways to fix this.
* move the functions from If xmlsitemap.xmlsitemap.inc to xmlsitemap.inc as per my patch in http://drupal.org/node/1392710#comment-7276226
* adapt the include statement
function module_load_all_includes($type, $name = NULL) {
$modules = module_list();
foreach ($modules as $module) {
module_load_include($type, $module, $name);
}
}
From: http://api.drupal.org/api/drupal/includes!module.inc/function/module_loa...
function module_load_include($type, $module, $name = NULL) {
if (!isset($name)) {
$name = $module;
}
if (function_exists('drupal_get_path')) {
$file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$name.$type";
if (is_file($file)) {
require_once $file;
return $file;
}
}
return FALSE;
}
From: http://api.drupal.org/api/drupal/includes!module.inc/function/module_loa...
Comment | File | Size | Author |
---|---|---|---|
#3 | 1968744-xmlsitemap-inc-include-final-fix.patch | 487 bytes | Dave Reid |
Comments
Comment #0.0
helmo CreditAttribution: helmo commentedtypo
Comment #1
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedStill a problem on admin/config/search/xmlsitemap/settings
Comment #2
aitala CreditAttribution: aitala commentedYes, I'm stuck with this issue too...
Comment #3
Dave ReidOk so let's try this out.
Comment #4
Dave ReidConfirmed and committed #3 to 7.x-2.x. Not sure if this needs to be patched in 8.x-1.x, so just marking as needs port for a review.
Comment #6
joelpittet@Dave Reid #3 doesn't look correct as per the docs, it takes two arguments, first is type(extension), second is the name of the file(without the extension).
@see https://api.drupal.org/api/drupal/includes!module.inc/function/module_lo...
Maybe that is just all around the wrong function to call? Is it supposed to look for this file in all modules? If not just a include dirname(__FILE__)/__DIR__ would work. Not sure it's intent just noticed it in the latest update and checked the docs.
Comment #7
joelpittetI'm wrong, read deeper. Ignore me...
Comment #8
Dave ReidNope, this is actually the correct way. The second parameter is optional in module_load_all_includes(). The way we were using it would mean that for given module 'test' it would attempt to load sites/all/modules/test/xmlsitemap.inc instead of sites/all/modules/test/test.xmlsitemap.inc which is the correct path to be loading.
Comment #9
swentel CreditAttribution: swentel commentedThere's no call anymore to loadAllIncludes() anywhere in the codebase (besides loading the install on line 2321), so this looks fine.