summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Jones2016-12-21 14:29:02 +0000
committerSteven Jones2016-12-21 14:29:02 +0000
commit464f2db669072f6a73e9e23755fb79e89de2df76 (patch)
treef706d5e35a22d28bc854431f8cb6f119dd4a2c8f
parent6621cb8f8aca5c485da593299d270ce7c6b7d0c3 (diff)
Issue #2838332: Verifying a Drupal 8 site breaks the menu router2838332-d8-verify-broken
-rw-r--r--platform/drupal/clear_8.inc38
1 files changed, 36 insertions, 2 deletions
diff --git a/platform/drupal/clear_8.inc b/platform/drupal/clear_8.inc
index bda4671..ada2705 100644
--- a/platform/drupal/clear_8.inc
+++ b/platform/drupal/clear_8.inc
@@ -5,6 +5,40 @@
* Rebuild all the caches
*/
-drupal_flush_all_caches();
-drush_log(dt('All caches flushed'));
+// Pinched from Drush 8.
+
+use Drush\Log\LogLevel;
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Site\Settings;
+use Symfony\Component\HttpFoundation\Request;
+
+chdir(DRUPAL_ROOT);
+// Clear the APC cache to ensure APC class loader is reset.
+if (function_exists('apc_fetch')) {
+ apc_clear_cache('user');
+}
+// Clear user cache for all major platforms.
+$user_caches = [
+ 'apcu_clear_cache',
+ 'wincache_ucache_clear',
+ 'xcache_clear_cache',
+];
+array_map('call_user_func', array_filter($user_caches, 'is_callable'));
+$autoloader = drush_drupal_load_autoloader(DRUPAL_ROOT);
+require_once DRUSH_DRUPAL_CORE . '/includes/utility.inc';
+$request = Request::createFromGlobals();
+// Ensure that the HTTP method is set, which does not happen with Request::createFromGlobals().
+$request->setMethod('GET');
+// Manually resemble early bootstrap of DrupalKernel::boot().
+require_once DRUSH_DRUPAL_CORE . '/includes/bootstrap.inc';
+DrupalKernel::bootEnvironment();
+// Avoid 'Only variables should be passed by reference'
+$root = DRUPAL_ROOT;
+$site_path = DrupalKernel::findSitePath($request);
+Settings::initialize($root, $site_path, $autoloader);
+// Use our error handler since _drupal_log_error() depends on an unavailable theme system (ugh).
+set_error_handler('drush_error_handler');
+// drupal_rebuild() calls drupal_flush_all_caches() itself, so we don't do it manually.
+drupal_rebuild($autoloader, $request);
+drush_log(dt('Cache rebuild complete.'), LogLevel::OK);