I have added boost as a dependency to my installation profile, but when the Drupal installer starts installing Boost, it throws an error. Without Boost as dependency, the installation profile works fine. Also, enabling Boost after works great.

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: http://example.com/install.php?profile=example&locale=fr&id=1&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY fit DESC LIMIT 0, 1' at line 1: SELECT * FROM {menu_router} WHERE path IN () ORDER BY fit DESC LIMIT 0, 1; Array ( ) in menu_get_item() (line 443 of /home/user/Public/Sites/examplesite/includes/menu.inc).

The function in menu.inc is below, with line 443 being the following: $router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();

function menu_get_item($path = NULL, $router_item = NULL) {
  $router_items = &drupal_static(__FUNCTION__);
  if (!isset($path)) {
    $path = $_GET['q'];
  }
  if (isset($router_item)) {
    $router_items[$path] = $router_item;
  }
  if (!isset($router_items[$path])) {
    $original_map = arg(NULL, $path);

    // Since there is no limit to the length of $path, use a hash to keep it
    // short yet unique.
    $cid = 'menu_item:' . hash('sha256', $path);
    if ($cached = cache_get($cid, 'cache_menu')) {
      $router_item = $cached->data;
    }
    else {
      $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
      $ancestors = menu_get_ancestors($parts);
      $router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
      cache_set($cid, $router_item, 'cache_menu');
    }
    if ($router_item) {
      // Allow modules to alter the router item before it is translated and
      // checked for access.
      drupal_alter('menu_get_item', $router_item, $path, $original_map);

      $map = _menu_translate($router_item, $original_map);
      $router_item['original_map'] = $original_map;
      if ($map === FALSE) {
        $router_items[$path] = FALSE;
        return FALSE;
      }
      if ($router_item['access']) {
        $router_item['map'] = $map;
        $router_item['page_arguments'] = array_merge(menu_unserialize($router_item['page_arguments'], $map), array_slice($map, $router_item['number_parts']));
        $router_item['theme_arguments'] = array_merge(menu_unserialize($router_item['theme_arguments'], $map), array_slice($map, $router_item['number_parts']));
      }
    }
    $router_items[$path] = $router_item;
  }
  return $router_items[$path];
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Tor Arne Thune’s picture

Tried to install Boost later on in the installation process by adding module_enable(array('boost'), FALSE); to my profile_install(). Got these errors:

Notice: Undefined index: include_file in _boost_get_menu_router() (line 628 of /home/user/Public/Sites/examplesite/sites/all/modules/boost/boost.module).
Notice: Undefined index: include_file in _boost_get_menu_router() (line 628 of /home/user/Public/Sites/examplesite/sites/all/modules/boost/boost.module).
Notice: Undefined index: include_file in _boost_get_menu_router() (line 628 of /home/user/Public/Sites/examplesite/sites/all/modules/boost/boost.module).
Tor Arne Thune’s picture

Tried module_enable(array('boost'), FALSE); even later on in the install process, in the last user-defined installation task (just before install_finished), but the same error occurred.
Notice : Undefined index: include_file in _boost_get_menu_router() (line 628 of /home/user/Public/Sites/examplesite/sites/all/modules/boost/boost.module).

mikeytown2’s picture

Looks like this fix introduced some other side affects
http://drupal.org/node/325813#comment-4122116

don't undo it; just means I need a different way of doing this.

mikeytown2’s picture

Status: Active » Needs review
FileSize
1.17 KB

committed this

Tor Arne Thune’s picture

Thanks for the patch. I still get the same error by having Boost as dependency in my installation profile, but now I get a different error when I enable the module in exampleprofile_install():
Warning: rmdir(cache/normal/example.com/): Directory not empty in _boost_rmdir() (line 1041 of /home/user/Public/Sites/examplesite/sites/all/modules/boost/boost.module).
The directory cache/normal is created, writable by the web server and empty, before the installation. After the error stops the installation, the directory example.com has been created in cache/normal, and contains .htaccess.

Tor Arne Thune’s picture

Tried it again in the step before the install_finished, and got the same errors as the post above, except twice.

mikeytown2’s picture

FileSize
748 bytes

committed this patch. see if this helps

Tor Arne Thune’s picture

That did the trick. I was able to install the site with the installation profile, having Boost as a dependency. Thanks for the efficient solution!

mikeytown2’s picture

Status: Needs review » Fixed
Tor Arne Thune’s picture

Status: Fixed » Needs work

I have no idea why, but another installation profile is failing with Boost as dependency. It's on the same multi-site installation, so I can't understand why the other one is failing. The first one works great, as mentioned in #8. cache/normal is empty, before I try to install.

Tor Arne Thune’s picture

It worked by adding it via module_enable() in profile_install(), so that's what I will do with this installation profile.

Tor Arne Thune’s picture

Now it fails when I try to install from the first installation profile as well, when I have Boost as dependency. I will just go ahead and add the module through profile_install().

mikeytown2’s picture

What does it fail on; how does it fail? I can't fix what I don't know :)

Tor Arne Thune’s picture

Still the same as in the original post :)

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: http://example.com/install.php?profile=example&locale=fr&id=1&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY fit DESC LIMIT 0, 1' at line 1: SELECT * FROM {menu_router} WHERE path IN () ORDER BY fit DESC LIMIT 0, 1; Array ( ) in menu_get_item() (line 443 of /home/user/Public/Sites/examplesite/includes/menu.inc).

mikeytown2’s picture

Status: Needs work » Needs review
FileSize
826 bytes

Committed this patch... let me know :)

Tor Arne Thune’s picture

Still no go, I'm afraid. Same error as before.

nunof’s picture

Also having the same problem... Subscribing.

nunof’s picture

I think I know what the problem is...

The menu module should be a dependency of boost.

quartsize’s picture

Status: Needs review » Postponed
Issue tags: +blocked

The menu module should be a dependency of boost.

I suspect making menu module a dependency of Boost only prevents the error by running menu_rebuild() when it is enabled, and thus before Boost calls menu_get_item().

I believe this issue is a manifestation of #1026474: Menu system does not always get rebuilt when needed: Boost calls menu_get_item() before system variable menu_masks is set. So menu_get_ancestors() returns an empty array, and menu_get_item() generates an invalid SQL query, since it does not expect menu_get_ancestors() to return an empty array.

JLambrecht’s picture

Upgrade of mysql, php, apache2 fixed this for me. Also upgrade to innodb, which is probaly the actual fix.