X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Finstaller%2FInstaller.php;h=5e018e05592a856c7f5fb0e9b5a28bfcf218e2f7;hp=5ea9bfea329c455ba008bef1a309f4f21185b1d5;hb=ad136143c5de92257c4ad5459d3c39186fbf800a;hpb=a18476eab39dc201384c68cbd27228c5af32f7fc diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 5ea9bfea32..94a5a5a474 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -24,6 +24,7 @@ * @ingroup Deployment */ use MediaWiki\MediaWikiServices; +use MediaWiki\Shell\Shell; /** * This documentation group collects source code files with deployment functionality. @@ -243,7 +244,6 @@ abstract class Installer { * @var array */ protected $objectCaches = [ - 'xcache' => 'xcache_get', 'apc' => 'apc_fetch', 'apcu' => 'apcu_fetch', 'wincache' => 'wincache_ucache_get' @@ -364,7 +364,7 @@ abstract class Installer { // disable (problematic) object cache types explicitly, preserving all other (working) ones // bug T113843 - $emptyCache = [ 'class' => 'EmptyBagOStuff' ]; + $emptyCache = [ 'class' => EmptyBagOStuff::class ]; $objectCaches = [ CACHE_NONE => $emptyCache, @@ -446,8 +446,6 @@ abstract class Installer { $this->parserTitle = Title::newFromText( 'Installer' ); $this->parserOptions = new ParserOptions( $wgUser ); // language will be wrong :( - $this->parserOptions->setEditSection( false ); - $this->parserOptions->setWrapOutputClass( false ); // Don't try to access DB before user language is initialised $this->setParserLanguage( Language::factory( 'en' ) ); } @@ -600,9 +598,9 @@ abstract class Installer { // phpcs:ignore MediaWiki.VariableAnalysis.UnusedGlobalVariables global $wgExtensionDirectory, $wgStyleDirectory; - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $_lsExists = file_exists( "$IP/LocalSettings.php" ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( !$_lsExists ) { return false; @@ -689,6 +687,7 @@ abstract class Installer { $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart ); $html = $out->getText( [ 'enableSectionEditLinks' => false, + 'unwrap' => true, ] ); } catch ( MediaWiki\Services\ServiceDisabledException $e ) { $html = ' ' . htmlspecialchars( $text ); @@ -806,14 +805,14 @@ abstract class Installer { * @return bool */ protected function envCheckPCRE() { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' ); // Need to check for \p support too, as PCRE can be compiled // with utf8 support, but not unicode property support. // check that \p{Zs} (space separators) matches // U+3000 (Ideographic space) $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( $regexd != '--' || $regexprop != '--' ) { $this->showError( 'config-pcre-no-utf8' ); @@ -857,9 +856,6 @@ abstract class Installer { $caches = []; foreach ( $this->objectCaches as $name => $function ) { if ( function_exists( $function ) ) { - if ( $name == 'xcache' && !wfIniGetBool( 'xcache.var_size' ) ) { - continue; - } $caches[$name] = true; } } @@ -995,17 +991,17 @@ abstract class Installer { } # Get a list of available locales. - $ret = false; - $lines = wfShellExec( '/usr/bin/locale -a', $ret ); + $result = Shell::command( '/usr/bin/locale', '-a' ) + ->execute(); - if ( $ret ) { + if ( $result->getExitCode() != 0 ) { return true; } + $lines = $result->getStdout(); $lines = array_map( 'trim', explode( "\n", $lines ) ); $candidatesByLocale = []; $candidatesByLang = []; - foreach ( $lines as $line ) { if ( $line === '' ) { continue; @@ -1209,7 +1205,7 @@ abstract class Installer { // it would be good to check other popular languages here, but it'll be slow. - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); foreach ( $scriptTypes as $ext => $contents ) { foreach ( $contents as $source ) { @@ -1228,14 +1224,14 @@ abstract class Installer { unlink( $dir . $file ); if ( $text == 'exec' ) { - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); return $ext; } } } - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); return false; } @@ -1350,6 +1346,10 @@ abstract class Installer { $exts = $this->getVar( '_Extensions' ); $IP = $this->getVar( 'IP' ); + // Marker for DatabaseUpdater::loadExtensions so we don't + // double load extensions + define( 'MW_EXTENSIONS_LOADED', true ); + /** * We need to include DefaultSettings before including extensions to avoid * warnings about unset variables. However, the only thing we really @@ -1568,7 +1568,7 @@ abstract class Installer { $user->saveSettings(); // Update user count - $ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 ); + $ssUpdate = SiteStatsUpdate::factory( [ 'users' => 1 ] ); $ssUpdate->doUpdate(); } $status = Status::newGood(); @@ -1677,7 +1677,7 @@ abstract class Installer { // implementation that won't stomp on PHP's cookies. $GLOBALS['wgSessionProviders'] = [ [ - 'class' => 'InstallerSessionProvider', + 'class' => InstallerSessionProvider::class, 'args' => [ [ 'priority' => 1, ] ] @@ -1704,8 +1704,8 @@ abstract class Installer { * Some long-running pages (Install, Upgrade) will want to do this */ protected function disableTimeLimit() { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); set_time_limit( 0 ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); } }