X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FInstaller.php;h=88478f40372d67018b580c3e5b46171672be254e;hb=00081c453e3003a40fa5736958efa00d2645efbe;hp=79a42baf45766c25920adda036ff89dcc476c0cd;hpb=f4c35c98fc218fec0b133b1feea85a6b0ca05f7c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 79a42baf45..88478f4037 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -71,7 +71,7 @@ abstract class Installer { /** * Minimum memory size in MB. * - * @var integer + * @var int */ protected $minMemorySize = 50; @@ -102,6 +102,7 @@ abstract class Installer { 'mysql', 'postgres', 'oracle', + 'mssql', 'sqlite', ); @@ -169,7 +170,6 @@ abstract class Installer { 'wgMetaNamespace', 'wgDeletedDirectory', 'wgEnableUploads', - 'wgLogo', 'wgShellLocale', 'wgSecretKey', 'wgUseInstantCommons', @@ -199,7 +199,7 @@ abstract class Installer { '_NamespaceType' => 'site-name', '_AdminName' => '', // will be set later, when the user selects language '_AdminPassword' => '', - '_AdminPassword2' => '', + '_AdminPasswordConfirm' => '', '_AdminEmail' => '', '_Subscribe' => false, '_SkipOptional' => 'continue', @@ -210,6 +210,10 @@ abstract class Installer { '_MemCachedServers' => '', '_UpgradeKeySupplied' => false, '_ExistingDBSettings' => false, + + // $wgLogo is probably wrong (bug 48084); set something that will work. + // Single quotes work fine here, as LocalSettingsGenerator outputs this unescaped. + 'wgLogo' => '$wgStylePath/common/images/wiki.png', ); /** @@ -325,19 +329,19 @@ abstract class Installer { * The parameters are like parameters to wfMessage(). * The messages will be in wikitext format, which will be converted to an * output format such as HTML or text before being sent to the user. - * @param $msg + * @param string $msg */ abstract public function showMessage( $msg /*, ... */ ); /** * Same as showMessage(), but for displaying errors - * @param $msg + * @param string $msg */ abstract public function showError( $msg /*, ... */ ); /** * Show a message to the installing user by using a Status object - * @param $status Status + * @param Status $status */ abstract public function showStatusMessage( Status $status ); @@ -345,15 +349,27 @@ abstract class Installer { * Constructor, always call this from child classes. */ public function __construct() { - global $wgExtensionMessagesFiles, $wgUser; + global $wgMessagesDirs, $wgUser; - // Disable the i18n cache and LoadBalancer + // Disable the i18n cache Language::getLocalisationCache()->disableBackend(); + // Disable LoadBalancer and wfGetDB etc. LBFactory::disableBackend(); - // Load the installer's i18n file. - $wgExtensionMessagesFiles['MediawikiInstaller'] = - __DIR__ . '/Installer.i18n.php'; + // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and + // SqlBagOStuff will then throw since we just disabled wfGetDB) + $GLOBALS['wgMemc'] = new EmptyBagOStuff; + ObjectCache::clear(); + $emptyCache = array( 'class' => 'EmptyBagOStuff' ); + $GLOBALS['wgObjectCaches'] = array( + CACHE_NONE => $emptyCache, + CACHE_DB => $emptyCache, + CACHE_ANYTHING => $emptyCache, + CACHE_MEMCACHED => $emptyCache, + ); + + // Load the installer's i18n. + $wgMessagesDirs['MediawikiInstaller'] = __DIR__ . '/i18n'; // Having a user with id = 0 safeguards us from DB access via User::loadOptions(). $wgUser = User::newFromId( 0 ); @@ -386,7 +402,7 @@ abstract class Installer { $this->compiledDBs = $compiledDBs; $this->parserTitle = Title::newFromText( 'Installer' ); - $this->parserOptions = new ParserOptions; // language will be wrong :( + $this->parserOptions = new ParserOptions; // language will be wrong :( $this->parserOptions->setEditSection( false ); } @@ -448,8 +464,8 @@ abstract class Installer { /** * Set a MW configuration variable, or internal installer configuration variable. * - * @param $name String - * @param $value Mixed + * @param string $name + * @param mixed $value */ public function setVar( $name, $value ) { $this->settings[$name] = $value; @@ -460,8 +476,8 @@ abstract class Installer { * The defaults come from $GLOBALS (ultimately DefaultSettings.php). * Installer variables are typically prefixed by an underscore. * - * @param $name String - * @param $default Mixed + * @param string $name + * @param mixed $default * * @return mixed */ @@ -485,7 +501,7 @@ abstract class Installer { /** * Get an instance of DatabaseInstaller for the specified DB type. * - * @param $type Mixed: DB installer for which is needed, false to use default. + * @param mixed $type DB installer for which is needed, false to use default. * * @return DatabaseInstaller */ @@ -507,7 +523,7 @@ abstract class Installer { /** * Determine if LocalSettings.php exists. If it does, return its variables. * - * @return Array + * @return array */ public static function getExistingLocalSettings() { global $IP; @@ -532,7 +548,7 @@ abstract class Installer { * This is a security mechanism to avoid compromise of the password in the * event of session ID compromise. * - * @param $realPassword String + * @param string $realPassword * * @return string */ @@ -544,8 +560,8 @@ abstract class Installer { * Set a variable which stores a password, except if the new value is a * fake password in which case leave it as it is. * - * @param $name String - * @param $value Mixed + * @param string $name + * @param mixed $value */ public function setPassword( $name, $value ) { if ( !preg_match( '/^\*+$/', $value ) ) { @@ -591,9 +607,9 @@ abstract class Installer { * whatever, this function is guarded to catch the attempted DB access and to present * some fallback text. * - * @param $text String - * @param $lineStart Boolean - * @return String + * @param string $text + * @param bool $lineStart + * @return string */ public function parse( $text, $lineStart = false ) { global $wgParser; @@ -632,7 +648,7 @@ abstract class Installer { * Install step which adds a row to the site_stats table with appropriate * initial values. * - * @param $installer DatabaseInstaller + * @param DatabaseInstaller $installer * * @return Status */ @@ -641,15 +657,19 @@ abstract class Installer { if ( !$status->isOK() ) { return $status; } - $status->value->insert( 'site_stats', array( - 'ss_row_id' => 1, - 'ss_total_views' => 0, - 'ss_total_edits' => 0, - 'ss_good_articles' => 0, - 'ss_total_pages' => 0, - 'ss_users' => 0, - 'ss_images' => 0 ), - __METHOD__, 'IGNORE' ); + $status->value->insert( + 'site_stats', + array( + 'ss_row_id' => 1, + 'ss_total_views' => 0, + 'ss_total_edits' => 0, + 'ss_good_articles' => 0, + 'ss_total_pages' => 0, + 'ss_users' => 0, + 'ss_images' => 0 + ), + __METHOD__, 'IGNORE' + ); return Status::newGood(); } @@ -965,7 +985,7 @@ abstract class Installer { /** * Helper function to be called from envCheckServer() - * @return String + * @return string */ abstract protected function envGetDefaultServer(); @@ -1116,7 +1136,7 @@ abstract class Installer { /** * Convert a hex string representing a Unicode code point to that code point. - * @param $c String + * @param string $c * @return string */ protected function unicodeChar( $c ) { @@ -1219,7 +1239,7 @@ abstract class Installer { * of known Unix-like defaults, as well as the PATH environment variable * (which should maybe make it work for Windows?) * - * @return Array + * @return array */ protected static function getPossibleBinPaths() { return array_merge( @@ -1238,9 +1258,9 @@ abstract class Installer { * * @param string $path path to search * @param array $names of executable names - * @param $versionInfo Boolean false or array with two members: - * 0 => Command to run for version check, with $1 for the full executable name - * 1 => String to compare the output with + * @param array|bool $versionInfo False or array with two members: + * 0 => Command to run for version check, with $1 for the full executable name + * 1 => String to compare the output with * * If $versionInfo is not false, only executables with a version * matching $versionInfo[1] will be returned. @@ -1278,8 +1298,8 @@ abstract class Installer { * @see locateExecutable() * @param array $names Array of possible names. * @param array|bool $versionInfo Default: false or array with two members: - * 0 => Command to run for version check, with $1 for the full executable name - * 1 => String to compare the output with + * 0 => Command to run for version check, with $1 for the full executable name + * 1 => String to compare the output with * * If $versionInfo is not false, only executables with a version * matching $versionInfo[1] will be returned. @@ -1300,8 +1320,8 @@ abstract class Installer { * Checks if scripts located in the given directory can be executed via the given URL. * * Used only by environment checks. - * @param $dir string - * @param $url string + * @param string $dir + * @param string $url * @return bool|int|string */ public function dirIsExecutable( $dir, $url ) { @@ -1366,7 +1386,7 @@ abstract class Installer { /** * ParserOptions are constructed before we determined the language, so fix it * - * @param $lang Language + * @param Language $lang */ public function setParserLanguage( $lang ) { $this->parserOptions->setTargetLanguage( $lang ); @@ -1375,7 +1395,7 @@ abstract class Installer { /** * Overridden by WebInstaller to provide lastPage parameters. - * @param $page string + * @param string $page * @return string */ protected function getDocUrl( $page ) { @@ -1460,7 +1480,7 @@ abstract class Installer { * There must be a config-install-$name message defined per step, which will * be shown on install. * - * @param $installer DatabaseInstaller so we can make callbacks + * @param DatabaseInstaller $installer DatabaseInstaller so we can make callbacks * @return array */ protected function getInstallSteps( DatabaseInstaller $installer ) { @@ -1514,7 +1534,7 @@ abstract class Installer { * @param array $startCB A callback array for the beginning of each step * @param array $endCB A callback array for the end of each step * - * @return Array of Status objects + * @return array Array of Status objects */ public function performInstallation( $startCB, $endCB ) { $installResults = array(); @@ -1563,7 +1583,7 @@ abstract class Installer { * Generate a secret value for variables using our CryptRand generator. * Produce a warning if the random source was insecure. * - * @param $keys Array + * @param array $keys * @return Status */ protected function doGenerateKeys( $keys ) { @@ -1633,7 +1653,7 @@ abstract class Installer { } /** - * @param $s Status + * @param Status $s */ private function subscribeToMediaWikiAnnounce( Status $s ) { $params = array( @@ -1664,7 +1684,7 @@ abstract class Installer { /** * Insert Main Page with default content. * - * @param $installer DatabaseInstaller + * @param DatabaseInstaller $installer * @return Status */ protected function createMainpage( DatabaseInstaller $installer ) { @@ -1729,7 +1749,7 @@ abstract class Installer { * * @param array $callback A valid installation callback array, in this form: * array( 'name' => 'some-unique-name', 'callback' => array( $obj, 'function' ) ); - * @param string $findStep the step to find. Omit to put the step at the beginning + * @param string $findStep The step to find. Omit to put the step at the beginning */ public function addInstallStep( $callback, $findStep = 'BEGINNING' ) { $this->extraInstallSteps[$findStep][] = $callback;