(bug 43915) Implement deleteEqualMessages.php
[lhc/web/wiklou.git] / includes / WikiPage.php
index e2cd5d9..fbe0820 100644 (file)
@@ -1139,7 +1139,7 @@ class WikiPage extends Page implements IDBAccessObject {
        public function doPurge() {
                global $wgUseSquid;
 
-               if( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ){
+               if( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ) {
                        return false;
                }
 
@@ -1948,7 +1948,7 @@ class WikiPage extends Page implements IDBAccessObject {
        public function prepareTextForEdit( $text, $revid = null, User $user = null ) {
                ContentHandler::deprecated( __METHOD__, '1.21' );
                $content = ContentHandler::makeContent( $text, $this->getTitle() );
-               return $this->prepareContentForEdit( $content, $revid , $user );
+               return $this->prepareContentForEdit( $content, $revid, $user );
        }
 
        /**
@@ -2151,7 +2151,7 @@ class WikiPage extends Page implements IDBAccessObject {
                ContentHandler::deprecated( __METHOD__, "1.21" );
 
                $content = ContentHandler::makeContent( $text, $this->getTitle() );
-               return $this->doQuickEditContent( $content, $user, $comment , $minor );
+               return $this->doQuickEditContent( $content, $user, $comment, $minor );
        }
 
        /**
@@ -2274,9 +2274,14 @@ class WikiPage extends Page implements IDBAccessObject {
 
                $encodedExpiry = array();
                $protectDescription = '';
+               # Some bots may parse IRC lines, which are generated from log entries which contain plain
+               # protect description text. Keep them in old format to avoid breaking compatibility.
+               # TODO: Fix protection log to store structured description and format it on-the-fly.
+               $protectDescriptionLog = '';
                foreach ( $limit as $action => $restrictions ) {
                        $encodedExpiry[$action] = $dbw->encodeExpiry( $expiry[$action] );
                        if ( $restrictions != '' ) {
+                               $protectDescriptionLog .= $wgContLang->getDirMark() . "[$action=$restrictions] (";
                                # $action is one of $wgRestrictionTypes = array( 'create', 'edit', 'move', 'upload' ).
                                # All possible message keys are listed here for easier grepping:
                                # * restriction-create
@@ -2292,8 +2297,8 @@ class WikiPage extends Page implements IDBAccessObject {
                                if ( $encodedExpiry[$action] != 'infinity' ) {
                                        $expiryText = wfMessage(
                                                'protect-expiring',
-                                               $wgContLang->timeanddate( $expiry[$action], false, false ) ,
-                                               $wgContLang->date( $expiry[$action], false, false ) ,
+                                               $wgContLang->timeanddate( $expiry[$action], false, false ),
+                                               $wgContLang->date( $expiry[$action], false, false ),
                                                $wgContLang->time( $expiry[$action], false, false )
                                        )->inContentLanguage()->text();
                                } else {
@@ -2307,8 +2312,10 @@ class WikiPage extends Page implements IDBAccessObject {
                                $protectDescription .= wfMessage( 'protect-summary-desc' )
                                        ->params( $actionText, $restrictionsText, $expiryText )
                                        ->inContentLanguage()->text();
+                               $protectDescriptionLog .= $expiryText . ') ';
                        }
                }
+               $protectDescriptionLog = trim( $protectDescriptionLog );
 
                if ( $id ) { // Protection of existing page
                        if ( !wfRunHooks( 'ArticleProtect', array( &$this, &$user, $limit, $reason ) ) ) {
@@ -2350,7 +2357,7 @@ class WikiPage extends Page implements IDBAccessObject {
                                )->inContentLanguage()->text()
                        );
                        if ( $reason ) {
-                               $editComment .= ": $reason";
+                               $editComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
                        }
                        if ( $protectDescription ) {
                                $editComment .= wfMessage( 'word-separator' )->inContentLanguage()->text();
@@ -2413,7 +2420,7 @@ class WikiPage extends Page implements IDBAccessObject {
                if ( $logAction == 'unprotect' ) {
                        $logParams = array();
                } else {
-                       $logParams = array( $protectDescription, $cascade ? 'cascade' : '' );
+                       $logParams = array( $protectDescriptionLog, $cascade ? 'cascade' : '' );
                }
 
                // Update the protection log
@@ -3451,4 +3458,3 @@ class PoolWorkArticleView extends PoolCounterWork {
                return false;
        }
 }
-