3namespace MediaWiki\Registration;
6use InvalidArgumentException;
7use MediaWiki\MainConfigNames;
8use MediaWiki\ResourceLoader\FilePath;
10use UnexpectedValueException;
18class ExtensionProcessor
implements Processor {
25 protected static $globalSettings = [
26 MainConfigNames::ActionFilteredLogs,
27 MainConfigNames::Actions,
28 MainConfigNames::AddGroups,
29 MainConfigNames::APIFormatModules,
30 MainConfigNames::APIListModules,
31 MainConfigNames::APIMetaModules,
32 MainConfigNames::APIModules,
33 MainConfigNames::APIPropModules,
34 MainConfigNames::AuthManagerAutoConfig,
35 MainConfigNames::AvailableRights,
36 MainConfigNames::CentralIdLookupProviders,
37 MainConfigNames::ChangeCredentialsBlacklist,
38 MainConfigNames::ConditionalUserOptions,
39 MainConfigNames::ConfigRegistry,
40 MainConfigNames::ContentHandlers,
41 MainConfigNames::DefaultUserOptions,
42 MainConfigNames::ExtensionEntryPointListFiles,
43 MainConfigNames::ExtensionFunctions,
44 MainConfigNames::FeedClasses,
45 MainConfigNames::FileExtensions,
46 MainConfigNames::FilterLogTypes,
47 MainConfigNames::GrantPermissionGroups,
48 MainConfigNames::GrantPermissions,
49 MainConfigNames::GrantRiskGroups,
50 MainConfigNames::GroupPermissions,
51 MainConfigNames::GroupsAddToSelf,
52 MainConfigNames::GroupsRemoveFromSelf,
53 MainConfigNames::HiddenPrefs,
54 MainConfigNames::ImplicitGroups,
55 MainConfigNames::JobClasses,
56 MainConfigNames::LogActions,
57 MainConfigNames::LogActionsHandlers,
58 MainConfigNames::LogHeaders,
59 MainConfigNames::LogNames,
60 MainConfigNames::LogRestrictions,
61 MainConfigNames::LogTypes,
62 MainConfigNames::MediaHandlers,
63 MainConfigNames::OutputPipelineStages,
64 MainConfigNames::PasswordPolicy,
65 MainConfigNames::PrivilegedGroups,
66 MainConfigNames::RateLimits,
67 MainConfigNames::RawHtmlMessages,
68 MainConfigNames::ReauthenticateTime,
69 MainConfigNames::RecentChangesFlags,
70 MainConfigNames::RemoveCredentialsBlacklist,
71 MainConfigNames::RemoveGroups,
72 MainConfigNames::ResourceLoaderSources,
73 MainConfigNames::RevokePermissions,
74 MainConfigNames::SessionProviders,
75 MainConfigNames::SpecialPages,
76 MainConfigNames::UserRegistrationProviders,
82 protected const CORE_ATTRIBS = [
90 'LateJSConfigVarNames',
91 'TempUserSerialProviders',
92 'TempUserSerialMappings',
93 'DatabaseVirtualDomains',
94 'UserOptionsStoreProviders',
95 'NotificationHandlers',
96 'NotificationMiddleware',
97 'RecentChangeSources',
98 'ShadowPageProviders',
99 'CodeHighlightProviders',
100 'LogParamsAllowedClasses',
109 protected const MERGE_STRATEGIES = [
110 'wgAddGroups' =>
'array_merge_recursive',
111 'wgAuthManagerAutoConfig' =>
'array_plus_2d',
112 'wgCapitalLinkOverrides' =>
'array_plus',
113 'wgExtraGenderNamespaces' =>
'array_plus',
114 'wgGrantPermissions' =>
'array_plus_2d',
115 'wgGroupPermissions' =>
'array_plus_2d',
116 'wgHooks' =>
'array_merge_recursive',
117 'wgNamespaceContentModels' =>
'array_plus',
118 'wgNamespaceProtection' =>
'array_plus',
119 'wgNamespacesWithSubpages' =>
'array_plus',
120 'wgPasswordPolicy' =>
'array_merge_recursive',
121 'wgRateLimits' =>
'array_plus_2d',
122 'wgRemoveGroups' =>
'array_merge_recursive',
123 'wgRevokePermissions' =>
'array_plus_2d',
129 protected const CREDIT_ATTRIBS = [
145 protected const NOT_ATTRIBS = [
149 'load_composer_autoloader',
154 'AutoloadNamespaces',
155 'ExtensionMessagesFiles',
156 'TranslationAliasesDirs',
157 'ForeignResourcesDir',
159 'DomainEventIngresses',
160 'MessagePosterModule',
164 'ResourceFileModulePaths',
165 'ResourceModuleSkinStyles',
167 'ServiceWiringFiles',
177 protected $globals = [
178 'wgExtensionMessagesFiles' => [],
179 'wgRestAPIAdditionalRouteFiles' => [],
180 'wgMessagesDirs' => [],
181 'TranslationAliasesDirs' => [],
189 protected $defines = [];
198 protected $callbacks = [];
203 protected $credits = [];
212 protected $autoload = [
224 protected $autoloadDev = [
236 protected $attributes = [];
244 protected $extAttributes = [];
253 public function extractInfoFromFile(
string $path ) {
254 $json = file_get_contents(
$path );
255 $info = json_decode( $json,
true );
258 throw new RuntimeException(
"Failed to load JSON data from $path" );
261 $this->extractInfo(
$path, $info, $info[
'manifest_version'] );
269 public function extractInfo(
$path, array $info, $version ) {
270 $dir = dirname(
$path );
271 $this->extractHooks( $info,
$path );
272 $this->extractDomainEventIngresses( $info,
$path );
273 $this->extractExtensionMessagesFiles( $dir, $info );
274 $this->extractMessagesDirs( $dir, $info );
275 $this->extractTranslationAliasesDirs( $dir, $info );
276 $this->extractSkins( $dir, $info );
277 $this->extractSkinImportPaths( $dir, $info );
278 $this->extractNamespaces( $info );
279 $this->extractImplicitRights( $info );
280 $this->extractResourceLoaderModules( $dir, $info );
281 $this->extractInstallerTasks( $dir, $info );
282 if ( isset( $info[
'ServiceWiringFiles'] ) ) {
283 $this->extractPathBasedGlobal(
284 'wgServiceWiringFiles',
286 $info[
'ServiceWiringFiles']
289 $name = $this->extractCredits(
$path, $info );
290 if ( isset( $info[
'callback'] ) ) {
291 $this->callbacks[$name] = $info[
'callback'];
294 $this->extractAutoload( $info, $dir );
298 if ( $version >= 2 ) {
299 $this->extractConfig2( $info, $dir );
302 $this->extractConfig1( $info );
306 if ( isset( $info[
'ParsoidModules'] ) ) {
307 foreach ( $info[
'ParsoidModules'] as &$module ) {
308 if ( is_string( $module ) ) {
309 $className = $module;
311 'class' => $className,
314 $module[
'name'] ??= $name;
315 $module[
'extension-name'] = $name;
320 if ( isset( $info[
'RestModuleFiles'] ) ) {
321 foreach ( $info[
'RestModuleFiles'] as &$file ) {
322 $file =
"$dir/$file";
326 $this->extractForeignResourcesDir( $info, $name, $dir );
328 if ( $version >= 2 ) {
329 $this->extractAttributes(
$path, $info );
332 foreach ( $info as $key => $val ) {
334 if ( in_array( $key, self::$globalSettings ) ) {
335 $this->storeToArrayRecursive(
$path,
"wg$key", $val, $this->globals );
339 if ( $key[0] ===
'@' ) {
343 if ( $version >= 2 ) {
345 if ( in_array( $key, self::CORE_ATTRIBS ) ) {
346 $this->storeToArray(
$path, $key, $val, $this->attributes );
350 if ( !in_array( $key, self::NOT_ATTRIBS )
351 && !in_array( $key, self::CREDIT_ATTRIBS )
354 $this->storeToArrayRecursive(
$path, $key, $val, $this->attributes );
364 protected function extractAttributes(
$path, array $info ) {
365 if ( isset( $info[
'attributes'] ) ) {
366 foreach ( $info[
'attributes'] as $extName => $value ) {
367 $this->storeToArrayRecursive(
$path, $extName, $value, $this->extAttributes );
373 public function getExtractedInfo(
bool $includeDev =
false ) {
375 foreach ( $this->globals as $key => $val ) {
376 if ( isset( self::MERGE_STRATEGIES[$key] ) ) {
377 $this->globals[$key][ExtensionRegistry::MERGE_STRATEGY] = self::MERGE_STRATEGIES[$key];
382 foreach ( $this->extAttributes as $extName => $value ) {
384 if ( isset( $this->credits[$extName] ) ) {
385 foreach ( $value as $attrName => $attrValue ) {
386 $this->storeToArrayRecursive(
388 $extName . $attrName,
393 unset( $this->extAttributes[$extName] );
397 $autoload = $this->getExtractedAutoloadInfo( $includeDev );
400 'globals' => $this->globals,
401 'defines' => $this->defines,
402 'callbacks' => $this->callbacks,
403 'credits' => $this->credits,
404 'attributes' => $this->attributes,
405 'autoloaderPaths' => $autoload[
'files'],
406 'autoloaderClasses' => $autoload[
'classes'],
407 'autoloaderNS' => $autoload[
'namespaces'],
412 public function getRequirements( array $info, $includeDev ) {
414 if ( !$includeDev || !isset( $info[
'dev-requires'] ) ) {
415 return $info[
'requires'] ?? [];
418 if ( !isset( $info[
'requires'] ) ) {
419 return $info[
'dev-requires'] ?? [];
429 $pick =
static function ( $a, $b ) {
432 } elseif ( $b ===
null ) {
439 $req = $info[
'requires'];
440 $dev = $info[
'dev-requires'];
441 if ( isset( $req[
'MediaWiki'] ) || isset( $dev[
'MediaWiki'] ) ) {
442 $merged[
'MediaWiki'] = $pick(
443 $req[
'MediaWiki'] ??
null,
444 $dev[
'MediaWiki'] ??
null
448 $platform = array_merge(
449 array_keys( $req[
'platform'] ?? [] ),
450 array_keys( $dev[
'platform'] ?? [] )
453 foreach ( $platform as $pkey ) {
454 if ( $pkey ===
'php' ) {
456 $req[
'platform'][
'php'] ??
null,
457 $dev[
'platform'][
'php'] ??
null
462 $value = $dev[
'platform'][$pkey] ?? $req[
'platform'][$pkey];
464 $merged[
'platform'][$pkey] = $value;
468 foreach ( [
'extensions',
'skins' ] as $thing ) {
469 $things = array_merge(
470 array_keys( $req[$thing] ?? [] ),
471 array_keys( $dev[$thing] ?? [] )
473 foreach ( $things as $name ) {
474 $merged[$thing][$name] = $pick(
475 $req[$thing][$name] ??
null,
476 $dev[$thing][$name] ??
null
496 private function setArrayHookHandler(
498 array $hookHandlersAttr,
502 if ( isset( $callback[
'handler'] ) ) {
503 $handlerName = $callback[
'handler'];
504 $handlerDefinition = $hookHandlersAttr[$handlerName] ??
false;
505 if ( !$handlerDefinition ) {
506 throw new UnexpectedValueException(
507 "Missing handler definition for $name in HookHandlers attribute in $path"
510 $callback[
'handler'] = $handlerDefinition;
511 $callback[
'extensionPath'] =
$path;
512 $this->attributes[
'Hooks'][$name][] = $callback;
514 foreach ( $callback as $callable ) {
515 if ( is_array( $callable ) ) {
516 if ( isset( $callable[
'handler'] ) ) {
517 $this->setArrayHookHandler( $callable, $hookHandlersAttr, $name,
$path );
519 $this->globals[
'wgHooks'][$name][] = $callable;
521 } elseif ( is_string( $callable ) ) {
522 $this->setStringHookHandler( $callable, $hookHandlersAttr, $name,
$path );
538 private function setStringHookHandler(
540 array $hookHandlersAttr,
544 if ( isset( $hookHandlersAttr[$callback] ) ) {
546 'handler' => $hookHandlersAttr[$callback],
547 'extensionPath' =>
$path
549 $this->attributes[
'Hooks'][$name][] = $handler;
551 $this->globals[
'wgHooks'][$name][] = $callback;
563 protected function extractHooks( array $info,
string $path ) {
564 $extName = $info[
'name'];
565 if ( isset( $info[
'Hooks'] ) ) {
566 $hookHandlersAttr = [];
567 foreach ( $info[
'HookHandlers'] ?? [] as $name => $def ) {
568 $hookHandlersAttr[$name] = [
'name' =>
"$extName-$name" ] + $def;
570 foreach ( $info[
'Hooks'] as $name => $callback ) {
571 if ( is_string( $callback ) ) {
572 $this->setStringHookHandler( $callback, $hookHandlersAttr, $name,
$path );
573 } elseif ( is_array( $callback ) ) {
574 $this->setArrayHookHandler( $callback, $hookHandlersAttr, $name,
$path );
578 if ( isset( $info[
'DeprecatedHooks'] ) ) {
579 $deprecatedHooks = [];
580 foreach ( $info[
'DeprecatedHooks'] as $name => $deprecatedHookInfo ) {
581 $deprecatedHookInfo += [
'component' => $extName ];
582 $deprecatedHooks[$name] = $deprecatedHookInfo;
584 if ( isset( $this->attributes[
'DeprecatedHooks'] ) ) {
585 $this->attributes[
'DeprecatedHooks'] += $deprecatedHooks;
587 $this->attributes[
'DeprecatedHooks'] = $deprecatedHooks;
598 protected function extractDomainEventIngresses( array $info,
string $path ) {
599 $this->attributes[
'DomainEventIngresses'] ??= [];
600 foreach ( $info[
'DomainEventIngresses'] ?? [] as $subscriber ) {
601 $subscriber[
'extensionPath'] =
$path;
602 $this->attributes[
'DomainEventIngresses'][] = $subscriber;
609 protected function extractNamespaces( array $info ) {
610 if ( isset( $info[
'namespaces'] ) ) {
611 foreach ( $info[
'namespaces'] as $ns ) {
612 if ( defined( $ns[
'constant'] ) ) {
615 $id = constant( $ns[
'constant'] );
619 $this->defines[ $ns[
'constant'] ] = $id;
621 if ( !( isset( $ns[
'conditional'] ) && $ns[
'conditional'] ) ) {
623 $this->attributes[
'ExtensionNamespaces'][$id] = $ns[
'name'];
625 if ( isset( $ns[
'movable'] ) && !$ns[
'movable'] ) {
626 $this->attributes[
'ImmovableNamespaces'][] = $id;
628 if ( isset( $ns[
'gender'] ) ) {
629 $this->globals[
'wgExtraGenderNamespaces'][$id] = $ns[
'gender'];
631 if ( isset( $ns[
'subpages'] ) && $ns[
'subpages'] ) {
632 $this->globals[
'wgNamespacesWithSubpages'][$id] =
true;
634 if ( isset( $ns[
'content'] ) && $ns[
'content'] ) {
635 $this->globals[
'wgContentNamespaces'][] = $id;
637 if ( isset( $ns[
'defaultcontentmodel'] ) ) {
638 $this->globals[
'wgNamespaceContentModels'][$id] = $ns[
'defaultcontentmodel'];
640 if ( isset( $ns[
'protection'] ) ) {
641 $this->globals[
'wgNamespaceProtection'][$id] = $ns[
'protection'];
643 if ( isset( $ns[
'capitallinkoverride'] ) ) {
644 $this->globals[
'wgCapitalLinkOverrides'][$id] = $ns[
'capitallinkoverride'];
646 if ( isset( $ns[
'includable'] ) && !$ns[
'includable'] ) {
647 $this->globals[
'wgNonincludableNamespaces'][] = $id;
653 protected function extractResourceLoaderModules(
string $dir, array $info ) {
654 $defaultPaths = $info[
'ResourceFileModulePaths'] ??
false;
655 if ( isset( $defaultPaths[
'localBasePath'] ) ) {
656 if ( $defaultPaths[
'localBasePath'] ===
'' ) {
658 $defaultPaths[
'localBasePath'] = $dir;
660 $defaultPaths[
'localBasePath'] =
"$dir/{$defaultPaths['localBasePath']}";
664 foreach ( [
'ResourceModules',
'ResourceModuleSkinStyles',
'OOUIThemePaths' ] as $setting ) {
665 if ( isset( $info[$setting] ) ) {
666 foreach ( $info[$setting] as $name => $data ) {
667 if ( isset( $data[
'localBasePath'] ) ) {
668 if ( $data[
'localBasePath'] ===
'' ) {
670 $data[
'localBasePath'] = $dir;
672 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
675 if ( $defaultPaths ) {
676 $data += $defaultPaths;
678 $this->attributes[$setting][$name] = $data;
683 if ( isset( $info[
'QUnitTestModule'] ) ) {
684 $data = $info[
'QUnitTestModule'];
685 if ( isset( $data[
'localBasePath'] ) ) {
686 if ( $data[
'localBasePath'] ===
'' ) {
688 $data[
'localBasePath'] = $dir;
690 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
693 $this->attributes[
'QUnitTestModule'][
"test.{$info['name']}"] = $data;
696 if ( isset( $info[
'MessagePosterModule'] ) ) {
697 $data = $info[
'MessagePosterModule'];
698 $basePath = $data[
'localBasePath'] ??
'';
699 $baseDir =
$basePath ===
'' ? $dir :
"$dir/$basePath";
700 foreach ( $data[
'scripts'] ?? [] as $scripts ) {
701 $this->attributes[
'MessagePosterModule'][
'scripts'][] =
702 new FilePath( $scripts, $baseDir );
704 foreach ( $data[
'dependencies'] ?? [] as $dependency ) {
705 $this->attributes[
'MessagePosterModule'][
'dependencies'][] = $dependency;
710 protected function extractExtensionMessagesFiles(
string $dir, array $info ) {
711 if ( isset( $info[
'ExtensionMessagesFiles'] ) ) {
712 foreach ( $info[
'ExtensionMessagesFiles'] as &$file ) {
713 $file =
"$dir/$file";
715 $this->globals[
"wgExtensionMessagesFiles"] += $info[
'ExtensionMessagesFiles'];
726 protected function extractMessagesDirs( $dir, array $info ) {
727 if ( isset( $info[
'MessagesDirs'] ) ) {
728 foreach ( $info[
'MessagesDirs'] as $name => $files ) {
729 foreach ( (array)$files as $file ) {
730 $this->globals[
"wgMessagesDirs"][$name][] =
"$dir/$file";
743 protected function extractTranslationAliasesDirs( $dir, array $info ) {
744 foreach ( $info[
'TranslationAliasesDirs'] ?? [] as $name => $files ) {
745 foreach ( (array)$files as $file ) {
746 $this->globals[
'wgTranslationAliasesDirs'][$name][] =
"$dir/$file";
757 protected function extractSkins( $dir, array $info ) {
758 if ( isset( $info[
'ValidSkinNames'] ) ) {
759 foreach ( $info[
'ValidSkinNames'] as $skinKey => $data ) {
760 if ( isset( $data[
'args'][0] ) ) {
761 $templateDirectory = $data[
'args'][0][
'templateDirectory'] ??
'templates';
762 $data[
'args'][0][
'templateDirectory'] = $dir .
'/' . $templateDirectory;
764 $this->globals[
'wgValidSkinNames'][$skinKey] = $data;
772 protected function extractImplicitRights( array $info ) {
777 if ( isset( $info[
'RateLimits'] ) ) {
778 $rights = array_keys( $info[
'RateLimits'] );
780 if ( isset( $info[
'AvailableRights'] ) ) {
781 $rights = array_diff( $rights, $info[
'AvailableRights'] );
784 $this->globals[
'wgImplicitRights'] = array_merge(
785 $this->globals[
'wgImplicitRights'] ?? [],
795 protected function extractSkinImportPaths( $dir, array $info ) {
796 if ( isset( $info[
'SkinLessImportPaths'] ) ) {
797 foreach ( $info[
'SkinLessImportPaths'] as $skin => $subpath ) {
798 $this->attributes[
'SkinLessImportPaths'][$skin] =
"$dir/$subpath";
810 protected function extractCredits(
$path, array $info ) {
815 foreach ( self::CREDIT_ATTRIBS as $attr ) {
816 if ( isset( $info[$attr] ) ) {
817 $credits[$attr] = $info[$attr];
821 $name = $credits[
'name'];
825 if ( isset( $this->credits[$name] ) ) {
826 $firstPath = $this->credits[$name][
'path'];
827 $secondPath = $credits[
'path'];
828 throw new InvalidArgumentException(
829 "It was attempted to load $name twice, from $firstPath and $secondPath."
833 $this->credits[$name] = $credits;
838 protected function extractForeignResourcesDir( array $info,
string $name,
string $dir ): void {
839 if ( array_key_exists(
'ForeignResourcesDir', $info ) ) {
840 if ( !is_string( $info[
'ForeignResourcesDir'] ) ) {
841 throw new InvalidArgumentException(
"Incorrect ForeignResourcesDir type, must be a string (in $name)" );
843 $this->attributes[
'ForeignResourcesDir'][$name] =
"{$dir}/{$info['ForeignResourcesDir']}";
847 protected function extractInstallerTasks(
string $path, array $info ): void {
848 if ( isset( $info[
'InstallerTasks'] ) ) {
851 $schemaBasePath =
$path .
'/sql';
852 foreach ( $info[
'InstallerTasks'] as $taskSpec ) {
853 $this->attributes[
'InstallerTasks'][]
854 = $taskSpec + [
'schemaBasePath' => $schemaBasePath ];
866 protected function extractConfig1( array $info ) {
867 if ( isset( $info[
'config'] ) ) {
868 if ( isset( $info[
'config'][
'_prefix'] ) ) {
869 $prefix = $info[
'config'][
'_prefix'];
870 unset( $info[
'config'][
'_prefix'] );
874 foreach ( $info[
'config'] as $key => $val ) {
875 if ( $key[0] !==
'@' ) {
876 $this->addConfigGlobal(
"$prefix$key", $val, $info[
'name'] );
891 private function applyPath( array $value,
string $dir,
bool $ensurePathSuffix =
false ): array {
894 foreach ( $value as $k => $v ) {
895 if ( $ensurePathSuffix && !str_ends_with( $v,
'/' ) ) {
898 $result[$k] = $dir .
'/' . $v;
912 protected function extractConfig2( array $info, $dir ) {
913 $prefix = $info[
'config_prefix'] ??
'wg';
914 if ( isset( $info[
'config'] ) ) {
915 foreach ( $info[
'config'] as $key => $data ) {
916 if ( !array_key_exists(
'value', $data ) ) {
917 throw new UnexpectedValueException(
"Missing value for config $key" );
920 $value = $data[
'value'];
921 if ( isset( $data[
'path'] ) && $data[
'path'] ) {
922 if ( is_array( $value ) ) {
923 $value = $this->applyPath( $value, $dir );
925 $value =
"$dir/$value";
928 if ( isset( $data[
'merge_strategy'] ) ) {
929 $value[ExtensionRegistry::MERGE_STRATEGY] = $data[
'merge_strategy'];
931 $this->addConfigGlobal(
"$prefix$key", $value, $info[
'name'] );
943 private function addConfigGlobal( $key, $value, $extName ) {
944 if ( array_key_exists( $key, $this->globals ) ) {
945 throw new RuntimeException(
946 "The configuration setting '$key' was already set by MediaWiki core or"
947 .
" another extension, and cannot be set again by $extName." );
949 if ( isset( $value[ExtensionRegistry::MERGE_STRATEGY] ) &&
950 $value[ExtensionRegistry::MERGE_STRATEGY] ===
'array_merge_recursive' ) {
952 "Using the array_merge_recursive merge strategy in extension.json and skin.json" .
953 " was deprecated in MediaWiki 1.42",
957 $this->globals[$key] = $value;
960 protected function extractPathBasedGlobal(
string $global,
string $dir, array $paths ) {
961 foreach ( $paths as
$path ) {
962 $this->globals[$global][] =
"$dir/$path";
974 protected function storeToArrayRecursive(
$path, $name, $value, &$array ) {
975 if ( !is_array( $value ) ) {
976 throw new InvalidArgumentException(
"The value for '$name' should be an array (from $path)" );
978 if ( isset( $array[$name] ) ) {
979 $array[$name] = array_merge_recursive( $array[$name], $value );
981 $array[$name] = $value;
995 protected function storeToArray(
$path, $name, $value, &$array ) {
996 if ( !is_array( $value ) ) {
997 throw new InvalidArgumentException(
"The value for '$name' should be an array (from $path)" );
999 if ( isset( $array[$name] ) ) {
1000 $array[$name] = array_merge( $array[$name], $value );
1002 $array[$name] = $value;
1020 public function getExtractedAutoloadInfo(
bool $includeDev =
false ): array {
1021 $autoload = $this->autoload;
1023 if ( $includeDev ) {
1024 $autoload[
'classes'] += $this->autoloadDev[
'classes'];
1025 $autoload[
'namespaces'] += $this->autoloadDev[
'namespaces'];
1030 if ( !empty( $this->autoloadDev[
'files'] ) ) {
1033 $autoload[
'files'] = array_merge(
1035 $this->autoloadDev[
'files']
1043 private function extractAutoload( array $info,
string $dir ) {
1044 if ( isset( $info[
'load_composer_autoloader'] ) && $info[
'load_composer_autoloader'] ===
true ) {
1045 $file =
"$dir/vendor/autoload.php";
1046 if ( file_exists( $file ) ) {
1047 $this->autoload[
'files'][] = $file;
1051 if ( isset( $info[
'AutoloadClasses'] ) ) {
1052 $paths = $this->applyPath( $info[
'AutoloadClasses'], $dir );
1053 $this->autoload[
'classes'] += $paths;
1056 if ( isset( $info[
'AutoloadNamespaces'] ) ) {
1057 $paths = $this->applyPath( $info[
'AutoloadNamespaces'], $dir,
true );
1058 $this->autoload[
'namespaces'] += $paths;
1061 if ( isset( $info[
'TestAutoloadClasses'] ) ) {
1062 $paths = $this->applyPath( $info[
'TestAutoloadClasses'], $dir );
1063 $this->autoloadDev[
'classes'] += $paths;
1066 if ( isset( $info[
'TestAutoloadNamespaces'] ) ) {
1067 $paths = $this->applyPath( $info[
'TestAutoloadNamespaces'], $dir,
true );
1068 $this->autoloadDev[
'namespaces'] += $paths;
1074class_alias( ExtensionProcessor::class,
'ExtensionProcessor' );
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
if(!defined('MW_SETUP_CALLBACK'))