156 foreach ( $extDependencies as $extension => $dependencies ) {
157 foreach ( $dependencies as $dependencyType => $values ) {
158 switch ( $dependencyType ) {
159 case ExtensionRegistry::MEDIAWIKI_CORE:
165 if ( $mwError !==
false ) {
168 "{$extension} is not compatible with the current MediaWiki "
169 .
"core (version {$this->coreVersion->getPrettyString()}), "
170 .
"it requires: $values."
172 'type' =>
'incompatible-core',
177 foreach ( $values as $dependency => $constraint ) {
178 if ( $dependency ===
'php' ) {
185 if ( $phpError !==
false ) {
188 "{$extension} is not compatible with the current PHP "
189 .
"version {$this->phpVersion->getPrettyString()}), "
190 .
"it requires: $constraint."
192 'type' =>
'incompatible-php',
195 } elseif ( substr( $dependency, 0, 4 ) ===
'ext-' ) {
197 $phpExtension = substr( $dependency, 4 );
198 if ( $constraint !==
'*' ) {
199 throw new UnexpectedValueException(
'Version constraints for '
200 .
'PHP extensions are not supported in ' . $extension );
202 if ( !in_array( $phpExtension, $this->phpExtensions,
true ) ) {
205 "{$extension} requires {$phpExtension} PHP extension "
208 'type' =>
'missing-phpExtension',
209 'missing' => $phpExtension,
212 } elseif ( substr( $dependency, 0, 8 ) ===
'ability-' ) {
214 $ability = substr( $dependency, 8 );
215 if ( !isset( $this->abilities[$ability] ) ) {
216 throw new UnexpectedValueException(
'Dependency type '
217 . $dependency .
' unknown in ' . $extension );
219 if ( !is_bool( $constraint ) ) {
220 throw new UnexpectedValueException(
'Only booleans are '
221 .
'allowed to to indicate the presence of abilities '
222 .
'in ' . $extension );
226 $this->abilities[$ability] !==
true
230 if ( isset( $this->abilityErrors[$ability] ) ) {
231 $customMessage =
': ' . $this->abilityErrors[$ability];
236 "{$extension} requires \"{$ability}\" ability"
239 'type' =>
'missing-ability',
240 'missing' => $ability,
245 throw new UnexpectedValueException(
'Dependency type ' . $dependency .
246 ' unknown in ' . $extension );
252 foreach ( $values as $dependency => $constraint ) {
254 $dependency, $constraint, $extension, $dependencyType
256 if ( $extError !==
false ) {
257 $errors[] = $extError;
262 throw new UnexpectedValueException(
'Dependency type ' . $dependencyType .
263 ' unknown in ' . $extension );
308 if ( !isset( $this->loaded[$dependencyName] ) ) {
310 'msg' =>
"{$checkedExt} requires {$dependencyName} to be installed.",
311 'type' =>
"missing-$type",
312 'missing' => $dependencyName,
315 if ( $constraint ===
'*' ) {
320 if ( !isset( $this->loaded[$dependencyName][
'version'] ) ) {
321 $msg =
"{$dependencyName} does not expose its version, but {$checkedExt}"
322 .
" requires: {$constraint}.";
325 'type' =>
"incompatible-$type",
326 'incompatible' => $checkedExt,
331 $installedVersion =
new Constraint(
333 $this->versionParser->normalize( $this->loaded[$dependencyName][
'version'] )
335 }
catch ( UnexpectedValueException $e ) {
339 'msg' =>
"$dependencyName does not have a valid version string.",
340 'type' =>
'invalid-version',
345 !$this->versionParser->parseConstraints( $constraint )->matches( $installedVersion )
347 $msg =
"{$checkedExt} is not compatible with the current "
348 .
"installed version of {$dependencyName} "
349 .
"({$this->loaded[$dependencyName]['version']}), "
350 .
"it requires: " . $constraint .
'.';
353 'type' =>
"incompatible-$type",
354 'incompatible' => $checkedExt,