/** * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { drupal_clear_css_cache(); drupal_clear_js_cache(); // This form allows page compression settings to be changed, which can // invalidate cached pages in the render cache, so it needs to be cleared on // form submit. $this->renderCache->deleteAll(); $this->config('system.performance')->set('cache.page.use_internal', $form_state['values']['cache'])->set('cache.page.max_age', $form_state['values']['page_cache_maximum_age'])->set('response.gzip', $form_state['values']['page_compression'])->set('css.preprocess', $form_state['values']['preprocess_css'])->set('js.preprocess', $form_state['values']['preprocess_js'])->save(); parent::submitForm($form, $form_state); }
/** * Perform updates for one second or until finished. * * @return * An array indicating the status after doing updates. The first element is * the overall percentage finished. The second element is a status message. */ function update_do_updates() { while (isset($_SESSION['update_remaining']) && ($update = reset($_SESSION['update_remaining']))) { $update_finished = update_data($update['module'], $update['version']); if ($update_finished == 1) { // Dequeue the completed update. unset($_SESSION['update_remaining'][key($_SESSION['update_remaining'])]); $update_finished = 0; // Make sure this step isn't counted double } if (timer_read('page') > 1000) { break; } } if ($_SESSION['update_total']) { $percentage = floor(($_SESSION['update_total'] - count($_SESSION['update_remaining']) + $update_finished) / $_SESSION['update_total'] * 100); } else { $percentage = 100; } // When no updates remain, clear the caches in case the data has been updated. if (!isset($update['module'])) { cache_clear_all('*', 'cache', TRUE); cache_clear_all('*', 'cache_page', TRUE); cache_clear_all('*', 'cache_menu', TRUE); cache_clear_all('*', 'cache_filter', TRUE); drupal_clear_css_cache(); } return array($percentage, isset($update['module']) ? 'Updating ' . $update['module'] . ' module' : 'Updating complete'); }
/** * Wraps drupal_clear_css_cache(). */ protected function clearCssCache() { drupal_clear_css_cache(); }
/** * @Given /^the "([^"]*)" cache bin has been cleared$/ */ public function theCacheBinHasBeenCleared($bin) { if ($bin == 'css' || $bin == 'js') { _drupal_flush_css_js(); drupal_clear_css_cache(); drupal_clear_js_cache(); } elseif ($bin == 'block') { cache_clear_all(null, 'cache_block'); } elseif ($bin == 'theme') { cache_clear_all('theme_registry', 'cache', true); } else { cache_clear_all(null, $bin); } }