Index: trunk/phase3/includes/Article.php |
— | — | @@ -1957,24 +1957,22 @@ |
1958 | 1958 | * Auto-generates a deletion reason |
1959 | 1959 | * @param bool &$hasHistory Whether the page has a history |
1960 | 1960 | */ |
1961 | | - public function generateReason(&$hasHistory) |
1962 | | - { |
| 1961 | + public function generateReason( &$hasHistory ) { |
1963 | 1962 | global $wgContLang; |
1964 | | - $dbw = wfGetDB(DB_MASTER); |
| 1963 | + $dbw = wfGetDB( DB_MASTER ); |
1965 | 1964 | // Get the last revision |
1966 | | - $rev = Revision::newFromTitle($this->mTitle); |
1967 | | - if(is_null($rev)) |
| 1965 | + $rev = Revision::newFromTitle( $this->mTitle ); |
| 1966 | + if( is_null( $rev ) ) |
1968 | 1967 | return false; |
| 1968 | + |
1969 | 1969 | // Get the article's contents |
1970 | 1970 | $contents = $rev->getText(); |
1971 | 1971 | $blank = false; |
1972 | 1972 | // If the page is blank, use the text from the previous revision, |
1973 | 1973 | // which can only be blank if there's a move/import/protect dummy revision involved |
1974 | | - if($contents == '') |
1975 | | - { |
| 1974 | + if( $contents == '' ) { |
1976 | 1975 | $prev = $rev->getPrevious(); |
1977 | | - if($prev) |
1978 | | - { |
| 1976 | + if( $prev ) { |
1979 | 1977 | $contents = $prev->getText(); |
1980 | 1978 | $blank = true; |
1981 | 1979 | } |
— | — | @@ -1983,44 +1981,46 @@ |
1984 | 1982 | // Find out if there was only one contributor |
1985 | 1983 | // Only scan the last 20 revisions |
1986 | 1984 | $limit = 20; |
1987 | | - $res = $dbw->select('revision', 'rev_user_text', array('rev_page' => $this->getID()), __METHOD__, |
1988 | | - array('LIMIT' => $limit)); |
1989 | | - if($res === false) |
| 1985 | + $res = $dbw->select( 'revision', 'rev_user_text', |
| 1986 | + array( 'rev_page' => $this->getID() ), __METHOD__, |
| 1987 | + array( 'LIMIT' => $limit ) |
| 1988 | + ); |
| 1989 | + if( $res === false ) |
1990 | 1990 | // This page has no revisions, which is very weird |
1991 | 1991 | return false; |
1992 | | - if($res->numRows() > 1) |
| 1992 | + if( $res->numRows() > 1 ) |
1993 | 1993 | $hasHistory = true; |
1994 | 1994 | else |
1995 | 1995 | $hasHistory = false; |
1996 | | - $row = $dbw->fetchObject($res); |
| 1996 | + $row = $dbw->fetchObject( $res ); |
1997 | 1997 | $onlyAuthor = $row->rev_user_text; |
1998 | 1998 | // Try to find a second contributor |
1999 | 1999 | foreach( $res as $row ) { |
2000 | | - if($row->rev_user_text != $onlyAuthor) { |
| 2000 | + if( $row->rev_user_text != $onlyAuthor ) { |
2001 | 2001 | $onlyAuthor = false; |
2002 | 2002 | break; |
2003 | 2003 | } |
2004 | 2004 | } |
2005 | | - $dbw->freeResult($res); |
| 2005 | + $dbw->freeResult( $res ); |
2006 | 2006 | |
2007 | 2007 | // Generate the summary with a '$1' placeholder |
2008 | | - if($blank) { |
| 2008 | + if( $blank ) { |
2009 | 2009 | // The current revision is blank and the one before is also |
2010 | 2010 | // blank. It's just not our lucky day |
2011 | | - $reason = wfMsgForContent('exbeforeblank', '$1'); |
| 2011 | + $reason = wfMsgForContent( 'exbeforeblank', '$1' ); |
2012 | 2012 | } else { |
2013 | | - if($onlyAuthor) |
2014 | | - $reason = wfMsgForContent('excontentauthor', '$1', $onlyAuthor); |
| 2013 | + if( $onlyAuthor ) |
| 2014 | + $reason = wfMsgForContent( 'excontentauthor', '$1', $onlyAuthor ); |
2015 | 2015 | else |
2016 | | - $reason = wfMsgForContent('excontent', '$1'); |
| 2016 | + $reason = wfMsgForContent( 'excontent', '$1' ); |
2017 | 2017 | } |
2018 | 2018 | |
2019 | 2019 | // Replace newlines with spaces to prevent uglyness |
2020 | | - $contents = preg_replace("/[\n\r]/", ' ', $contents); |
| 2020 | + $contents = preg_replace( "/[\n\r]/", ' ', $contents ); |
2021 | 2021 | // Calculate the maximum amount of chars to get |
2022 | 2022 | // Max content length = max comment length - length of the comment (excl. $1) - '...' |
2023 | | - $maxLength = 255 - (strlen($reason) - 2) - 3; |
2024 | | - $contents = $wgContLang->truncate($contents, $maxLength, '...'); |
| 2023 | + $maxLength = 255 - (strlen( $reason ) - 2) - 3; |
| 2024 | + $contents = $wgContLang->truncate( $contents, $maxLength, '...' ); |
2025 | 2025 | // Remove possible unfinished links |
2026 | 2026 | $contents = preg_replace( '/\[\[([^\]]*)\]?$/', '$1', $contents ); |
2027 | 2027 | // Now replace the '$1' placeholder |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -841,7 +841,6 @@ |
842 | 842 | # If article is new, insert it. |
843 | 843 | $aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE ); |
844 | 844 | if ( 0 == $aid ) { |
845 | | - |
846 | 845 | // Late check for create permission, just in case *PARANOIA* |
847 | 846 | if ( !$this->mTitle->userCan( 'create' ) ) { |
848 | 847 | wfDebug( "$fname: no create permission\n" ); |
— | — | @@ -851,8 +850,8 @@ |
852 | 851 | |
853 | 852 | # Don't save a new article if it's blank. |
854 | 853 | if ( '' == $this->textbox1 ) { |
855 | | - wfProfileOut( $fname ); |
856 | | - return self::AS_BLANK_ARTICLE; |
| 854 | + wfProfileOut( $fname ); |
| 855 | + return self::AS_BLANK_ARTICLE; |
857 | 856 | } |
858 | 857 | |
859 | 858 | // Run post-section-merge edit filter |