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...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

helmo’s picture

Issue summary: View changes

typo

killes@www.drop.org’s picture

Priority: Normal » Major

Still a problem on admin/config/search/xmlsitemap/settings

aitala’s picture

Yes, I'm stuck with this issue too...

Dave Reid’s picture

Status: Active » Needs review
FileSize
487 bytes

Ok so let's try this out.

Dave Reid’s picture

Version: 7.x-2.x-dev » 8.x-1.x-dev
Status: Needs review » Patch (to be ported)

Confirmed 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.

  • Dave Reid committed 1219c48 on 7.x-2.x
    Issue #1968744 by Dave Reid: Fixed xmlsitemap.xmlsitemap.inc not always...
joelpittet’s picture

Version: 8.x-1.x-dev » 7.x-2.x-dev

@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.

joelpittet’s picture

Version: 7.x-2.x-dev » 8.x-1.x-dev

I'm wrong, read deeper. Ignore me...

Dave Reid’s picture

Nope, 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.

swentel’s picture

Status: Patch (to be ported) » Fixed

There's no call anymore to loadAllIncludes() anywhere in the codebase (besides loading the install on line 2321), so this looks fine.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.