jenkins-bot has submitted this change and it was merged.
Change subject: Add missing rate limiter in SpecialPageTranslationMovePage
......................................................................
Add missing rate limiter in SpecialPageTranslationMovePage
Also
* Reuse checkReadOnly() method instead of own check
* Remove unnecessary return
* Avoid using empty() per MW coding conventions
Change-Id: Idea2ecc7419b32b89d8c749f022e366713ddd7e1
---
M tag/SpecialPageTranslationMovePage.php
1 file changed, 11 insertions(+), 15 deletions(-)
Approvals:
Nikerabbit: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tag/SpecialPageTranslationMovePage.php
b/tag/SpecialPageTranslationMovePage.php
index a488266..785f40b 100644
--- a/tag/SpecialPageTranslationMovePage.php
+++ b/tag/SpecialPageTranslationMovePage.php
@@ -94,9 +94,8 @@
// Checkboxes that default being checked are tricky
$this->moveSubpages = $request->getBool( 'subpages',
!$request->wasPosted() );
- if ( $this->doBasicChecks() !== true ) {
- return;
- }
+ // This will throw exceptions if there is an error.
+ $this->doBasicChecks();
// Real stuff starts here
$page = TranslatablePage::newFromTitle( $this->oldTitle );
@@ -148,14 +147,10 @@
/**
* Do the basic checks whether moving is possible and whether
* the input looks anywhere near sane.
- * @throws PermissionsError|ErrorPageError|ReadOnlyError
- * @return bool
+ * @throws PermissionsError|ErrorPageError|ReadOnlyError|ThrottledError
*/
protected function doBasicChecks() {
- # Check for database lock
- if ( wfReadOnly() ) {
- throw new ReadOnlyError;
- }
+ $this->checkReadOnly();
if ( $this->oldTitle === null ) {
throw new ErrorPageError( 'notargettitle',
'notargettext' );
@@ -165,14 +160,15 @@
throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
}
- # Check rights
- $permErrors = $this->oldTitle->getUserPermissionsErrors(
'move', $this->getUser() );
- if ( !empty( $permErrors ) ) {
- throw new PermissionsError( 'move', $permErrors );
+ if ( $this->getUser()->pingLimiter( 'move' ) ) {
+ throw new ThrottledError;
}
- // Let the caller know it's safe to continue
- return true;
+ // Check rights
+ $permErrors = $this->oldTitle->getUserPermissionsErrors(
'move', $this->getUser() );
+ if ( count( $permErrors ) ) {
+ throw new PermissionsError( 'move', $permErrors );
+ }
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/302937
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idea2ecc7419b32b89d8c749f022e366713ddd7e1
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits