diff core/scripts/rebuild_token_calculator.sh @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/scripts/rebuild_token_calculator.sh	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,27 @@
+#!/usr/bin/env php
+<?php
+
+/**
+ * @file
+ * Command line token calculator for rebuild.php.
+ */
+
+use Drupal\Component\Utility\Crypt;
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Site\Settings;
+use Symfony\Component\HttpFoundation\Request;
+
+if (PHP_SAPI !== 'cli') {
+  return;
+}
+
+$autoloader = require __DIR__ . '/../../autoload.php';
+require_once __DIR__ . '/../includes/bootstrap.inc';
+
+$request = Request::createFromGlobals();
+Settings::initialize(DRUPAL_ROOT, DrupalKernel::findSitePath($request), $autoloader);
+
+$timestamp = time();
+$token = Crypt::hmacBase64($timestamp, Settings::get('hash_salt'));
+
+print "timestamp=$timestamp&token=$token\n";