diff options
author | Func <Funcer@outlook.com> | 2023-07-04 03:50:47 +0800 |
---|---|---|
committer | Urbanecm <martin.urbanec@wikimedia.cz> | 2023-07-04 09:36:44 +0000 |
commit | ced1027540e5110dee5e08442332685a95a34d0c (patch) | |
tree | a13b112ccee3549f47bc09bd05a5b388ae4550a6 | |
parent | 4e4f2c0728f79b1caa1faa8e70a1419050763d70 (diff) |
DeleteAction: Avoid displaying the form unconditionallywmf/1.41.0-wmf.15
Also, turned to override checkCanExecute() in FileDeleteAction instead,
to preserve the behaviour before the commit 3e43d318.
Bug: T341002
Change-Id: I8faa2ae97373d332d8c126d02d4969565489bf90
(cherry picked from commit 3cdf06b03e6866c8fa0ee76fd8ddd4ec20168dee)
-rw-r--r-- | includes/actions/DeleteAction.php | 4 | ||||
-rw-r--r-- | includes/actions/FileDeleteAction.php | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/includes/actions/DeleteAction.php b/includes/actions/DeleteAction.php index 3268fb6632d2..ff6ad9ead500 100644 --- a/includes/actions/DeleteAction.php +++ b/includes/actions/DeleteAction.php @@ -122,6 +122,10 @@ class DeleteAction extends FormAction { return $this->msg( 'delete-confirm', $title->getPrefixedText() ); } + public function getRestriction() { + return 'delete'; + } + protected function alterForm( HTMLForm $form ) { $title = $this->getTitle(); $form diff --git a/includes/actions/FileDeleteAction.php b/includes/actions/FileDeleteAction.php index a84a0791f1c2..c1ee231ec9bc 100644 --- a/includes/actions/FileDeleteAction.php +++ b/includes/actions/FileDeleteAction.php @@ -33,6 +33,7 @@ use MediaWiki\Permissions\PermissionStatus; use MediaWiki\Title\Title; use OldLocalFile; use PermissionsError; +use User; /** * Handle file deletion @@ -208,12 +209,12 @@ class FileDeleteAction extends DeleteAction { return $this->getTitle()->getLocalURL( $q ); } - public function getRestriction() { + protected function checkCanExecute( User $user ) { + parent::checkCanExecute( $user ); + if ( $this->getContext()->getConfig()->get( MainConfigNames::UploadMaintenance ) ) { throw new ErrorPageError( 'filedelete-maintenance-title', 'filedelete-maintenance' ); } - - return null; } /** |