mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 17:51:00 +00:00
Show a deprecation warning if parameter onlyroot is used
The parameter onlyroot is deprecated since July 2008. Generate a tracking category for tracking the deprecation. Bug: T290062 Change-Id: I8eb58fa7831e11e6a6719f11fb1ff310666cdc4e
This commit is contained in:
parent
e5ac4d6907
commit
15a2d717d5
|
@ -185,6 +185,9 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"TrackingCategories": [
|
||||
"categorytree-deprecation-category"
|
||||
],
|
||||
"ServiceWiringFiles": [
|
||||
"includes/ServiceWiring.php"
|
||||
],
|
||||
|
|
|
@ -32,5 +32,9 @@
|
|||
"categorytree-no-pages": "no pages or subcategories",
|
||||
"categorytree-not-found": "Category <i>$1</i> not found",
|
||||
"categorytree-error": "Problem loading data.",
|
||||
"categorytree-retry": "Please wait a moment and try again."
|
||||
"categorytree-retry": "Please wait a moment and try again.",
|
||||
"categorytree-onlyroot-message": "Parameter <code>onlyroot</code> is deprecated. Use <code>depth=\"0\"</code> instead.",
|
||||
"categorytree-deprecation-warning": "'''Warning:''' This page uses <code><categorytree></code> with deprecated parameter.",
|
||||
"categorytree-deprecation-category": "Pages using deprecated categorytree parameters",
|
||||
"categorytree-deprecation-category-desc": "The page uses deprecated categorytree parameters like <code>onlyroot</code>."
|
||||
}
|
||||
|
|
|
@ -51,5 +51,9 @@
|
|||
"categorytree-no-pages": "Indicates that there are no pages or subcategories to be shown",
|
||||
"categorytree-not-found": "Indicates that the given category ($1) was not found. Parameters:\n* $1 - category name",
|
||||
"categorytree-error": "Indicates that an error has occurred while loading the node's content",
|
||||
"categorytree-retry": "Instruction to try again later."
|
||||
"categorytree-retry": "Instruction to try again later.",
|
||||
"categorytree-onlyroot-message": "Indicates that the deprecated parameter <code>onlyroot</code> is used.",
|
||||
"categorytree-deprecation-warning": "Warning message on preview if a deprecated parameter is used.",
|
||||
"categorytree-deprecation-category": "{{tracking category name}}\nThis message is used as a category name for a [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]] where pages are placed automatically if they use a deprecate categorytree parameter like <code>onlyroot</code>.",
|
||||
"categorytree-deprecation-category-desc": "Deprecated categorytree parameters category description. Shown on [[Special:TrackingCategories]].\n\nSee also:\n* {{msg-mw|categorytree-deprecation-category}}"
|
||||
}
|
||||
|
|
|
@ -223,9 +223,19 @@ class Hooks implements
|
|||
$depth = $ct->optionManager->capDepth( $depthArg );
|
||||
if ( $onlyroot ) {
|
||||
$depth = 0;
|
||||
$message = '<span class="error">'
|
||||
. wfMessage( 'categorytree-onlyroot-message' )->inContentLanguage()->parse()
|
||||
. '</span>';
|
||||
if ( $parser ) {
|
||||
$parser->getOutput()->addWarningMsg( 'categorytree-deprecation-warning' );
|
||||
$parser->addTrackingCategory( 'categorytree-deprecation-category' );
|
||||
}
|
||||
} else {
|
||||
$message = '';
|
||||
}
|
||||
|
||||
return $ct->getTag( $parser, $cat, $hideroot, $attr, $depth, $allowMissing );
|
||||
return $message .
|
||||
$ct->getTag( $parser, $cat, $hideroot, $attr, $depth, $allowMissing );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue