diff options
Diffstat (limited to 'includes/installer/Installer.php')
-rw-r--r-- | includes/installer/Installer.php | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index d2651ae5..5ae499db 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -186,7 +186,6 @@ abstract class Installer { 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin', - 'wgResourceLoaderMaxQueryLength', ); /** @@ -225,7 +224,7 @@ abstract class Installer { // $wgLogo is probably wrong (bug 48084); set something that will work. // Single quotes work fine here, as LocalSettingsGenerator outputs this unescaped. - 'wgLogo' => '$wgScriptPath/resources/assets/wiki.png', + 'wgLogo' => '$wgResourceBasePath/resources/assets/wiki.png', ); /** @@ -285,28 +284,28 @@ abstract class Installer { */ public $licenses = array( 'cc-by' => array( - 'url' => 'http://creativecommons.org/licenses/by/3.0/', - 'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-by.png', + 'url' => 'https://creativecommons.org/licenses/by/3.0/', + 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-by.png', ), 'cc-by-sa' => array( - 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/', - 'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-by-sa.png', + 'url' => 'https://creativecommons.org/licenses/by-sa/3.0/', + 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png', ), 'cc-by-nc-sa' => array( - 'url' => 'http://creativecommons.org/licenses/by-nc-sa/3.0/', - 'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-by-nc-sa.png', + 'url' => 'https://creativecommons.org/licenses/by-nc-sa/3.0/', + 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-by-nc-sa.png', ), 'cc-0' => array( 'url' => 'https://creativecommons.org/publicdomain/zero/1.0/', - 'icon' => '{$wgResourceBasePath}/resources/assets/licenses/cc-0.png', + 'icon' => '$wgResourceBasePath/resources/assets/licenses/cc-0.png', ), 'pd' => array( 'url' => '', - 'icon' => '{$wgResourceBasePath}/resources/assets/licenses/public-domain.png', + 'icon' => '$wgResourceBasePath/resources/assets/licenses/public-domain.png', ), 'gfdl' => array( - 'url' => 'http://www.gnu.org/copyleft/fdl.html', - 'icon' => '{$wgResourceBasePath}/resources/assets/licenses/gnu-fdl.png', + 'url' => 'https://www.gnu.org/copyleft/fdl.html', + 'icon' => '$wgResourceBasePath/resources/assets/licenses/gnu-fdl.png', ), 'none' => array( 'url' => '', @@ -674,7 +673,6 @@ abstract class Installer { 'site_stats', array( 'ss_row_id' => 1, - 'ss_total_views' => 0, 'ss_total_edits' => 0, 'ss_good_articles' => 0, 'ss_total_pages' => 0, @@ -728,7 +726,7 @@ abstract class Installer { } $databases = array_flip( $databases ); if ( !$databases ) { - $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) ); + $this->showError( 'config-no-db', $wgLang->commaList( $allNames ), count( $allNames ) ); // @todo FIXME: This only works for the web installer! return false; @@ -898,11 +896,12 @@ abstract class Installer { } /** - * Scare user to death if they have mod_security + * Scare user to death if they have mod_security or mod_security2 * @return bool */ protected function envCheckModSecurity() { - if ( self::apacheModulePresent( 'mod_security' ) ) { + if ( self::apacheModulePresent( 'mod_security' ) + || self::apacheModulePresent( 'mod_security2' ) ) { $this->showMessage( 'config-mod-security' ); } @@ -1141,9 +1140,6 @@ abstract class Installer { * Check the libicu version */ protected function envCheckLibicu() { - $utf8 = function_exists( 'utf8_normalize' ); - $intl = function_exists( 'normalizer_normalize' ); - /** * This needs to be updated something that the latest libicu * will properly normalize. This normalization was found at @@ -1157,18 +1153,7 @@ abstract class Installer { $useNormalizer = 'php'; $needsUpdate = false; - /** - * We're going to prefer the pecl extension here unless - * utf8_normalize is more up to date. - */ - if ( $utf8 ) { - $useNormalizer = 'utf8'; - $utf8 = utf8_normalize( $not_normal_c, UtfNormal::UNORM_NFC ); - if ( $utf8 !== $normal_c ) { - $needsUpdate = true; - } - } - if ( $intl ) { + if ( function_exists( 'normalizer_normalize' ) ) { $useNormalizer = 'intl'; $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C ); if ( $intl !== $normal_c ) { @@ -1176,8 +1161,7 @@ abstract class Installer { } } - // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8', - // 'config-unicode-using-intl' + // Uses messages 'config-unicode-using-php' and 'config-unicode-using-intl' if ( $useNormalizer === 'php' ) { $this->showMessage( 'config-unicode-pure-php-warning' ); } else { @@ -1376,8 +1360,8 @@ abstract class Installer { } try { - $text = Http::get( $url . $file, array( 'timeout' => 3 ) ); - } catch ( MWException $e ) { + $text = Http::get( $url . $file, array( 'timeout' => 3 ), __METHOD__ ); + } catch ( Exception $e ) { // Http::get throws with allow_url_fopen = false and no curl extension. $text = null; } @@ -1452,13 +1436,16 @@ abstract class Installer { return array(); } + // extensions -> extension.json, skins -> skin.json + $jsonFile = substr( $directory, 0, strlen( $directory ) -1 ) . '.json'; + $dh = opendir( $extDir ); $exts = array(); while ( ( $file = readdir( $dh ) ) !== false ) { if ( !is_dir( "$extDir/$file" ) ) { continue; } - if ( file_exists( "$extDir/$file/$file.php" ) ) { + if ( file_exists( "$extDir/$file/$jsonFile" ) || file_exists( "$extDir/$file/$file.php" ) ) { $exts[] = $file; } } @@ -1469,15 +1456,16 @@ abstract class Installer { } /** - * Returns a default value to be used for $wgDefaultSkin: the preferred skin, if available among - * the installed skins, or any other one otherwise. + * Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings, + * but will fall back to another if the default skin is missing and some other one is present + * instead. * * @param string[] $skinNames Names of installed skins. * @return string */ public function getDefaultSkin( array $skinNames ) { $defaultSkin = $GLOBALS['wgDefaultSkin']; - if ( in_array( $defaultSkin, $skinNames ) ) { + if ( !$skinNames || in_array( $defaultSkin, $skinNames ) ) { return $defaultSkin; } else { return $skinNames[0]; @@ -1504,16 +1492,31 @@ abstract class Installer { */ global $wgAutoloadClasses; $wgAutoloadClasses = array(); + $queue = array(); require "$IP/includes/DefaultSettings.php"; foreach ( $exts as $e ) { - require_once "$IP/extensions/$e/$e.php"; + if ( file_exists( "$IP/extensions/$e/extension.json" ) ) { + $queue["$IP/extensions/$e/extension.json"] = 1; + } else { + require_once "$IP/extensions/$e/$e.php"; + } } + $registry = new ExtensionRegistry(); + $data = $registry->readFromQueue( $queue ); + $wgAutoloadClasses += $data['autoload']; + $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ? $wgHooks['LoadExtensionSchemaUpdates'] : array(); + if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) { + $hooksWeWant = array_merge_recursive( + $hooksWeWant, + $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] + ); + } // Unset everyone else's hooks. Lord knows what someone might be doing // in ParserFirstCallInit (see bug 27171) $GLOBALS['wgHooks'] = array( 'LoadExtensionSchemaUpdates' => $hooksWeWant ); @@ -1723,7 +1726,7 @@ abstract class Installer { if ( MWHttpRequest::canMakeRequests() ) { $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl, - array( 'method' => 'POST', 'postData' => $params ) )->execute(); + array( 'method' => 'POST', 'postData' => $params ), __METHOD__ )->execute(); if ( !$res->isOK() ) { $s->warning( 'config-install-subscribe-fail', $res->getMessage() ); } @@ -1753,7 +1756,7 @@ abstract class Installer { false, User::newFromName( 'MediaWiki default' ) ); - } catch ( MWException $e ) { + } catch ( Exception $e ) { //using raw, because $wgShowExceptionDetails can not be set yet $status->fatal( 'config-install-mainpage-failed', $e->getMessage() ); } |