X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Finstaller%2FInstaller.php;h=091f93be3758eb6fbdc00f9797b7c6f20495772f;hp=de154561c45ec0456fa8598d24dca52e87a97181;hb=fadd3277f73c8922cea2443a7e6566f54726fbbc;hpb=4858f8afdabb2a1d7c60b7c14b6f4d398056c07e diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index de154561c4..091f93be37 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -412,14 +412,17 @@ abstract class Installer { // This will be overridden in the web installer with the user-specified language RequestContext::getMain()->setLanguage( 'en' ); - // Disable the i18n cache - // TODO: manage LocalisationCache singleton in MediaWikiServices - Language::getLocalisationCache()->disableBackend(); - // Disable all global services, since we don't have any configuration yet! MediaWikiServices::disableStorageBackend(); $mwServices = MediaWikiServices::getInstance(); + + // Disable i18n cache + $mwServices->getLocalisationCache()->disableBackend(); + + // Clear language cache so the old i18n cache doesn't sneak back in + Language::clearCaches(); + // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and // SqlBagOStuff will then throw since we just disabled wfGetDB) $wgObjectCaches = $mwServices->getMainConfig()->get( 'ObjectCaches' ); @@ -731,6 +734,7 @@ abstract class Installer { if ( !$status->isOK() ) { return $status; } + // @phan-suppress-next-line PhanUndeclaredMethod $status->value->insert( 'site_stats', [ @@ -1088,14 +1092,16 @@ abstract class Installer { /** * Checks if suhosin.get.max_value_length is set, and if so generate - * a warning because it decreases ResourceLoader performance. + * a warning because it is incompatible with ResourceLoader. * @return bool */ protected function envCheckSuhosinMaxValueLength() { - $maxValueLength = ini_get( 'suhosin.get.max_value_length' ); - if ( $maxValueLength > 0 && $maxValueLength < 1024 ) { - // Only warn if the value is below the sane 1024 - $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength ); + $currentValue = ini_get( 'suhosin.get.max_value_length' ); + $minRequired = 2000; + $recommended = 5000; + if ( $currentValue > 0 && $currentValue < $minRequired ) { + $this->showError( 'config-suhosin-max-value-length', $currentValue, $minRequired, $recommended ); + return false; } return true; @@ -1270,7 +1276,8 @@ abstract class Installer { * * @param string $directory Directory to search in, relative to $IP, must be either "extensions" * or "skins" - * @return array [ $extName => [ 'screenshots' => [ '...' ] ] + * @return Status An object containing an error list. If there were no errors, an associative + * array of information about the extension can be found in $status->value. */ public function findExtensions( $directory = 'extensions' ) { switch ( $directory ) { @@ -1289,33 +1296,43 @@ abstract class Installer { * * @param string $type Either "extension" or "skin" * @param string $directory Directory to search in, relative to $IP - * @return array [ $extName => [ 'screenshots' => [ '...' ] ] + * @return Status An object containing an error list. If there were no errors, an associative + * array of information about the extension can be found in $status->value. */ protected function findExtensionsByType( $type = 'extension', $directory = 'extensions' ) { if ( $this->getVar( 'IP' ) === null ) { - return []; + return Status::newGood( [] ); } $extDir = $this->getVar( 'IP' ) . '/' . $directory; if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) { - return []; + return Status::newGood( [] ); } $dh = opendir( $extDir ); $exts = []; + $status = new Status; while ( ( $file = readdir( $dh ) ) !== false ) { - if ( !is_dir( "$extDir/$file" ) ) { + // skip non-dirs and hidden directories + if ( !is_dir( "$extDir/$file" ) || $file[0] === '.' ) { continue; } - $status = $this->getExtensionInfo( $type, $directory, $file ); - if ( $status->isOK() ) { - $exts[$file] = $status->value; + $extStatus = $this->getExtensionInfo( $type, $directory, $file ); + if ( $extStatus->isOK() ) { + $exts[$file] = $extStatus->value; + } elseif ( $extStatus->hasMessage( 'config-extension-not-found' ) ) { + // (T225512) The directory is not actually an extension. Downgrade to warning. + $status->warning( 'config-extension-not-found', $file ); + } else { + $status->merge( $extStatus ); } } closedir( $dh ); uksort( $exts, 'strnatcasecmp' ); - return $exts; + $status->value = $exts; + + return $status; } /** @@ -1416,11 +1433,16 @@ abstract class Installer { } elseif ( $e->missingExtensions || $e->missingSkins ) { // There's an extension missing in the dependency tree, // so add those to the dependency list and try again - return $this->readExtension( + $status = $this->readExtension( $fullJsonFile, array_merge( $extDeps, $e->missingExtensions ), array_merge( $skinDeps, $e->missingSkins ) ); + if ( !$status->isOK() && !$status->hasMessage( 'config-extension-dependency' ) ) { + $status = Status::newFatal( 'config-extension-dependency', + basename( dirname( $fullJsonFile ) ), $status->getMessage() ); + } + return $status; } // Some other kind of dependency error? return Status::newFatal( 'config-extension-dependency', @@ -1607,11 +1629,11 @@ abstract class Installer { // If we've hit some sort of fatal, we need to bail. // Callback already had a chance to do output above. - if ( !$status->isOk() ) { + if ( !$status->isOK() ) { break; } } - if ( $status->isOk() ) { + if ( $status->isOK() ) { $this->showMessage( 'config-install-db-success' );