Last active
January 4, 2016 03:09
-
-
Save davereid/8560097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = Debug | |
description = Helps debug a corrupted module_implements cache | |
core = 7.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_boot(). | |
*/ | |
function debug_boot() { | |
// Ensure the module implements cache is cleared on every request so we can be guaranteed that it uses fresh data. | |
module_implements('', FALSE, TRUE); | |
} | |
/** | |
* Implements hook_module_implements_alter(). | |
*/ | |
function debug_module_implements_alter() { | |
// Update.php runs hooks in an early bootstrap, but we don't care about that instance. | |
if (drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL && !defined('MAINTENANCE_MODE')) { | |
echo "<pre>"; | |
echo "Something called module_implements() before a full bootstrap and all modules are loaded!\n\n"; | |
$backtrace = debug_backtrace(); | |
array_shift($backtrace); | |
print_r($backtrace); | |
echo "</pre>"; | |
die; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment