Merge "Allow importing pages as subpage"
authorCatrope <roan.kattouw@gmail.com>
Wed, 15 Aug 2012 17:54:55 +0000 (17:54 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 15 Aug 2012 17:54:55 +0000 (17:54 +0000)
23 files changed:
includes/Article.php
includes/ChangesList.php
includes/FileDeleteForm.php
includes/ProtectionForm.php
includes/logging/LogEventsList.php
includes/logging/LogFormatter.php
includes/logging/LogPage.php
includes/revisiondelete/RevisionDeleter.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialUserlogin.php
includes/specials/SpecialUserrights.php
languages/messages/MessagesEn.php
languages/messages/MessagesKk_arab.php
languages/messages/MessagesKk_cyrl.php
languages/messages/MessagesKk_latn.php
languages/messages/MessagesSr_ec.php
languages/messages/MessagesSr_el.php
languages/messages/MessagesZh_hans.php
maintenance/language/messageTypes.inc
maintenance/language/messages.inc

index 7cd3019..237f0ce 100644 (file)
@@ -1321,12 +1321,15 @@ class Article extends Page {
                # Better double-check that it hasn't been deleted yet!
                $this->mPage->loadPageData( 'fromdbmaster' );
                if ( !$this->mPage->exists() ) {
+                       $deleteLogPage = new LogPage( 'delete' );
                        $outputPage = $this->getContext()->getOutput();
                        $outputPage->setPageTitle( wfMessage( 'cannotdelete-title', $title->getPrefixedText() ) );
                        $outputPage->wrapWikiMsg( "<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
                                        array( 'cannotdelete', wfEscapeWikiText( $title->getPrefixedText() ) )
                                );
-                       $outputPage->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
+                       $outputPage->addHTML(
+                               Xml::element( 'h2', null, $deleteLogPage->getName()->text() )
+                       );
                        LogEventsList::showLogExtract(
                                $outputPage,
                                'delete',
@@ -1496,7 +1499,9 @@ class Article extends Page {
                        }
 
                $outputPage->addHTML( $form );
-               $outputPage->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
+
+               $deleteLogPage = new LogPage( 'delete' );
+               $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $outputPage, 'delete',
                        $this->getTitle()
                );
@@ -1525,10 +1530,11 @@ class Article extends Page {
                        $outputPage->setPageTitle( wfMessage( 'cannotdelete-title', $this->getTitle()->getPrefixedText() ) );
                        if ( $error == '' ) {
                                $errors = $status->getErrorsArray();
+                               $deleteLogPage = new LogPage( 'delete' );
                                $outputPage->wrapWikiMsg( "<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
                                        $errors[0]
                                );
-                               $outputPage->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
+                               $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
 
                                LogEventsList::showLogExtract(
                                        $outputPage,
index 9daf3a9..51a3718 100644 (file)
@@ -1185,9 +1185,10 @@ class EnhancedChangesList extends ChangesList {
                $r .= '&#160;'.$rcObj->timestamp.'&#160;</td><td>';
                # Article or log link
                if( $logType ) {
-                       $logtitle = SpecialPage::getTitleFor( 'Log', $logType );
-                       $logname = LogPage::logName( $logType );
-                       $r .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logtitle, htmlspecialchars( $logname ) ) )->escaped();
+                       $logPage = new LogPage( $logType );
+                       $logTitle = SpecialPage::getTitleFor( 'Log', $logType );
+                       $logName = $logPage->getName()->escaped();
+                       $r .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
                } else {
                        $this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched );
                }
index ecdb5ba..1f0c195 100644 (file)
@@ -291,7 +291,8 @@ class FileDeleteForm {
         */
        private function showLogEntries() {
                global $wgOut;
-               $wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+               $deleteLogPage = new LogPage( 'delete' );
+               $wgOut->addHTML( '<h2>' . $deleteLogPage->getName()->escaped() . "</h2>\n" );
                LogEventsList::showLogExtract( $wgOut, 'delete', $this->title );
        }
 
index 31ed87f..caedb63 100644 (file)
@@ -74,17 +74,17 @@ class ProtectionForm {
                $this->disabledAttrib = $this->disabled
                        ? array( 'disabled' => 'disabled' )
                        : array();
-               
+
                $this->loadData();
        }
-       
+
        /**
         * Loads the current state of protection into the object.
         */
        function loadData() {
                global $wgRequest, $wgUser;
                global $wgRestrictionLevels;
-               
+
                $this->mCascade = $this->mTitle->areRestrictionsCascading();
 
                $this->mReason = $wgRequest->getText( 'mwProtect-reason' );
@@ -94,7 +94,7 @@ class ProtectionForm {
                foreach( $this->mApplicableTypes as $action ) {
                        // @todo FIXME: This form currently requires individual selections,
                        // but the db allows multiples separated by commas.
-                       
+
                        // Pull the actual restriction from the DB
                        $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
 
@@ -151,7 +151,7 @@ class ProtectionForm {
         * Get the expiry time for a given action, by combining the relevant inputs.
         *
         * @param $action string
-        * 
+        *
         * @return string 14-char timestamp or "infinity", or false if the input was invalid
         */
        function getExpiry( $action ) {
@@ -576,14 +576,14 @@ class ProtectionForm {
                        return wfMsg( 'protect-fallback', $permission );
                }
        }
-       
+
        function buildCleanupScript() {
                global $wgRestrictionLevels, $wgGroupPermissions, $wgOut;
 
                $cascadeableLevels = array();
                foreach( $wgRestrictionLevels as $key ) {
                        if ( ( isset( $wgGroupPermissions[$key]['protect'] ) && $wgGroupPermissions[$key]['protect'] )
-                               || $key == 'protect' 
+                               || $key == 'protect'
                        ) {
                                $cascadeableLevels[] = $key;
                        }
@@ -608,7 +608,8 @@ class ProtectionForm {
         */
        function showLogExtract( &$out ) {
                # Show relevant lines from the protection log:
-               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'protect' ) ) );
+               $protectLogPage = new LogPage( 'protect' );
+               $out->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $out, 'protect', $this->mTitle );
                # Let extensions add other relevant log extracts
                wfRunHooks( 'ProtectionForm::showLogExtract', array($this->mArticle,$out) );
index 61cba57..6016641 100644 (file)
@@ -30,11 +30,6 @@ class LogEventsList extends ContextSource {
 
        public $flags;
 
-       /**
-        * @var Array
-        */
-       protected $message;
-
        /**
         * @var Array
         */
@@ -59,7 +54,6 @@ class LogEventsList extends ContextSource {
                }
 
                $this->flags = $flags;
-               $this->preCacheMessages();
        }
 
        /**
@@ -72,22 +66,6 @@ class LogEventsList extends ContextSource {
                return $this->getTitle();
        }
 
-       /**
-        * As we use the same small set of messages in various methods and that
-        * they are called often, we call them once and save them in $this->message
-        */
-       private function preCacheMessages() {
-               // Precache various messages
-               if( !isset( $this->message ) ) {
-                       $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink',
-                               'revertmove', 'undeletelink', 'undeleteviewlink', 'revdel-restore', 'hist', 'diff',
-                               'pipe-separator', 'revdel-restore-deleted', 'revdel-restore-visible' );
-                       foreach( $messages as $msg ) {
-                               $this->message[$msg] = $this->msg( $msg )->escaped();
-                       }
-               }
-       }
-
        /**
         * Set page title and show header for this log type
         * @param $type Array
@@ -329,157 +307,35 @@ class LogEventsList extends ContextSource {
                $formatter->setContext( $this->getContext() );
                $formatter->setShowUserToolLinks( !( $this->flags & self::NO_EXTRA_USER_LINKS ) );
 
+               $title = $entry->getTarget();
+               $time = htmlspecialchars( $this->getLanguage()->userTimeAndDate(
+                       $entry->getTimestamp(), $this->getUser() ) );
+
                $action = $formatter->getActionText();
-               $comment = $formatter->getComment();
 
-               $classes = array( 'mw-logline-' . $entry->getType() );
-               $title = $entry->getTarget();
-               $time = $this->logTimestamp( $entry );
+               if ( $this->flags & self::NO_ACTION_LINK ) {
+                       $revert = '';
+               } else {
+                       $revert = $formatter->getActionLinks();
+                       if ( $revert != '' ) {
+                               $revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
+                       }
+               }
 
-               // Extract extra parameters
-               $paramArray = LogPage::extractParams( $row->log_params );
-               // Add review/revert links and such...
-               $revert = $this->logActionLinks( $row, $title, $paramArray, $comment );
+               $comment = $formatter->getComment();
 
                // Some user can hide log items and have review links
                $del = $this->getShowHideLinks( $row );
-               if( $del != '' ) $del .= ' ';
 
                // Any tags...
                list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' );
-               $classes = array_merge( $classes, $newClasses );
-
-               return Xml::tags( 'li', array( "class" => implode( ' ', $classes ) ),
-                       $del . "$time $action $comment $revert $tagDisplay" ) . "\n";
-       }
-
-       private function logTimestamp( LogEntry $entry ) {
-               return htmlspecialchars( $this->getLanguage()->userTimeAndDate(
-                       $entry->getTimestamp(), $this->getUser() ) );
-       }
+               $classes = array_merge(
+                       array( 'mw-logline-' . $entry->getType() ),
+                       $newClasses
+               );
 
-       /**
-        * @todo split up!
-        *
-        * @param  $row
-        * @param Title $title
-        * @param Array $paramArray
-        * @param String $comment Passed by reference
-        * @return String
-        */
-       private function logActionLinks( $row, $title, $paramArray, &$comment ) {
-               if( ( $this->flags & self::NO_ACTION_LINK ) // we don't want to see the action
-                       || self::isDeleted( $row, LogPage::DELETED_ACTION ) ) // action is hidden
-               {
-                       return '';
-               }
-               $revert = '';
-               if( self::typeAction( $row, 'move', 'move', 'move' ) && !empty( $paramArray[0] ) ) {
-                       $destTitle = Title::newFromText( $paramArray[0] );
-                       if( $destTitle ) {
-                               $revert = Linker::linkKnown(
-                                       SpecialPage::getTitleFor( 'Movepage' ),
-                                       $this->message['revertmove'],
-                                       array(),
-                                       array(
-                                               'wpOldTitle' => $destTitle->getPrefixedDBkey(),
-                                               'wpNewTitle' => $title->getPrefixedDBkey(),
-                                               'wpReason'   => $this->msg( 'revertmove' )->inContentLanguage()->text(),
-                                               'wpMovetalk' => 0
-                                       )
-                               );
-                               $revert = $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
-                       }
-               // Show undelete link
-               } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) {
-                       if( !$this->getUser()->isAllowed( 'undelete' ) ) {
-                               $viewdeleted = $this->message['undeleteviewlink'];
-                       } else {
-                               $viewdeleted = $this->message['undeletelink'];
-                       }
-                       $revert = Linker::linkKnown(
-                               SpecialPage::getTitleFor( 'Undelete' ),
-                               $viewdeleted,
-                               array(),
-                               array( 'target' => $title->getPrefixedDBkey() )
-                        );
-                       $revert = $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
-               // Show unblock/change block link
-               } elseif( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) {
-                       $revert = Linker::linkKnown(
-                                       SpecialPage::getTitleFor( 'Unblock', $row->log_title ),
-                                       $this->message['unblocklink']
-                               ) .
-                               $this->message['pipe-separator'] .
-                               Linker::linkKnown(
-                                       SpecialPage::getTitleFor( 'Block', $row->log_title ),
-                                       $this->message['change-blocklink']
-                               );
-                               $revert = $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
-               // Show change protection link
-               } elseif( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
-                       $revert .= Linker::link( $title,
-                                       $this->message['hist'],
-                                       array(),
-                                       array(
-                                               'action' => 'history',
-                                               'offset' => $row->log_timestamp
-                                       )
-                               );
-                       if( $this->getUser()->isAllowed( 'protect' ) ) {
-                               $revert .= $this->message['pipe-separator'] .
-                                       Linker::link( $title,
-                                               $this->message['protect_change'],
-                                               array(),
-                                               array( 'action' => 'protect' ),
-                                               'known' );
-                       }
-                       $revert = ' ' . $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
-               // Show unmerge link
-               } elseif( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) {
-                       $revert = Linker::linkKnown(
-                               SpecialPage::getTitleFor( 'MergeHistory' ),
-                               $this->message['revertmerge'],
-                               array(),
-                               array(
-                                       'target' => $paramArray[0],
-                                       'dest' => $title->getPrefixedDBkey(),
-                                       'mergepoint' => $paramArray[1]
-                               )
-                       );
-                       $revert = $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
-               // If an edit was hidden from a page give a review link to the history
-               } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
-                       $revert = RevisionDeleter::getLogLinks( $title, $paramArray,
-                                                               $this->message );
-               // Hidden log items, give review link
-               } elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) {
-                       if( count($paramArray) >= 1 ) {
-                               $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
-                               // $paramArray[1] is a CSV of the IDs
-                               $query = $paramArray[0];
-                               // Link to each hidden object ID, $paramArray[1] is the url param
-                               $revert = Linker::linkKnown(
-                                       $revdel,
-                                       $this->message['revdel-restore'],
-                                       array(),
-                                       array(
-                                               'target' => $title->getPrefixedText(),
-                                               'type' => 'logging',
-                                               'ids' => $query
-                                       )
-                               );
-                               $revert = $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
-                       }
-               // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
-               } else {
-                       wfRunHooks( 'LogLine', array( $row->log_type, $row->log_action, $title, $paramArray,
-                               &$comment, &$revert, $row->log_timestamp ) );
-               }
-               if( $revert != '' ) {
-                       $revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
-               }
-               return $revert;
+               return Html::rawElement( 'li', array( 'class' => $classes ),
+                       "$del $time $action $comment $revert $tagDisplay" ) . "\n";
        }
 
        /**
index 4f3292f..8d2219a 100644 (file)
@@ -109,24 +109,24 @@ class LogFormatter {
 
        /**
         * Set the visibility restrictions for displaying content.
-        * If set to public, and an item is deleted, then it will be replaced 
+        * If set to public, and an item is deleted, then it will be replaced
         * with a placeholder even if the context user is allowed to view it.
         * @param $audience integer self::FOR_THIS_USER or self::FOR_PUBLIC
         */
        public function setAudience( $audience ) {
                $this->audience = ( $audience == self::FOR_THIS_USER )
-                       ? self::FOR_THIS_USER 
+                       ? self::FOR_THIS_USER
                        : self::FOR_PUBLIC;
        }
 
        /**
         * Check if a log item can be displayed
         * @param $field integer LogPage::DELETED_* constant
-        * @return bool 
+        * @return bool
         */
        protected function canView( $field ) {
                if ( $this->audience == self::FOR_THIS_USER ) {
-                       return LogEventsList::userCanBitfield( 
+                       return LogEventsList::userCanBitfield(
                                $this->entry->getDeleted(), $field, $this->context->getUser() );
                } else {
                        return !$this->entry->isDeleted( $field );
@@ -279,7 +279,7 @@ class LogFormatter {
                                                break;
                                }
                                break;
-                       
+
 
                        // case 'suppress' --private log -- aaron  (sign your messages so we know who to blame in a few years :-D)
                        // default:
@@ -340,6 +340,15 @@ class LogFormatter {
                return "logentry-$type-$subtype";
        }
 
+       /**
+        * Returns extra links that comes after the action text, like "revert", etc.
+        *
+        * @return string
+        */
+       public function getActionLinks() {
+               return '';
+       }
+
        /**
         * Extracts the optional extra parameters for use in action messages.
         * The array indexes start from number 3.
@@ -537,6 +546,41 @@ class LogFormatter {
  * @since 1.19
  */
 class LegacyLogFormatter extends LogFormatter {
+
+       /**
+        * Backward compatibility for extension changing the comment from
+        * the LogLine hook. This will be set by the first call on getComment(),
+        * then it might be modified by the hook when calling getActionLinks(),
+        * so that the modified value will be returned when calling getComment()
+        * a second time.
+        *
+        * @var string|null
+        */
+       private $comment = null;
+
+       /**
+        * Cache for the result of getActionLinks() so that it does not need to
+        * run multiple times depending on the order that getComment() and
+        * getActionLinks() are called.
+        *
+        * @var string|null
+        */
+       private $revert = null;
+
+       public function getComment() {
+               if ( $this->comment === null ) {
+                       $this->comment = parent::getComment();
+               }
+
+               // Make sure we execute the LogLine hook so that we immediately return
+               // the correct value.
+               if ( $this->revert === null ) {
+                       $this->getActionLinks();
+               }
+
+               return $this->comment;
+       }
+
        protected function getActionMessage() {
                $entry = $this->entry;
                $action = LogPage::actionText(
@@ -556,6 +600,97 @@ class LegacyLogFormatter extends LogFormatter {
                return $action;
        }
 
+       public function getActionLinks() {
+               if ( $this->revert !== null ) {
+                       return $this->revert;
+               }
+
+               if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
+                       return $this->revert = '';
+               }
+
+               $title = $this->entry->getTarget();
+               $type = $this->entry->getType();
+               $subtype = $this->entry->getSubtype();
+
+               // Show unblock/change block link
+               if ( ( $type == 'block' || $type == 'suppress' ) && ( $subtype == 'block' || $subtype == 'reblock' ) ) {
+                       if ( !$this->context->getUser()->isAllowed( 'block' ) ) {
+                               return '';
+                       }
+
+                       $links = array(
+                               Linker::linkKnown(
+                                       SpecialPage::getTitleFor( 'Unblock', $title->getDBkey() ),
+                                       $this->msg( 'unblocklink' )->escaped()
+                               ),
+                               Linker::linkKnown(
+                                       SpecialPage::getTitleFor( 'Block', $title->getDBkey() ),
+                                       $this->msg( 'change-blocklink' )->escaped()
+                               )
+                       );
+                       return $this->msg( 'parentheses' )->rawParams(
+                               $this->context->getLanguage()->pipeList( $links ) )->escaped();
+               // Show change protection link
+               } elseif ( $type == 'protect' && ( $subtype == 'protect' || $subtype == 'modify' || $subtype == 'unprotect' ) ) {
+                       $links = array(
+                               Linker::link( $title,
+                                       $this->msg( 'hist' )->escaped(),
+                                       array(),
+                                       array(
+                                               'action' => 'history',
+                                               'offset' => $this->entry->getTimestamp()
+                                       )
+                               )
+                       );
+                       if ( $this->context->getUser()->isAllowed( 'protect' ) ) {
+                               $links[] = Linker::linkKnown(
+                                       $title,
+                                       $this->msg( 'protect_change' )->escaped(),
+                                       array(),
+                                       array( 'action' => 'protect' )
+                               );
+                       }
+                       return $this->msg( 'parentheses' )->rawParams(
+                               $this->context->getLanguage()->pipeList( $links ) )->escaped();
+               // Show unmerge link
+               } elseif( $type == 'merge' && $subtype == 'merge' ) {
+                       if ( !$this->context->getUser()->isAllowed( 'mergehistory' ) ) {
+                               return '';
+                       }
+
+                       $params = $this->extractParameters();
+                       $revert = Linker::linkKnown(
+                               SpecialPage::getTitleFor( 'MergeHistory' ),
+                               $this->msg( 'revertmerge' )->escaped(),
+                               array(),
+                               array(
+                                       'target' => $params[3],
+                                       'dest' => $title->getPrefixedDBkey(),
+                                       'mergepoint' => $params[4]
+                               )
+                       );
+                       return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
+               }
+
+               // Do nothing. The implementation is handled by the hook modifiying the
+               // passed-by-ref parameters. This also changes the default value so that
+               // getComment() and getActionLinks() do not call them indefinitely.
+               $this->revert = '';
+
+               // This is to populate the $comment member of this instance so that it
+               // can be modified when calling the hook just below.
+               if ( $this->comment === null ) {
+                       $this->getComment();
+               }
+
+               $params = $this->entry->getParameters();
+
+               wfRunHooks( 'LogLine', array( $type, $subtype, $title, $params,
+                       &$this->comment, &$this->revert, $this->entry->getTimestamp() ) );
+
+               return $this->revert;
+       }
 }
 
 /**
@@ -585,6 +720,34 @@ class MoveLogFormatter extends LogFormatter {
                $params[3] = Message::rawParam( $newname );
                return $params;
        }
+
+       public function getActionLinks() {
+               if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
+                       || $this->entry->getSubtype() !== 'move'
+                       || !$this->context->getUser()->isAllowed( 'move' ) )
+               {
+                       return '';
+               }
+
+               $params = $this->extractParameters();
+               $destTitle = Title::newFromText( $params[3] );
+               if ( !$destTitle ) {
+                       return '';
+               }
+
+               $revert = Linker::linkKnown(
+                       SpecialPage::getTitleFor( 'Movepage' ),
+                       $this->msg( 'revertmove' )->escaped(),
+                       array(),
+                       array(
+                               'wpOldTitle' => $destTitle->getPrefixedDBkey(),
+                               'wpNewTitle' => $this->entry->getTarget()->getPrefixedDBkey(),
+                               'wpReason'   => $this->msg( 'revertmove' )->inContentLanguage()->text(),
+                               'wpMovetalk' => 0
+                       )
+               );
+               return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
+       }
 }
 
 /**
@@ -654,6 +817,107 @@ class DeleteLogFormatter extends LogFormatter {
                        return (int) $string;
                }
        }
+
+       public function getActionLinks() {
+               $user = $this->context->getUser();
+               if ( !$user->isAllowed( 'deletedhistory' ) || $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
+                       return '';
+               }
+
+               switch ( $this->entry->getSubtype() ) {
+               case 'delete': // Show undelete link
+                       if( $user->isAllowed( 'undelete' ) ) {
+                               $message = 'undeletelink';
+                       } else {
+                               $message = 'undeleteviewlink';
+                       }
+                       $revert = Linker::linkKnown(
+                               SpecialPage::getTitleFor( 'Undelete' ),
+                               $this->msg( $message )->escaped(),
+                               array(),
+                               array( 'target' => $this->entry->getTarget()->getPrefixedDBkey() )
+                        );
+                       return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
+
+               case 'revision': // If an edit was hidden from a page give a review link to the history
+                       $params = $this->extractParameters();
+                       if ( !isset( $params[3] ) || !isset( $params[4] ) ) {
+                               return '';
+                       }
+
+                       // Different revision types use different URL params...
+                       $key = $params[3];
+                       // This is a CSV of the IDs
+                       $ids = explode( ',', $params[4] );
+
+                       $links = array();
+
+                       // If there's only one item, we can show a diff link
+                       if ( count( $ids ) == 1 ) {
+                               // Live revision diffs...
+                               if ( $key == 'oldid' || $key == 'revision' ) {
+                                       $links[] = Linker::linkKnown(
+                                               $this->entry->getTarget(),
+                                               $this->msg( 'diff' )->escaped(),
+                                               array(),
+                                               array(
+                                                       'diff' => intval( $ids[0] ),
+                                                       'unhide' => 1
+                                               )
+                                       );
+                               // Deleted revision diffs...
+                               } elseif ( $key == 'artimestamp' || $key == 'archive' ) {
+                                       $links[] = Linker::linkKnown(
+                                               SpecialPage::getTitleFor( 'Undelete' ),
+                                               $this->msg( 'diff' )->escaped(),
+                                               array(),
+                                               array(
+                                                       'target'    => $this->entry->getTarget()->getPrefixedDBKey(),
+                                                       'diff'      => 'prev',
+                                                       'timestamp' => $ids[0]
+                                               )
+                                       );
+                               }
+                       }
+
+                       // View/modify link...
+                       $links[] = Linker::linkKnown(
+                               SpecialPage::getTitleFor( 'Revisiondelete' ),
+                               $this->msg( 'revdel-restore' )->escaped(),
+                               array(),
+                               array(
+                                       'target' => $this->entry->getTarget()->getPrefixedText(),
+                                       'type' => $key,
+                                       'ids' => implode( ',', $ids ),
+                               )
+                       );
+
+                       return $this->msg( 'parentheses' )->rawParams(
+                               $this->context->getLanguage()->pipeList( $links ) )->escaped();
+
+               case 'event': // Hidden log items, give review link
+                       $params = $this->extractParameters();
+                       if ( !isset( $params[3] ) ) {
+                               return '';
+                       }
+                       // This is a CSV of the IDs
+                       $query = $params[3];
+                       // Link to each hidden object ID, $params[1] is the url param
+                       $revert = Linker::linkKnown(
+                               SpecialPage::getTitleFor( 'Revisiondelete' ),
+                               $this->msg( 'revdel-restore' )->escaped(),
+                               array(),
+                               array(
+                                       'target' => $this->entry->getTarget()->getPrefixedText(),
+                                       'type' => 'logging',
+                                       'ids' => $query
+                               )
+                       );
+                       return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
+               default:
+                       return '';
+               }
+       }
 }
 
 /**
index cf921b0..2521ae8 100644 (file)
@@ -419,9 +419,12 @@ class LogPage {
 
                                        # Use the language name for log titles, rather than Log/X
                                        if( $name == 'Log' ) {
-                                               $titleLink = Linker::link( $title, LogPage::logName( $par ) );
-                                               $titleLink = wfMessage( 'parentheses' )->inLanguage( $lang )
-                                                       ->rawParams( $titleLink )->escaped();
+                                               $logPage = new LogPage( $par );
+                                               $titleLink = Linker::link( $title, $logPage->getName()->escaped() );
+                                               $titleLink = wfMessage( 'parentheses' )
+                                                       ->inLanguage( $lang )
+                                                       ->rawParams( $titleLink )
+                                                       ->escaped();
                                        } else {
                                                $titleLink = Linker::link( $title );
                                        }
index 95d372c..c59edc2 100644 (file)
@@ -124,69 +124,4 @@ class RevisionDeleter {
 
                return $timestamp;
        }
-
-       /**
-        * Creates utility links for log entries.
-        *
-        * @param $title Title
-        * @param $paramArray Array
-        * @param $messages
-        * @return String
-        */
-       public static function getLogLinks( $title, $paramArray, $messages ) {
-               global $wgLang;
-
-               if ( count( $paramArray ) >= 2 ) {
-                       // Different revision types use different URL params...
-                       $key = $paramArray[0];
-                       // $paramArray[1] is a CSV of the IDs
-                       $Ids = explode( ',', $paramArray[1] );
-
-                       $revert = array();
-
-                       // Diff link for single rev deletions
-                       if ( count( $Ids ) == 1 ) {
-                               // Live revision diffs...
-                               if ( in_array( $key, array( 'oldid', 'revision' ) ) ) {
-                                       $revert[] = Linker::linkKnown(
-                                               $title,
-                                               $messages['diff'],
-                                               array(),
-                                               array(
-                                                       'diff' => intval( $Ids[0] ),
-                                                       'unhide' => 1
-                                               )
-                                       );
-                               // Deleted revision diffs...
-                               } elseif ( in_array( $key, array( 'artimestamp','archive' ) ) ) {
-                                       $revert[] = Linker::linkKnown(
-                                               SpecialPage::getTitleFor( 'Undelete' ),
-                                               $messages['diff'],
-                                               array(),
-                                               array(
-                                                       'target'    => $title->getPrefixedDBKey(),
-                                                       'diff'      => 'prev',
-                                                       'timestamp' => $Ids[0]
-                                               )
-                                       );
-                               }
-                       }
-
-                       // View/modify link...
-                       $revert[] = Linker::linkKnown(
-                               SpecialPage::getTitleFor( 'Revisiondelete' ),
-                               $messages['revdel-restore'],
-                               array(),
-                               array(
-                                       'target' => $title->getPrefixedText(),
-                                       'type' => $key,
-                                       'ids' => implode(',', $Ids),
-                               )
-                       );
-
-                       // Pipe links
-                       return wfMsg( 'parentheses', $wgLang->pipeList( $revert ) );
-               }
-               return '';
-       }
 }
index b5fb0dd..1f05749 100644 (file)
@@ -226,8 +226,9 @@ class SpecialMergeHistory extends SpecialPage {
                        $out->addWikiMsg( 'mergehistory-empty' );
                }
 
-               # Show relevant lines from the deletion log:
-               $out->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" );
+               # Show relevant lines from the merge log:
+               $mergeLogPage = new LogPage( 'merge' );
+               $out->addHTML( '<h2>' . $mergeLogPage->getName()->escaped() . "</h2>\n" );
                LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj );
 
                # When we submit, go by page ID to avoid some nasty but unlikely collisions.
index 68b180a..3ece917 100644 (file)
@@ -629,8 +629,9 @@ class MovePageForm extends UnlistedSpecialPage {
        }
 
        function showLogFragment( $title ) {
+               $moveLogPage = new LogPage( 'move' );
                $out = $this->getOutput();
-               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
+               $out->addHTML( Xml::element( 'h2', null, $moveLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $out, 'move', $title );
        }
 
index be432ac..4e1bbc2 100644 (file)
@@ -206,12 +206,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
 
                $qc = $this->getLogQueryCond();
                # Show relevant lines from the deletion log
-               $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+               $deleteLogPage = new LogPage( 'delete' );
+               $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
                LogEventsList::showLogExtract( $output, 'delete',
                        $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
                # Show relevant lines from the suppression log
                if( $user->isAllowed( 'suppressionlog' ) ) {
-                       $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
+                       $suppressLogPage = new LogPage( 'suppress' );
+                       $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped()  . "</h2>\n" );
                        LogEventsList::showLogExtract( $output, 'suppress',
                                $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
                }
index 611b3b9..c6b496b 100644 (file)
@@ -1083,11 +1083,13 @@ class SpecialUndelete extends SpecialPage {
                }
 
                # Show relevant lines from the deletion log:
-               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) . "\n" );
+               $deleteLogPage = new LogPage( 'delete' );
+               $out->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) . "\n" );
                LogEventsList::showLogExtract( $out, 'delete', $this->mTargetObj );
                # Show relevant lines from the suppression log:
+               $suppressLogPage = new LogPage( 'suppress' );
                if( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
-                       $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'suppress' ) ) . "\n" );
+                       $out->addHTML( Xml::element( 'h2', null, $suppressLogPage->getName()->text() ) . "\n" );
                        LogEventsList::showLogExtract( $out, 'suppress', $this->mTargetObj );
                }
 
index 0c72b76..f0b15db 100644 (file)
@@ -1273,8 +1273,9 @@ class LoginForm extends SpecialPage {
                if( $this->mType == 'signup' ) {
                        $attr['type'] = 'signup';
                }
-               if( $this->mReturnTo ) {
+               if( $this->mReturnTo !== '' ) {
                        $attr['returnto'] = $this->mReturnTo;
+                       $attr['returntoquery'] = $this->mReturnToQuery;
                }
                return Linker::linkKnown(
                        $this->getTitle(),
index 8c244c4..59d983f 100644 (file)
@@ -605,7 +605,8 @@ class UserrightsPage extends SpecialPage {
         * @param $output OutputPage to use
         */
        protected function showLogFragment( $user, $output ) {
-               $output->addHTML( Xml::element( 'h2', null, LogPage::logName( 'rights' ) . "\n" ) );
+               $rightsLogPage = new LogPage( 'rights' );
+               $output->addHTML( Xml::element( 'h2', null, $rightsLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $output, 'rights', $user->getUserPage() );
        }
 }
index 1857ed8..bf253ae 100644 (file)
@@ -675,7 +675,6 @@ XHTML id names.
 'tog-watchlisthideliu'        => 'Hide edits by logged in users from the watchlist',
 'tog-watchlisthideanons'      => 'Hide edits by anonymous users from the watchlist',
 'tog-watchlisthidepatrolled'  => 'Hide patrolled edits from the watchlist',
-'tog-nolangconversion'        => 'Disable variants conversion', # only translate this message to other languages if you have to change it
 'tog-ccmeonemails'            => 'Send me copies of e-mails I send to other users',
 'tog-diffonly'                => 'Do not show page content below diffs',
 'tog-showhiddencats'          => 'Show hidden categories',
index 6b5676e..1a32898 100644 (file)
@@ -46,10 +46,6 @@ $separatorTransformTable = array(
        ',' => '٬', # &#x066c;
 );
 
-$extraUserToggles = array(
-       'nolangconversion'
-);
-
 $fallback8bitEncoding = 'windows-1256';
 
 $namespaceNames = array(
index 8106cc0..902ec40 100644 (file)
@@ -30,10 +30,6 @@ $separatorTransformTable = array(
        '.' => ',',
 );
 
-$extraUserToggles = array(
-       'nolangconversion'
-);
-
 $fallback8bitEncoding = 'windows-1251';
 
 $linkTrail = '/^([a-zäçéğıïñöşüýʺʹа-яёәғіқңөұүһٴابپتجحدرزسشعفقكلمنڭەوۇۋۆىيچھ“»]+)(.*)$/sDu';
index ef977dd..7ee2123 100644 (file)
@@ -31,10 +31,6 @@ $separatorTransformTable = array(
        '.' => ',',
 );
 
-$extraUserToggles = array(
-       'nolangconversion'
-);
-
 $fallback8bitEncoding = 'windows-1254';
 
 $namespaceNames = array(
index ecad8ac..d8d85bb 100644 (file)
@@ -73,11 +73,6 @@ $namespaceAliases = array(
        'Разговор_о_МедијаВикију' => NS_MEDIAWIKI_TALK,
 );
 
-
-$extraUserToggles = array(
-       'nolangconversion',
-);
-
 $datePreferenceMigrationMap = array(
        'default',
        'hh:mm d. month y.',
index a932cca..2f0ff50 100644 (file)
@@ -64,10 +64,6 @@ $namespaceAliases = array(
        'Razgovor_o_slici'        => NS_FILE_TALK,
 );
 
-$extraUserToggles = array(
-       'nolangconversion',
-);
-
 $datePreferenceMigrationMap = array(
        'default',
        'hh:mm d. month y.',
index cce0e47..c9ae50e 100644 (file)
@@ -242,9 +242,6 @@ $magicWords = array(
 
 $linkTrail = '/^()(.*)$/sD';
 
-$extraUserToggles = array(
-       'nolangconversion',
-);
 $datePreferences = array(
        'default',
        'ISO 8601',
index 1918109..230f613 100644 (file)
@@ -252,7 +252,6 @@ $wgOptionalMessages = array(
        'feed-rss',
        'unit-pixel',
        'userrights-irreversible-marker',
-       'tog-nolangconversion',
        'tog-noconvertlink',
        'variantname-zh-hans',
        'variantname-zh-hant',
index be4970d..5fd1a99 100644 (file)
@@ -67,7 +67,6 @@ $wgMessageStructure = array(
                'tog-watchlisthideliu',
                'tog-watchlisthideanons',
                'tog-watchlisthidepatrolled',
-               'tog-nolangconversion',
                'tog-ccmeonemails',
                'tog-diffonly',
                'tog-showhiddencats',
@@ -3720,6 +3719,7 @@ $wgMessageStructure = array(
                'api-error-file-too-large',
                'api-error-filename-tooshort',
                'api-error-filetype-banned',
+               'api-error-filetype-banned-type',
                'api-error-filetype-missing',
                'api-error-hookaborted',
                'api-error-http',