Version 1
[yaffs-website] / web / core / scripts / rebuild_token_calculator.sh
diff --git a/web/core/scripts/rebuild_token_calculator.sh b/web/core/scripts/rebuild_token_calculator.sh
new file mode 100755 (executable)
index 0000000..38a64ab
--- /dev/null
@@ -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;
+}
+
+require __DIR__ . '/../../autoload.php';
+require_once __DIR__ . '/../includes/bootstrap.inc';
+
+$request = Request::createFromGlobals();
+Settings::initialize(DrupalKernel::findSitePath($request));
+
+$timestamp = time();
+$token = Crypt::hmacBase64($timestamp, Settings::get('hash_salt'));
+
+print "timestamp=$timestamp&token=$token\n";