]);
}
- // determine randomized cookie prefix
+ // determine the (randomized) cookie prefix
+ $useRandomCookiePrefix = true;
+ if (self::$developerMode && DevtoolsSetup::getInstance()->forceStaticCookiePrefix()) {
+ $useRandomCookiePrefix = false;
+ }
+
$prefix = 'wsc31_';
- if (!self::$developerMode) {
+ if ($useRandomCookiePrefix) {
$cookieNames = array_keys($_COOKIE);
while (true) {
$prefix = 'wsc_' . substr(sha1(mt_rand()), 0, 6) . '_';
return (isset($this->configuration['setup']) && isset($this->configuration['setup']['useDefaultInstallPath']) && $this->configuration['setup']['useDefaultInstallPath'] === true);
}
+ /**
+ * Returns true if a static cookie prefix should be used, instead of the randomized
+ * value used for non-dev-mode installations.
+ *
+ * @return boolean
+ */
+ public function forceStaticCookiePrefix() {
+ return (isset($this->configuration['setup']) && isset($this->configuration['setup']['forceStaticCookiePrefix']) && $this->configuration['setup']['forceStaticCookiePrefix'] === true);
+ }
+
/**
* List of option values that will be set after the setup has completed.
*
public function getOptionOverrides() {
if (!isset($this->configuration['configuration']) || empty($this->configuration['configuration']['option'])) return [];
+ if (isset($this->configuration['configuration']['option']['cookie_prefix'])) {
+ throw new \DomainException("The 'cookie_prefix' option cannot be set during the setup, consider using the 'forceStaticCookiePrefix' setting instead.");
+ }
+
return $this->configuration['configuration']['option'];
}