Whitespace/braces
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 21 Sep 2008 02:53:16 +0000 (02:53 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 21 Sep 2008 02:53:16 +0000 (02:53 +0000)
includes/Article.php
includes/EditPage.php

index 78f467a..b4cec3c 100644 (file)
@@ -1957,24 +1957,22 @@ class Article {
         * Auto-generates a deletion reason
         * @param bool &$hasHistory Whether the page has a history
         */
-       public function generateReason(&$hasHistory)
-       {
+       public function generateReason( &$hasHistory ) {
                global $wgContLang;
-               $dbw = wfGetDB(DB_MASTER);
+               $dbw = wfGetDB( DB_MASTER );
                // Get the last revision
-               $rev = Revision::newFromTitle($this->mTitle);
-               if(is_null($rev))
+               $rev = Revision::newFromTitle( $this->mTitle );
+               if( is_null( $rev ) )
                        return false;
+
                // Get the article's contents
                $contents = $rev->getText();
                $blank = false;
                // If the page is blank, use the text from the previous revision,
                // which can only be blank if there's a move/import/protect dummy revision involved
-               if($contents == '')
-               {
+               if( $contents == '' ) {
                        $prev = $rev->getPrevious();
-                       if($prev)
-                       {
+                       if( $prev )     {
                                $contents = $prev->getText();
                                $blank = true;
                        }
@@ -1983,44 +1981,46 @@ class Article {
                // Find out if there was only one contributor
                // Only scan the last 20 revisions
                $limit = 20;
-               $res = $dbw->select('revision', 'rev_user_text', array('rev_page' => $this->getID()), __METHOD__,
-                               array('LIMIT' => $limit));
-               if($res === false)
+               $res = $dbw->select( 'revision', 'rev_user_text',
+                       array( 'rev_page' => $this->getID() ), __METHOD__,
+                       array( 'LIMIT' => $limit )
+               );
+               if( $res === false )
                        // This page has no revisions, which is very weird
                        return false;
-               if($res->numRows() > 1)
+               if( $res->numRows() > 1 )
                                $hasHistory = true;
                else
                                $hasHistory = false;
-               $row = $dbw->fetchObject($res);
+               $row = $dbw->fetchObject( $res );
                $onlyAuthor = $row->rev_user_text;
                // Try to find a second contributor
                foreach( $res as $row ) {
-                       if($row->rev_user_text != $onlyAuthor) {
+                       if( $row->rev_user_text != $onlyAuthor ) {
                                $onlyAuthor = false;
                                break;
                        }
                }
-               $dbw->freeResult($res);
+               $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');
+                       $reason = wfMsgForContent( 'exbeforeblank', '$1' );
                } else {
-                       if($onlyAuthor)
-                               $reason = wfMsgForContent('excontentauthor', '$1', $onlyAuthor);
+                       if( $onlyAuthor )
+                               $reason = wfMsgForContent( 'excontentauthor', '$1', $onlyAuthor );
                        else
-                               $reason = wfMsgForContent('excontent', '$1');
+                               $reason = wfMsgForContent( 'excontent', '$1' );
                }
 
                // Replace newlines with spaces to prevent uglyness
-               $contents = preg_replace("/[\n\r]/", ' ', $contents);
+               $contents = preg_replace( "/[\n\r]/", ' ', $contents );
                // Calculate the maximum amount of chars to get
                // Max content length = max comment length - length of the comment (excl. $1) - '...'
-               $maxLength = 255 - (strlen($reason) - 2) - 3;
-               $contents = $wgContLang->truncate($contents, $maxLength, '...');
+               $maxLength = 255 - (strlen( $reason ) - 2) - 3;
+               $contents = $wgContLang->truncate( $contents, $maxLength, '...' );
                // Remove possible unfinished links
                $contents = preg_replace( '/\[\[([^\]]*)\]?$/', '$1', $contents );
                // Now replace the '$1' placeholder
index 2c0ac5c..65c07e9 100644 (file)
@@ -841,7 +841,6 @@ class EditPage {
                # If article is new, insert it.
                $aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
                if ( 0 == $aid ) {
-
                        // Late check for create permission, just in case *PARANOIA*
                        if ( !$this->mTitle->userCan( 'create' ) ) {
                                wfDebug( "$fname: no create permission\n" );
@@ -851,8 +850,8 @@ class EditPage {
 
                        # Don't save a new article if it's blank.
                        if ( '' == $this->textbox1 ) {
-                                       wfProfileOut( $fname );
-                                       return self::AS_BLANK_ARTICLE;
+                               wfProfileOut( $fname );
+                               return self::AS_BLANK_ARTICLE;
                        }
 
                        // Run post-section-merge edit filter