Commit 5a38d9a9 authored by webchick's avatar webchick

Issue #1029606 follow-up by catch, David_Rothstein: Fixed Regression: Not...

Issue #1029606 follow-up by catch, David_Rothstein: Fixed Regression: Not loading the .module file causes a fatal error when uninstalling some modules (as does loading it).
parent 2c0b028d
......@@ -32,6 +32,7 @@ function shortcut_install() {
* Implements hook_uninstall().
*/
function shortcut_uninstall() {
drupal_load('module', 'shortcut');
// Delete the menu links associated with each shortcut set.
foreach (shortcut_sets() as $shortcut_set) {
menu_delete_links($shortcut_set->set_name);
......
......@@ -167,7 +167,8 @@ function simpletest_schema() {
* Implements hook_uninstall().
*/
function simpletest_uninstall() {
simpletest_clean_environment();
drupal_load('module', 'simpletest');
simpletest_clean_database();
// Remove settings variables.
variable_del('simpletest_httpauth_method');
......
......@@ -452,13 +452,15 @@ function simpletest_clean_database() {
* Find all leftover temporary directories and remove them.
*/
function simpletest_clean_temporary_directories() {
$files = scandir('public://simpletest');
$count = 0;
foreach ($files as $file) {
$path = 'public://simpletest/' . $file;
if (is_dir($path) && is_numeric($file)) {
file_unmanaged_delete_recursive($path);
$count++;
if (is_dir('public://simpletest')) {
$files = scandir('public://simpletest');
foreach ($files as $file) {
$path = 'public://simpletest/' . $file;
if (is_dir($path) && is_numeric($file)) {
file_unmanaged_delete_recursive($path);
$count++;
}
}
}
......
name = Requirements 1 Test
description = "Tests that a module is not installed when it fails hook_requirements('install')."
package = Core
package = Testing
version = VERSION
core = 8.x
hidden = TRUE
......@@ -2,7 +2,7 @@ name = Requirements 2 Test
description = "Tests that a module is not installed when the one it depends on fails hook_requirements('install)."
dependencies[] = requirements1_test
dependencies[] = comment
package = Core
package = Testing
version = VERSION
core = 8.x
hidden = TRUE
......@@ -146,8 +146,10 @@ function system_test_redirect_invalid_scheme() {
* Implements hook_modules_installed().
*/
function system_test_modules_installed($modules) {
if (in_array('aggregator', $modules)) {
drupal_set_message(t('hook_modules_installed fired for aggregator'));
if (variable_get('test_verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_installed fired for @module', array('@module' => $module)));
}
}
}
......@@ -155,8 +157,10 @@ function system_test_modules_installed($modules) {
* Implements hook_modules_enabled().
*/
function system_test_modules_enabled($modules) {
if (in_array('aggregator', $modules)) {
drupal_set_message(t('hook_modules_enabled fired for aggregator'));
if (variable_get('test_verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_enabled fired for @module', array('@module' => $module)));
}
}
}
......@@ -164,8 +168,10 @@ function system_test_modules_enabled($modules) {
* Implements hook_modules_disabled().
*/
function system_test_modules_disabled($modules) {
if (in_array('aggregator', $modules)) {
drupal_set_message(t('hook_modules_disabled fired for aggregator'));
if (variable_get('test_verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_disabled fired for @module', array('@module' => $module)));
}
}
}
......@@ -173,8 +179,10 @@ function system_test_modules_disabled($modules) {
* Implements hook_modules_uninstalled().
*/
function system_test_modules_uninstalled($modules) {
if (in_array('aggregator', $modules)) {
drupal_set_message(t('hook_modules_uninstalled fired for aggregator'));
if (variable_get('test_verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_uninstalled fired for @module', array('@module' => $module)));
}
}
}
......
......@@ -3267,6 +3267,14 @@ function hook_update_last_removed() {
* module's database tables are removed, allowing your module to query its own
* tables during this routine.
*
* When hook_uninstall() is called, your module will already be disabled, so
* its .module file will not be automatically included. If you need to call API
* functions from your .module file in this hook, use drupal_load() to make
* them available. (Keep this usage to a minimum, though, especially when
* calling API functions that invoke hooks, or API functions from modules
* listed as dependencies, since these may not be available or work as expected
* when the module is disabled.)
*
* @see hook_install()
* @see hook_schema()
* @see hook_disable()
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment