/** * Generate a secret value for variables using our CryptRand generator. * Produce a warning if the random source was insecure. * * @param $keys Array * @return Status */ protected function doGenerateKeys($keys) { $status = Status::newGood(); $strong = true; foreach ($keys as $name => $length) { $secretKey = MWCryptRand::generateHex($length, true); if (!MWCryptRand::wasStrong()) { $strong = false; } $this->setVar($name, $secretKey); } if (!$strong) { $names = array_keys($keys); $names = preg_replace('/^(.*)$/', '\\$$1', $names); global $wgLang; $status->warning('config-insecure-keys', $wgLang->listToText($names), count($names)); } return $status; }