Page MenuHomeIn-Portal Phabricator

D426.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 3:45 AM

D426.diff

Index: branches/5.2.x/core/install.php
===================================================================
--- branches/5.2.x/core/install.php
+++ branches/5.2.x/core/install.php
@@ -629,6 +629,33 @@
$this->Conn->Query('SET NAMES \''.$this->toolkit->systemConfig->get('DBCharset', 'Database').'\' COLLATE \''.$this->toolkit->systemConfig->get('DBCollation', 'Database').'\'');
}
+ if ( !$this->toolkit->systemConfig->get('SecurityHmacKey', 'Misc')
+ || !$this->toolkit->systemConfig->get('SecurityEncryptionKey', 'Misc')
+ ) {
+ // Include class declarations manually, because kApplication isn't available.
+ require_once FULL_PATH . '/core/kernel/security/SecurityEncrypter.php';
+ require_once FULL_PATH . '/core/kernel/security/SecurityGenerator.php';
+ require_once FULL_PATH . '/core/kernel/security/SecurityGeneratorPromise.php';
+
+ // Include dependencies, to make "random_int" function available in earlier PHP versions.
+ require_once FULL_PATH . '/vendor/autoload.php';
+
+ // Generate missing security-related settings.
+ $this->toolkit->systemConfig->set(
+ 'SecurityHmacKey',
+ 'Misc',
+ base64_encode(SecurityGenerator::generateString(
+ SecurityEncrypter::HASHING_KEY_LENGTH,
+ SecurityGenerator::CHAR_ALNUM | SecurityGenerator::CHAR_SYMBOLS
+ ))
+ );
+ $this->toolkit->systemConfig->set(
+ 'SecurityEncryptionKey',
+ 'Misc',
+ SecurityGenerator::generateBytes(SecurityEncrypter::ENCRYPTION_KEY_LENGTH)
+ );
+ }
+
$this->toolkit->systemConfig->save();
if ($this->currentStep == 'db_config') {
@@ -845,24 +872,6 @@
}
}
- if ( !$this->toolkit->systemConfig->get('SecurityHmacKey', 'Misc')
- || !$this->toolkit->systemConfig->get('SecurityEncryptionKey', 'Misc')
- ) {
- $this->toolkit->systemConfig->set(
- 'SecurityHmacKey',
- 'Misc',
- base64_encode(SecurityGenerator::generateString(
- SecurityEncrypter::HASHING_KEY_LENGTH,
- SecurityGenerator::CHAR_ALNUM | SecurityGenerator::CHAR_SYMBOLS
- ))
- );
- $this->toolkit->systemConfig->set(
- 'SecurityEncryptionKey',
- 'Misc',
- SecurityGenerator::generateBytes(SecurityEncrypter::ENCRYPTION_KEY_LENGTH)
- );
- }
-
$this->toolkit->systemConfig->save();
break;

Event Timeline