* A message with the suffix '-desc' should be added as a description message
* to have extra information on Special:TrackingCategories.
*
+ * @deprecated since 1.25 Extensions should now register tracking categories using
+ * the new extension registration system.
+ *
* @since 1.23
*/
-$wgTrackingCategories = array(
- 'index-category',
- 'noindex-category',
- 'duplicate-args-category',
- 'expensive-parserfunction-category',
- 'post-expand-template-argument-category',
- 'post-expand-template-inclusion-category',
- 'hidden-category-category',
- 'broken-file-category',
- 'node-count-exceeded-category',
- 'expansion-depth-exceeded-category',
-);
+$wgTrackingCategories = array();
/**
* Array of namespaces which can be deemed to contain valid "content", as far
* Add a tracking category, getting the title from a system message,
* or print a debug message if the title is invalid.
*
- * Please add any message that you use with this function to
- * $wgTrackingCategories. That way they will be listed on
- * Special:TrackingCategories.
+ * Any message used with this function should be registered so it will
+ * show up on Special:TrackingCategories. Core messages should be added
+ * to SpecialTrackingCategories::$coreTrackingCategories, and extensions
+ * should add to "TrackingCategories" in their extension.json.
*
* @param string $msg Message key
* @param Title $title title of the page which is being tracked
'ResourceLoaderSources',
'ResourceLoaderLESSVars',
'ResourceLoaderLESSImportPaths',
- 'TrackingCategories',
'DefaultUserOptions',
'HiddenPrefs',
'GroupPermissions',
parent::__construct( 'TrackingCategories' );
}
+ /**
+ * Tracking categories that exist in core
+ *
+ * @var array
+ */
+ private static $coreTrackingCategories = array(
+ 'index-category',
+ 'noindex-category',
+ 'duplicate-args-category',
+ 'expensive-parserfunction-category',
+ 'post-expand-template-argument-category',
+ 'post-expand-template-inclusion-category',
+ 'hidden-category-category',
+ 'broken-file-category',
+ 'node-count-exceeded-category',
+ 'expansion-depth-exceeded-category',
+ );
+
function execute( $par ) {
$this->setHeaders();
$this->outputHeader();
* @return array Array( 'msg' => Title, 'cats' => Title[] )
*/
private function prepareTrackingCategoriesData() {
+ $categories = array_merge(
+ self::$coreTrackingCategories,
+ ExtensionRegistry::getInstance()->getAttribute( 'TrackingCategories' ),
+ $this->getConfig()->get( 'TrackingCategories' ) // deprecated
+ );
$trackingCategories = array();
- foreach ( $this->getConfig()->get( 'TrackingCategories' ) as $catMsg ) {
+ foreach ( $categories as $catMsg ) {
/*
* Check if the tracking category varies by namespace
* Otherwise only pages in the current namespace will be displayed