Clean up some braces, indentation; add profiling to LoadBalancer::reallyOpenConnection.
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 9 Jan 2008 21:40:40 +0000 (21:40 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 9 Jan 2008 21:40:40 +0000 (21:40 +0000)
includes/Article.php
includes/EditPage.php
includes/LoadBalancer.php

index 575f48f..473e01d 100644 (file)
@@ -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;
                }
index 4846196..5172300 100644 (file)
@@ -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 );
index b10c2a5..28f7a78 100644 (file)
@@ -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;
        }