diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-11-11 11:53:38 -0800 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-11-11 11:53:38 -0800 |
commit | 58237ba0b26f52a5634adf81f73492fea3961c3b (patch) | |
tree | 2c8ef089df8b211a912df59b7ca5ee532722a4ef | |
parent | 4c994207662887d44f54ccd281e997e92b08fc67 (diff) | |
download | brdo-58237ba0b26f52a5634adf81f73492fea3961c3b.tar.gz brdo-58237ba0b26f52a5634adf81f73492fea3961c3b.tar.bz2 |
Issue #1049284 by xjm: Fixed Running update.php to flush caches no longer works unless there are updates pending.
-rw-r--r-- | modules/simpletest/tests/update_script_test.module | 17 | ||||
-rw-r--r-- | modules/system/system.test | 15 | ||||
-rw-r--r-- | update.php | 3 |
3 files changed, 32 insertions, 3 deletions
diff --git a/modules/simpletest/tests/update_script_test.module b/modules/simpletest/tests/update_script_test.module index b3d9bbc7f..beb5a71ec 100644 --- a/modules/simpletest/tests/update_script_test.module +++ b/modules/simpletest/tests/update_script_test.module @@ -1 +1,18 @@ <?php + +/** + * @file + * This file provides testing functionality for update.php. + */ + +/** + * Implements hook_flush_caches(). + * + * This sets a message to confirm that all caches are cleared whenever + * update.php completes. + * + * @see UpdateScriptFunctionalTest::testRequirements() + */ +function update_script_test_flush_caches() { + drupal_set_message(t('hook_flush_caches() invoked for update_script_test.module.')); +} diff --git a/modules/system/system.test b/modules/system/system.test index a00f51e26..e95e8c0d5 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -2133,12 +2133,15 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase { $this->drupalGet($this->update_url, array('external' => TRUE)); $this->drupalPost(NULL, array(), t('Continue')); $this->assertText(t('No pending updates.'), t('End of update process was reached.')); + // Confirm that all caches were cleared. + $this->assertText(t('hook_flush_caches() invoked for update_script_test.module.'), 'Caches were cleared when there were no requirements warnings or errors.'); // If there is a requirements warning, we expect it to be initially // displayed, but clicking the link to proceed should allow us to go - // through the rest of the update process uninterrupted. (First run this - // test with pending updates to make sure they can be run successfully; - // then try again without pending updates to make sure that works too.) + // through the rest of the update process uninterrupted. + + // First, run this test with pending updates to make sure they can be run + // successfully. variable_set('update_script_test_requirement_type', REQUIREMENT_WARNING); drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1); $this->drupalGet($this->update_url, array('external' => TRUE)); @@ -2148,12 +2151,18 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase { $this->drupalPost(NULL, array(), t('Continue')); $this->drupalPost(NULL, array(), t('Apply pending updates')); $this->assertText(t('The update_script_test_update_7000() update was executed successfully.'), t('End of update process was reached.')); + // Confirm that all caches were cleared. + $this->assertText(t('hook_flush_caches() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.'); + + // Now try again without pending updates to make sure that works too. $this->drupalGet($this->update_url, array('external' => TRUE)); $this->assertText('This is a requirements warning provided by the update_script_test module.'); $this->clickLink('try again'); $this->assertNoText('This is a requirements warning provided by the update_script_test module.'); $this->drupalPost(NULL, array(), t('Continue')); $this->assertText(t('No pending updates.'), t('End of update process was reached.')); + // Confirm that all caches were cleared. + $this->assertText(t('hook_flush_caches() invoked for update_script_test.module.'), 'Caches were cleared after applying updates and re-running the script.'); // If there is a requirements error, it should be displayed even after // clicking the link to proceed (since the problem that triggered the error diff --git a/update.php b/update.php index 5e771a824..2b5d2218b 100644 --- a/update.php +++ b/update.php @@ -108,6 +108,9 @@ function update_script_selection_form($form, &$form_state) { $form['links'] = array( '#markup' => theme('item_list', array('items' => update_helpful_links())), ); + + // No updates to run, so caches won't get flushed later. Clear them now. + drupal_flush_all_caches(); } else { $form['help'] = array( |