feat(core): only add upload link when it is enabled

Citizen should not add upload link to drawer when $wgEnableUploads is
false.
This commit is contained in:
alistair3149 2023-01-03 19:26:33 -05:00
parent dc57449041
commit 8c4bd54d32
No known key found for this signature in database

View file

@ -103,18 +103,22 @@ final class Drawer extends Partial {
'id' => 't-specialpages'
] );
// Upload file
if ( ExtensionRegistry::getInstance()->isLoaded( 'Upload Wizard' ) ) {
// Link to Upload Wizard if present
$uploadHref = SpecialPage::getTitleFor( 'UploadWizard' )->getLocalURL();
} else {
// Link to old upload form
$uploadHref = Skin::makeSpecialUrl( 'Upload' );
// Only add upload file link when $wgEnableUploads is true
if ( $this->getConfigValue( 'EnableUploads' ) === true ) {
if ( ExtensionRegistry::getInstance()->isLoaded( 'Upload Wizard' ) ) {
// Link to Upload Wizard if present
$uploadHref = SpecialPage::getTitleFor( 'UploadWizard' )->getLocalURL();
} else {
// Link to old upload form
$uploadHref = Skin::makeSpecialUrl( 'Upload' );
}
$html .= $skin->makeListItem( 'upload', [
'href' => $uploadHref,
'id' => 't-upload'
] );
}
$html .= $skin->makeListItem( 'upload', [
'href' => $uploadHref,
'id' => 't-upload'
] );
return $html;
}