jenkins-bot has submitted this change and it was merged.

Change subject: Support rate-limiting thumbnail generation
......................................................................


Support rate-limiting thumbnail generation

* Added some rate limit comments

Change-Id: I987bb5d0ed8821d64131baefd4457acd25678818
---
M includes/DefaultSettings.php
M thumb.php
2 files changed, 16 insertions(+), 3 deletions(-)

Approvals:
  BryanDavis: Looks good to me, but someone else must approve
  Chad: Looks good to me, approved
  Brion VIBBER: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 5b1d4b3..48e6efc 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -4647,13 +4647,20 @@
                'ip' => null,
                'subnet' => null,
        ),
-       'mailpassword' => array(
+       'mailpassword' => array( // triggering password resets emails
                'anon' => null,
        ),
-       'emailuser' => array(
+       'emailuser' => array( // emailing other users using MediaWiki
                'user' => null,
        ),
-       'linkpurge' => array(
+       'linkpurge' => array( // purges of link tables
+               'anon' => null,
+               'user' => null,
+               'newbie' => null,
+               'ip' => null,
+               'subnet' => null,
+       ),
+       'renderfile' => array( // files rendered via thumb.php or 
thumb_handler.php
                'anon' => null,
                'user' => null,
                'newbie' => null,
diff --git a/thumb.php b/thumb.php
index ef2af24..f896180 100644
--- a/thumb.php
+++ b/thumb.php
@@ -304,6 +304,12 @@
                return;
        }
 
+       $user = RequestContext::getMain()->getUser();
+       if ( $user->pingLimiter( 'renderfile' ) ) {
+               wfThumbError( 500, wfMessage( 'actionthrottledtext' ) );
+               return;
+       }
+
        // Thumbnail isn't already there, so create the new thumbnail...
        try {
                $thumb = $img->transform( $params, File::RENDER_NOW );

-- 
To view, visit https://gerrit.wikimedia.org/r/86007
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I987bb5d0ed8821d64131baefd4457acd25678818
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to