2013-12-10 13:50:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Rebuilds all Drupal caches even when Drupal itself does not work.
|
|
|
|
*
|
|
|
|
* Needs a token query argument which can be calculated using the
|
|
|
|
* scripts/rebuild_token_calculator.sh script.
|
|
|
|
*
|
|
|
|
* @see drupal_rebuild()
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Drupal\Component\Utility\Crypt;
|
2014-03-24 08:51:28 +00:00
|
|
|
use Drupal\Component\Utility\Settings;
|
2013-12-10 13:50:21 +00:00
|
|
|
|
|
|
|
// Change the directory to the Drupal root.
|
|
|
|
chdir('..');
|
|
|
|
|
2014-01-25 01:48:29 +00:00
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
require_once __DIR__ . '/includes/bootstrap.inc';
|
|
|
|
require_once __DIR__ . '/includes/utility.inc';
|
2013-12-10 13:50:21 +00:00
|
|
|
|
|
|
|
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
|
|
|
|
|
2014-03-24 08:51:28 +00:00
|
|
|
if (Settings::get('rebuild_access', FALSE) ||
|
2013-12-10 13:50:21 +00:00
|
|
|
(isset($_GET['token'], $_GET['timestamp']) &&
|
|
|
|
((REQUEST_TIME - $_GET['timestamp']) < 300) &&
|
2014-03-24 08:51:28 +00:00
|
|
|
($_GET['token'] === Crypt::hmacBase64($_GET['timestamp'], Settings::get('hash_salt')))
|
2013-12-10 13:50:21 +00:00
|
|
|
)) {
|
|
|
|
|
|
|
|
drupal_rebuild();
|
|
|
|
drupal_set_message('Cache rebuild complete.');
|
|
|
|
}
|
|
|
|
|
|
|
|
header('Location: ' . $GLOBALS['base_url']);
|