function registry_rebuild

You are here

7 bootstrap.inc registry_rebuild()

Rescans all enabled modules and rebuilds the registry.

Rescans all code in modules or includes directories, storing the location of each interface or class in the database.

Related topics

2 calls to registry_rebuild()
drupal_flush_all_caches in includes/common.inc
Flushes all cached data on the site.
simpletest_clean_environment in modules/simpletest/simpletest.module
Remove all temporary database tables and directories.

File

includes/bootstrap.inc, line 3175
Functions that need to be loaded on every Drupal request.

Code

function registry_rebuild() {
  system_rebuild_module_data();
  registry_update();
}

Comments

If registry_rebuild() does not produce the results you're looking for (meaning classes are not being found), you can try to truncate table registry_file;. This will cause Drupal to rescan ALL files, resulting in a longer rebuild time, but assuring that all files are re-scanned, including those it thinks have not changed. Be careful though and make sure you have a database backup before going around truncating tables...

Just tried this on Drupal 7.22, would not recommend. Breaks it permanently, even using registry rebuild from drush wouldn't work... Had to restore from a backup (I made one before truncating, thankfully).

How much time does this take on average to run? Am considering calling this as a plan E for an issue with tokens not being replaced we are having and am trying to figure out the performance impact that would have.