From 9b1eb8bb3f380af52085f80b396fa91794773580 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 7 Apr 2011 16:04:08 +0000 Subject: [PATCH] Moved rateLimited() and showLagWarning() near other similar functions --- includes/OutputPage.php | 74 ++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 3ceac65da0..67e31b4574 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2216,6 +2216,43 @@ class OutputPage { } } + /** + * Turn off regular page output and return an error reponse + * 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() ); + } + + /** + * Show a warning about slave lag + * + * If the lag is higher than $wgSlaveLagCritical seconds, + * then the warning is a bit more obvious. If the lag is + * lower than $wgSlaveLagWarning, then no warning is shown. + * + * @param $lag Integer: slave lag + */ + public function showLagWarning( $lag ) { + global $wgSlaveLagWarning, $wgSlaveLagCritical; + if( $lag >= $wgSlaveLagWarning ) { + $message = $lag < $wgSlaveLagCritical + ? 'lag-warn-normal' + : 'lag-warn-high'; + $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" ); + $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getContext()->getLang()->formatNum( $lag ) ) ); + } + } + /** * Adds JS-based password security checker * @param $passwordId String ID of input box containing password @@ -3170,43 +3207,6 @@ class OutputPage { return $media; } - /** - * Turn off regular page output and return an error reponse - * 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() ); - } - - /** - * Show a warning about slave lag - * - * If the lag is higher than $wgSlaveLagCritical seconds, - * then the warning is a bit more obvious. If the lag is - * lower than $wgSlaveLagWarning, then no warning is shown. - * - * @param $lag Integer: slave lag - */ - public function showLagWarning( $lag ) { - global $wgSlaveLagWarning, $wgSlaveLagCritical; - if( $lag >= $wgSlaveLagWarning ) { - $message = $lag < $wgSlaveLagCritical - ? 'lag-warn-normal' - : 'lag-warn-high'; - $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" ); - $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getContext()->getLang()->formatNum( $lag ) ) ); - } - } - /** * Add a wikitext-formatted message to the output. * This is equivalent to: -- 2.20.1