mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-30 11:06:55 +00:00
Use IContextSource::getConfig to access configs stored in globals
Change-Id: Id48a17ee63ea7d9629f103bd1cb6ca2f6489d484
This commit is contained in:
parent
2df36795c0
commit
63b9527d9c
|
@ -2,7 +2,6 @@
|
|||
<ruleset>
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage" />
|
||||
</rule>
|
||||
<file>.</file>
|
||||
<arg name="extensions" value="php" />
|
||||
|
|
|
@ -30,14 +30,12 @@ class CategoryTreeCategoryViewer extends CategoryViewer {
|
|||
* @return CategoryTree
|
||||
*/
|
||||
private function getCategoryTree() {
|
||||
global $wgCategoryTreeCategoryPageOptions;
|
||||
|
||||
if ( !isset( $this->categorytree ) ) {
|
||||
if ( !CategoryTreeHooks::shouldForceHeaders() ) {
|
||||
CategoryTree::setHeaders( $this->getOutput() );
|
||||
}
|
||||
|
||||
$this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
|
||||
$this->categorytree = new CategoryTree( $this->getConfig()->get( 'CategoryTreeCategoryPageOptions' ) );
|
||||
}
|
||||
|
||||
return $this->categorytree;
|
||||
|
|
|
@ -45,12 +45,10 @@ class CategoryTreePage extends SpecialPage {
|
|||
* @return mixed
|
||||
*/
|
||||
private function getOption( $name ) {
|
||||
global $wgCategoryTreeDefaultOptions;
|
||||
|
||||
if ( $this->tree ) {
|
||||
return $this->tree->getOption( $name );
|
||||
} else {
|
||||
return $wgCategoryTreeDefaultOptions[$name];
|
||||
return $this->getConfig()->get( 'CategoryTreeDefaultOptions' )[$name];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,8 +57,6 @@ class CategoryTreePage extends SpecialPage {
|
|||
* @param string|null $par Parameters passed to the page
|
||||
*/
|
||||
public function execute( $par ) {
|
||||
global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions;
|
||||
|
||||
$this->setHeaders();
|
||||
$this->addHelpLink( 'Extension:CategoryTree' );
|
||||
$request = $this->getRequest();
|
||||
|
@ -79,11 +75,14 @@ class CategoryTreePage extends SpecialPage {
|
|||
$this->target = trim( $this->target );
|
||||
|
||||
$options = [];
|
||||
$config = $this->getConfig();
|
||||
|
||||
# grab all known options from the request. Normalization is done by the CategoryTree class
|
||||
foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
|
||||
if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) ) {
|
||||
$default = $wgCategoryTreeSpecialPageOptions[$option];
|
||||
$categoryTreeDefaultOptions = $config->get( 'CategoryTreeDefaultOptions' );
|
||||
$categoryTreeSpecialPageOptions = $config->get( 'CategoryTreeSpecialPageOptions' );
|
||||
foreach ( $categoryTreeDefaultOptions as $option => $default ) {
|
||||
if ( isset( $categoryTreeSpecialPageOptions[$option] ) ) {
|
||||
$default = $categoryTreeSpecialPageOptions[$option];
|
||||
}
|
||||
|
||||
$options[$option] = $request->getVal( $option, $default );
|
||||
|
|
Loading…
Reference in a new issue