Merge "Fix doc of LogFormatter::newFromRow"
[lhc/web/wiklou.git] / includes / logging / LogFormatter.php
index 0145b02..b99cb41 100644 (file)
@@ -67,7 +67,7 @@ class LogFormatter {
        /**
         * Handy shortcut for constructing a formatter directly from
         * database row.
-        * @param object $row
+        * @param stdClass|array $row
         * @see DatabaseLogEntry::getSelectQueryData
         * @return LogFormatter
         */
@@ -237,7 +237,7 @@ class LogFormatter {
                                        // @codingStandardsIgnoreStart Long line
                                        //case 'revision': // Revision deletion
                                        //case 'event': // Log deletion
-                                       // see https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/LogPage.php?&pathrev=97044&r1=97043&r2=97044
+                                       // see https://github.com/wikimedia/mediawiki/commit/a9c243b7b5289dad204278dbe7ed571fd914e395
                                        //default:
                                        // @codingStandardsIgnoreEnd
                                }
@@ -245,7 +245,7 @@ class LogFormatter {
 
                        case 'patrol':
                                // @codingStandardsIgnoreStart Long line
-                               // https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/PatrolLog.php?&pathrev=97495&r1=97494&r2=97495
+                               // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
                                // @codingStandardsIgnoreEnd
                                // Create a diff link to the patrolled revision
                                if ( $entry->getSubtype() === 'patrol' ) {
@@ -263,7 +263,7 @@ class LogFormatter {
                                switch ( $entry->getSubtype() ) {
                                        case 'protect':
                                                $text = wfMessage( 'protectedarticle' )
-                                                       ->rawParams( $target . ' ' . $parameters[0] )->inContentLanguage()->escaped();
+                                                       ->rawParams( $target . ' ' . $parameters['4::description'] )->inContentLanguage()->escaped();
                                                break;
                                        case 'unprotect':
                                                $text = wfMessage( 'unprotectedarticle' )
@@ -271,7 +271,11 @@ class LogFormatter {
                                                break;
                                        case 'modify':
                                                $text = wfMessage( 'modifiedarticleprotection' )
-                                                       ->rawParams( $target . ' ' . $parameters[0] )->inContentLanguage()->escaped();
+                                                       ->rawParams( $target . ' ' . $parameters['4::description'] )->inContentLanguage()->escaped();
+                                               break;
+                                       case 'move_prot':
+                                               $text = wfMessage( 'movedarticleprotection' )
+                                                       ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
                                                break;
                                }
                                break;
@@ -600,12 +604,13 @@ class LogFormatter {
         * value in consideration.
         * @param Title $title The page
         * @param array $parameters Query parameters
+        * @param string|null $html Linktext of the link as raw html
         * @throws MWException
         * @return string
         */
-       protected function makePageLink( Title $title = null, $parameters = array() ) {
+       protected function makePageLink( Title $title = null, $parameters = array(), $html = null ) {
                if ( !$this->plaintext ) {
-                       $link = Linker::link( $title, null, array(), $parameters );
+                       $link = Linker::link( $title, $html, array(), $parameters );
                } else {
                        if ( !$title instanceof Title ) {
                                throw new MWException( "Expected title, got null" );
@@ -928,32 +933,6 @@ class LegacyLogFormatter extends LogFormatter {
                $type = $this->entry->getType();
                $subtype = $this->entry->getSubtype();
 
-               if ( $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();
-               }
-
                // 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.