r100645 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100644‎ | r100645 | r100646 >
Date:20:37, 24 October 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* Remove $abort parameter from MediaWiki::checkMaxLag(); unused and it's a private function.
* Restore wfGetLB()->getMaxLag() call since we are no more in index.php
Modified paths:
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Wiki.php
@@ -526,38 +526,28 @@
527527 /**
528528 * Checks if the request should abort due to a lagged server,
529529 * for given maxlag parameter.
530 - *
531 - * @param boolean $abort True if this class should abort the
532 - * script execution. False to return the result as a boolean.
533 - * @return boolean True if we passed the check, false if we surpass the maxlag
534530 */
535 - private function checkMaxLag( $abort ) {
 531+ private function checkMaxLag() {
536532 global $wgShowHostnames;
537533
538534 wfProfileIn( __METHOD__ );
539535 $maxLag = $this->context->getRequest()->getVal( 'maxlag' );
540536 if ( !is_null( $maxLag ) ) {
541 - $lb = wfGetLB(); // foo()->bar() is not supported in PHP4
542 - list( $host, $lag ) = $lb->getMaxLag();
 537+ list( $host, $lag ) = wfGetLB()->getMaxLag();
543538 if ( $lag > $maxLag ) {
544 - if ( $abort ) {
545 - $resp = $this->context->getRequest()->response();
546 - $resp->header( 'HTTP/1.1 503 Service Unavailable' );
547 - $resp->header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
548 - $resp->header( 'X-Database-Lag: ' . intval( $lag ) );
549 - $resp->header( 'Content-Type: text/plain' );
550 - if( $wgShowHostnames ) {
551 - echo "Waiting for $host: $lag seconds lagged\n";
552 - } else {
553 - echo "Waiting for a database server: $lag seconds lagged\n";
554 - }
 539+ $resp = $this->context->getRequest()->response();
 540+ $resp->header( 'HTTP/1.1 503 Service Unavailable' );
 541+ $resp->header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
 542+ $resp->header( 'X-Database-Lag: ' . intval( $lag ) );
 543+ $resp->header( 'Content-Type: text/plain' );
 544+ if( $wgShowHostnames ) {
 545+ echo "Waiting for $host: $lag seconds lagged\n";
 546+ } else {
 547+ echo "Waiting for a database server: $lag seconds lagged\n";
555548 }
556549
557550 wfProfileOut( __METHOD__ );
558551
559 - if ( !$abort ) {
560 - return false;
561 - }
562552 exit;
563553 }
564554 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r100653FU r100645: don't pass unused paramaaron22:19, 24 October 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   20:51, 24 October 2011

I still see "$this->checkMaxLag( true );"

Status & tagging log