<?php
use Composer\Semver\Semver;
+use Wikimedia\AtEase\AtEase;
use Wikimedia\ScopedCallback;
use MediaWiki\Shell\Shell;
use MediaWiki\ShellDisabledError;
$mtime = $wgExtensionInfoMTime;
if ( $mtime === false ) {
- if ( file_exists( $path ) ) {
- $mtime = filemtime( $path );
- } else {
- throw new Exception( "$path does not exist!" );
- }
+ AtEase::suppressWarnings();
+ $mtime = filemtime( $path );
+ AtEase::restoreWarnings();
// @codeCoverageIgnoreStart
if ( $mtime === false ) {
$err = error_get_last();
- throw new Exception( "Couldn't stat $path: {$err['message']}" );
+ throw new Exception( "Unable to open file $path: {$err['message']}" );
// @codeCoverageIgnoreEnd
}
}
* be loaded then).
*/
public function loadFromQueue() {
- global $wgVersion, $wgDevelopmentWarnings;
+ global $wgVersion, $wgDevelopmentWarnings, $wgObjectCaches;
if ( !$this->queued ) {
return;
}
// We use a try/catch because we don't want to fail here
// if $wgObjectCaches is not configured properly for APC setup
try {
- // Don't use MediaWikiServices here to prevent instantiating it before extensions have
- // been loaded
+ // Avoid MediaWikiServices to prevent instantiating it before extensions have loaded
$cacheId = ObjectCache::detectLocalServerCache();
- $cache = ObjectCache::newFromId( $cacheId );
+ $cache = ObjectCache::newFromParams( $wgObjectCaches[$cacheId] );
} catch ( InvalidArgumentException $e ) {
$cache = new EmptyBagOStuff();
}
$autoloadNamespaces
);
- if ( isset( $info['AutoloadClasses'] ) ) {
- $autoload = $this->processAutoLoader( $dir, $info['AutoloadClasses'] );
- $GLOBALS['wgAutoloadClasses'] += $autoload;
- $autoloadClasses += $autoload;
- }
- if ( isset( $info['AutoloadNamespaces'] ) ) {
- $autoloadNamespaces += $this->processAutoLoader( $dir, $info['AutoloadNamespaces'] );
- AutoLoader::$psr4Namespaces += $autoloadNamespaces;
- }
-
// get all requirements/dependencies for this extension
$requires = $processor->getRequirements( $info, $this->checkDev );