'TitleArrayFromResult' => 'includes/TitleArray.php',
'TitleDependency' => 'includes/CacheDependency.php',
'TitleListDependency' => 'includes/CacheDependency.php',
+ 'ThrottledError' => 'includes/Exception.php',
'UnlistedSpecialPage' => 'includes/SpecialPage.php',
'UppercaseCollation' => 'includes/Collation.php',
'User' => 'includes/User.php',
}
}
+/**
+ * Show an error when the user hits a rate limit
+ */
+class ThrottledError extends ErrorPageError {
+ public function __construct(){
+ parent::__construct(
+ 'actionthrottled',
+ 'actionthrottledtext'
+ );
+ }
+ public function report(){
+ global $wgOut;
+ $wgOut->setStatusCode( 503 );
+ return parent::report();
+ }
+}
+
/**
* Show an error when the user tries to do something whilst blocked
*/
* for when rate limiting has triggered.
*/
public function rateLimited() {
- $this->setPageTitle( wfMsg( 'actionthrottled' ) );
- $this->setRobotPolicy( 'noindex,follow' );
- $this->setArticleRelated( false );
- $this->enableClientCache( false );
- $this->mRedirect = '';
- $this->clearHTML();
- $this->setStatusCode( 503 );
- $this->addWikiMsg( 'actionthrottledtext' );
-
- $this->returnToMain( null, $this->getTitle() );
+ throw new ThrottledError;
}
/**