From e5f1b2cd6d8edb4bfbce58fbc531b3a97a9d4479 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 9 Nov 2010 17:01:09 +0000 Subject: [PATCH] Followup r76391 per CR: just do $wgUpgradeKey in generateSecretKey() --- includes/installer/CoreInstaller.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/includes/installer/CoreInstaller.php b/includes/installer/CoreInstaller.php index f91628095d..861409ae7d 100644 --- a/includes/installer/CoreInstaller.php +++ b/includes/installer/CoreInstaller.php @@ -308,7 +308,6 @@ abstract class CoreInstaller extends Installer { array( 'name' => 'tables', 'callback' => array( $this, 'installTables' ) ), array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ), array( 'name' => 'secretkey', 'callback' => array( $this, 'generateSecretKey' ) ), - array( 'name' => 'upgradekey', 'callback' => array( $this, 'generateUpgradeKey' ) ), array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ), array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ), ); @@ -395,20 +394,12 @@ abstract class CoreInstaller extends Installer { $this->setVar( 'wgSecretKey', $secretKey ); - return $status; - } + // Generate a $wgUpgradeKey from our secret key + $secretKey = md5( $secretKey ); + $randPos = mt_rand( 0, strlen( $secretKey ) - 8 ); + $this->setVar( 'wgUpgradeKey', substr( $secretKey, $randPos, $randPos + 8 ) ); - /** - * Generate a default $wgUpradeKey, using a semi-random 8 character portion - * of md5($wgSecretKey) - * - * @return Status - */ - protected function generateUpgradeKey() { - $secret = md5( $this->getVar( 'wgSecretKey' ) ); - $randPos = mt_rand( 0, strlen( $secret ) - 8 ); - $this->setVar( 'wgUpgradeKey', substr( $secret, $randPos, $randPos + 8 ) ); - return Status::newGood(); + return $status; } /** -- 2.20.1