Go to the documentation of this file.
23 use Composer\Semver\VersionParser;
24 use Composer\Semver\Constraint\Constraint;
52 $this->versionParser =
new VersionParser();
63 $this->loaded = $credits;
75 $this->coreVersion =
new Constraint(
80 }
catch ( UnexpectedValueException
$e ) {
107 foreach ( $extDependencies
as $extension => $dependencies ) {
108 foreach ( $dependencies
as $dependencyType => $values ) {
109 switch ( $dependencyType ) {
112 if ( $mwError !==
false ) {
113 $errors[] = $mwError;
118 foreach ( $values
as $dependency => $constraint ) {
120 if ( $extError !==
false ) {
121 $errors[] = $extError;
126 throw new UnexpectedValueException(
'Dependency type ' . $dependencyType .
127 ' unknown in ' . $extension );
145 if ( $this->coreVersion ===
false ) {
151 if ( $this->versionParser->parseConstraints( $constraint )
152 ->matches( $this->coreVersion ) ) {
156 return "{$checkedExt} is not compatible with the current "
157 .
"MediaWiki core (version {$this->coreVersion->getPrettyString()}), it requires: "
171 if ( !isset( $this->loaded[$dependencyName] ) ) {
172 return "{$checkedExt} requires {$dependencyName} to be installed.";
175 if ( !isset( $this->loaded[$dependencyName][
'version'] ) ) {
177 if ( $constraint ===
'*' ) {
178 wfDebug(
"{$dependencyName} does not expose it's version, but {$checkedExt}
179 mentions it with constraint '*'. Assume it's ok so." );
183 return "{$dependencyName} does not expose it's version, but {$checkedExt}
184 requires: {$constraint}.";
189 $installedVersion =
new Constraint(
191 $this->versionParser->normalize( $this->loaded[$dependencyName][
'version'] )
193 }
catch ( UnexpectedValueException
$e ) {
196 return "$dependencyName does not have a valid version string.";
200 !$this->versionParser->parseConstraints( $constraint )->matches( $installedVersion )
202 return "{$checkedExt} is not compatible with the current "
203 .
"installed version of {$dependencyName} "
204 .
"({$this->loaded[$dependencyName]['version']}), "
205 .
"it requires: " . $constraint .
'.';
handleMediaWikiDependency( $constraint, $checkedExt)
Handle a dependency to MediaWiki core.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
handleExtensionDependency( $dependencyName, $constraint, $checkedExt)
Handle a dependency to another extension.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
setCoreVersion( $coreVersion)
Set MediaWiki core version.
__construct( $coreVersion)
checkArray(array $extDependencies)
Check all given dependencies if they are compatible with the named installed extensions in the $credi...
array $loaded
Loaded extensions.
Constraint bool $coreVersion
representing $wgVersion
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
const MEDIAWIKI_CORE
"requires" key that applies to MediaWiki core/$wgVersion
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
VersionParser $versionParser
Provides functions to check a set of extensions with dependencies against a set of loaded extensions ...
setLoadedExtensionsAndSkins(array $credits)
Set an array with credits of all loaded extensions and skins.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
the array() calling protocol came about after MediaWiki 1.4rc1.