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

After a Drupal core upgrade I got a fatal error from Drupal searching for a folder and file that don't exist. I could not login or see any pages. Registry_rebuild and other repair scripts found on the forum did not work for me.
In the end, truncate registry_file table on the database, worked.
I then ran the update.php script, setting it to true temporarily in the settings file first. Now the site is now longer broken.

There is also the excellent "Registry Rebuild" module. Most people use it with drush but there are instructions on the module page on how to use it without drush. https://www.drupal.org/project/registry_rebuild