From e0320af09e4a42ccf7715a66a8acd0dccc8af498 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 9 Jan 2008 21:40:40 +0000 Subject: [PATCH] Clean up some braces, indentation; add profiling to LoadBalancer::reallyOpenConnection. --- includes/Article.php | 14 ++++++-------- includes/EditPage.php | 2 +- includes/LoadBalancer.php | 3 +++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 575f48fb7e..473e01d4cc 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1884,21 +1884,20 @@ class Article { $row = $dbw->fetchObject($res); $onlyAuthor = $row->rev_user_text; // Try to find a second contributor - while(($row = $dbw->fetchObject($res))) - if($row->rev_user_text != $onlyAuthor) - { + while( $row = $dbw->fetchObject($res) ) { + if($row->rev_user_text != $onlyAuthor) { $onlyAuthor = false; break; } + } $dbw->freeResult($res); // Generate the summary with a '$1' placeholder - if($blank) + if($blank) { // The current revision is blank and the one before is also // blank. It's just not our lucky day $reason = wfMsgForContent('exbeforeblank', '$1'); - else - { + } else { if($onlyAuthor) $reason = wfMsgForContent('excontentauthor', '$1', $onlyAuthor); else @@ -1945,8 +1944,7 @@ class Article { # Check permissions $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgUser ); - if (count($permission_errors)>0) - { + if (count($permission_errors)>0) { $wgOut->showPermissionsErrorPage( $permission_errors ); return; } diff --git a/includes/EditPage.php b/includes/EditPage.php index 4846196d93..5172300725 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1088,7 +1088,7 @@ class EditPage { if( wfEmptyMsg( 'semiprotectedpagewarning', $notice ) || $notice == '-' ) $notice = ''; } else { - # Then it must be protected based on static groups (regular) + # Then it must be protected based on static groups (regular) $notice = wfMsg( 'protectedpagewarning' ); } $wgOut->addWikiText( $notice ); diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index b10c2a5ebe..28f7a782f5 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -418,7 +418,9 @@ class LoadBalancer { * @access private */ function reallyOpenConnection( &$server ) { + wfProfileIn( __METHOD__ ); if( !is_array( $server ) ) { + wfProfileOut( __METHOD__ ); throw new MWException( 'You must update your load-balancing configuration. See DefaultSettings.php entry for $wgDBservers.' ); } @@ -429,6 +431,7 @@ class LoadBalancer { # Create object $db = new $class( $host, $user, $password, $dbname, 1, $flags ); $db->setLBInfo( $server ); + wfProfileOut( __METHOD__ ); return $db; } -- 2.20.1