Merge "Update some documentation"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 3 Dec 2013 17:10:21 +0000 (17:10 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 3 Dec 2013 17:10:21 +0000 (17:10 +0000)
14 files changed:
includes/ChangeTags.php
includes/actions/HistoryAction.php
includes/api/ApiMain.php
includes/api/ApiQueryRecentChanges.php
includes/cache/BacklinkCache.php
includes/content/TextContentHandler.php
includes/externalstore/ExternalStoreDB.php
includes/filerepo/FileRepo.php
includes/job/jobs/RefreshLinksJob.php
includes/specials/SpecialUndelete.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messageTypes.inc
maintenance/language/messages.inc

index fd94bea..53f2955 100644 (file)
@@ -184,17 +184,19 @@ class ChangeTags {
 
                // Figure out which conditions can be done.
                if ( in_array( 'recentchanges', $tables ) ) {
-                       $join_cond = 'rc_id';
+                       $join_cond = 'ct_rc_id=rc_id';
                } elseif ( in_array( 'logging', $tables ) ) {
-                       $join_cond = 'log_id';
+                       $join_cond = 'ct_log_id=log_id';
                } elseif ( in_array( 'revision', $tables ) ) {
-                       $join_cond = 'rev_id';
+                       $join_cond = 'ct_rev_id=rev_id';
+               } elseif ( in_array( 'archive', $tables ) ) {
+                       $join_cond = 'ct_rev_id=ar_rev_id';
                } else {
                        throw new MWException( 'Unable to determine appropriate JOIN condition for tagging.' );
                }
 
                $fields['ts_tags'] = wfGetDB( DB_SLAVE )->buildGroupConcatField(
-                       ',', 'change_tag', 'ct_tag', "ct_$join_cond=$join_cond"
+                       ',', 'change_tag', 'ct_tag', $join_cond
                );
 
                if ( $wgUseTagFilter && $filter_tag ) {
@@ -202,7 +204,7 @@ class ChangeTags {
                        // Add an INNER JOIN on change_tag
 
                        $tables[] = 'change_tag';
-                       $join_conds['change_tag'] = array( 'INNER JOIN', "ct_$join_cond=$join_cond" );
+                       $join_conds['change_tag'] = array( 'INNER JOIN', $join_cond );
                        $conds['ct_tag'] = $filter_tag;
                }
        }
index e492bd4..34db1d2 100644 (file)
@@ -558,7 +558,7 @@ class HistoryPager extends ReverseChronologicalPager {
         *
         * @todo document some more, and maybe clean up the code (some params redundant?)
         *
-        * @param stdObject $row The database row corresponding to the previous line.
+        * @param stdClass $row The database row corresponding to the previous line.
         * @param mixed $next The database row corresponding to the next line
         *   (chronologically previous)
         * @param bool|string $notificationtimestamp
index 861fa82..829ba6f 100644 (file)
@@ -744,7 +744,11 @@ class ApiMain extends ApiBase {
                                $this->dieUsageMsg( array( 'missingparam', 'token' ) );
                        }
 
-                       if ( !$this->getUser()->matchEditToken( $moduleParams['token'], $salt, $this->getContext()->getRequest() ) ) {
+                       if ( !$this->getUser()->matchEditToken(
+                               $moduleParams['token'],
+                               $salt,
+                               $this->getContext()->getRequest() )
+                       ) {
                                $this->dieUsageMsg( 'sessionfailure' );
                        }
                }
index b44565e..653feab 100644 (file)
@@ -198,7 +198,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        }
 
                        // Check permissions
-                       if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) || isset( $show['unpatrolled'] ) ) {
+                       if ( isset( $show['patrolled'] )
+                               || isset( $show['!patrolled'] )
+                               || isset( $show['unpatrolled'] )
+                       ) {
                                if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
                                        $this->dieUsage(
                                                'You need the patrol right to request the patrolled flag',
index 45d00d7..d2ec26e 100644 (file)
@@ -426,7 +426,7 @@ class BacklinkCache {
                        $cacheEntry['numRows'] += $partitions['numRows'];
                        $cacheEntry['batches'] = array_merge( $cacheEntry['batches'], $partitions['batches'] );
                        if ( count( $partitions['batches'] ) ) {
-                               list( $lStart, $lEnd ) = end( $partitions['batches'] );
+                               list( , $lEnd ) = end( $partitions['batches'] );
                                $start = $lEnd + 1; // pick up after this inclusive range
                        }
                } while ( $partitions['numRows'] >= $selectSize );
index c4584ae..94b5c57 100644 (file)
  * @ingroup Content
  */
 class TextContentHandler extends ContentHandler {
+       // @codingStandardsIgnoreStart bug 57585
        public function __construct( $modelId = CONTENT_MODEL_TEXT,
                $formats = array( CONTENT_FORMAT_TEXT )
        ) {
                parent::__construct( $modelId, $formats );
        }
+       // @codingStandardsIgnoreEnd
 
        /**
         * Returns the content's text as-is.
index 8c2147a..b7e5469 100644 (file)
@@ -37,7 +37,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
         */
        public function fetchFromURL( $url ) {
                list( $cluster, $id, $itemID ) = $this->parseURL( $url );
-               $ret =& $this->fetchBlob( $cluster, $id, $itemID );
+               $ret = $this->fetchBlob( $cluster, $id, $itemID );
 
                if ( $itemID !== false && $ret !== false ) {
                        return $ret->getItem( $itemID );
@@ -109,7 +109,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
         * @param string $cluster cluster name
         * @return LoadBalancer object
         */
-       function &getLoadBalancer( $cluster ) {
+       function getLoadBalancer( $cluster ) {
                $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
 
                return wfGetLBFactory()->getExternalLB( $cluster, $wiki );
@@ -121,11 +121,11 @@ class ExternalStoreDB extends ExternalStoreMedium {
         * @param string $cluster cluster name
         * @return DatabaseBase object
         */
-       function &getSlave( $cluster ) {
+       function getSlave( $cluster ) {
                global $wgDefaultExternalStore;
 
                $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
-               $lb =& $this->getLoadBalancer( $cluster );
+               $lb = $this->getLoadBalancer( $cluster );
 
                if ( !in_array( "DB://" . $cluster, (array)$wgDefaultExternalStore ) ) {
                        wfDebug( "read only external store" );
@@ -143,9 +143,9 @@ class ExternalStoreDB extends ExternalStoreMedium {
         * @param string $cluster cluster name
         * @return DatabaseBase object
         */
-       function &getMaster( $cluster ) {
+       function getMaster( $cluster ) {
                $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
-               $lb =& $this->getLoadBalancer( $cluster );
+               $lb = $this->getLoadBalancer( $cluster );
 
                return $lb->getConnection( DB_MASTER, array(), $wiki );
        }
@@ -156,7 +156,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
         * @param $db DatabaseBase
         * @return String: table name ('blobs' by default)
         */
-       function getTable( &$db ) {
+       function getTable( $db ) {
                $table = $db->getLBInfo( 'blobs table' );
                if ( is_null( $table ) ) {
                        $table = 'blobs';
@@ -175,7 +175,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
         * @return mixed
         * @private
         */
-       function &fetchBlob( $cluster, $id, $itemID ) {
+       function fetchBlob( $cluster, $id, $itemID ) {
                /**
                 * One-step cache variable to hold base blobs; operations that
                 * pull multiple revisions may often pull multiple times from
@@ -195,14 +195,14 @@ class ExternalStoreDB extends ExternalStoreMedium {
                wfDebugLog( 'ExternalStoreDB-cache',
                        "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
 
-               $dbr =& $this->getSlave( $cluster );
+               $dbr = $this->getSlave( $cluster );
                $ret = $dbr->selectField( $this->getTable( $dbr ),
                        'blob_text', array( 'blob_id' => $id ), __METHOD__ );
                if ( $ret === false ) {
                        wfDebugLog( 'ExternalStoreDB',
                                "ExternalStoreDB::fetchBlob master fallback on $cacheID\n" );
                        // Try the master
-                       $dbw =& $this->getMaster( $cluster );
+                       $dbw = $this->getMaster( $cluster );
                        $ret = $dbw->selectField( $this->getTable( $dbw ),
                                'blob_text', array( 'blob_id' => $id ), __METHOD__ );
                        if ( $ret === false ) {
@@ -215,7 +215,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                        $ret = unserialize( $ret );
                }
 
-               $externalBlobCache = array( $cacheID => &$ret );
+               $externalBlobCache = array( $cacheID => $ret );
 
                return $ret;
        }
index 8611238..47efa70 100644 (file)
@@ -70,7 +70,8 @@ class FileRepo {
        /** @var string Equivalent to $wgArticlePath, e.g. http://en.wikipedia.org/wiki/$1 */
        protected $articleUrl;
 
-       /** @var bool Whether to fetch commons image description pages and display them on the local wiki */
+       /** @var bool Whether to fetch commons image description pages and display
+        *    them on the local wiki */
        public $fetchDescription;
 
        /** @var bool Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE],
index ea1d596..e5f3ce5 100644 (file)
@@ -97,7 +97,7 @@ class RefreshLinksJob extends Job {
                        }
                // Job to update link tables for a given title
                } else {
-                       $this->runForTitle( $this->mTitle );
+                       $this->runForTitle( $this->title );
                }
 
                return true;
index d4aed11..d33851d 100644 (file)
@@ -124,6 +124,8 @@ class PageArchive {
 
                $dbr = wfGetDB( DB_SLAVE );
 
+               $tables = array( 'archive' );
+
                $fields = array(
                        'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text',
                        'ar_comment', 'ar_len', 'ar_deleted', 'ar_rev_id', 'ar_sha1',
@@ -134,12 +136,28 @@ class PageArchive {
                        $fields[] = 'ar_content_model';
                }
 
-               $res = $dbr->select( 'archive',
+               $conds = array( 'ar_namespace' => $this->title->getNamespace(),
+                               'ar_title' => $this->title->getDBkey() );
+
+               $options = array( 'ORDER BY' => 'ar_timestamp DESC' );
+
+               $join_conds = array();
+
+               ChangeTags::modifyDisplayQuery(
+                       $tables,
                        $fields,
-                       array( 'ar_namespace' => $this->title->getNamespace(),
-                               'ar_title' => $this->title->getDBkey() ),
+                       $conds,
+                       $join_conds,
+                       $options
+               );
+
+               $res = $dbr->select( $tables,
+                       $fields,
+                       $conds,
                        __METHOD__,
-                       array( 'ORDER BY' => 'ar_timestamp DESC' ) );
+                       $options,
+                       $join_conds
+               );
 
                return $dbr->resultObject( $res );
        }
@@ -1083,6 +1101,16 @@ class SpecialUndelete extends SpecialPage {
                        $rdel = " $rdel";
                }
 
+               $minor = $rev->isMinor() ? ChangesList::flag( 'minor' ) : '';
+
+               $tags = wfGetDB( DB_SLAVE )->selectField(
+                       'tag_summary',
+                       'ts_tags',
+                       array( 'ts_rev_id' => $rev->getId() ),
+                       __METHOD__
+               );
+               $tagSummary = ChangeTags::formatSummaryRow( $tags, 'deleteddiff' );
+
                return '<div id="mw-diff-' . $prefix . 'title1"><strong>' .
                        Linker::link(
                                $targetPage,
@@ -1100,7 +1128,10 @@ class SpecialUndelete extends SpecialPage {
                        Linker::revUserTools( $rev ) . '<br />' .
                        '</div>' .
                        '<div id="mw-diff-' . $prefix . 'title3">' .
-                       Linker::revComment( $rev ) . $rdel . '<br />' .
+                       $minor . Linker::revComment( $rev ) . $rdel . '<br />' .
+                       '</div>' .
+                       '<div id="mw-diff-' . $prefix . 'title5">' .
+                       $tagSummary[0] . '<br />' .
                        '</div>';
        }
 
@@ -1367,6 +1398,9 @@ class SpecialUndelete extends SpecialPage {
                // User links
                $userLink = Linker::revUserTools( $rev );
 
+               // Minor edit
+               $minor = $rev->isMinor() ? ChangesList::flag( 'minor' ) : '';
+
                // Revision text size
                $size = $row->ar_len;
                if ( !is_null( $size ) ) {
@@ -1376,14 +1410,21 @@ class SpecialUndelete extends SpecialPage {
                // Edit summary
                $comment = Linker::revComment( $rev );
 
+               // Tags
+               $attribs = array();
+               list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'deletedhistory' );
+               if ( $classes ) {
+                       $attribs['class'] = implode( ' ', $classes );
+               }
+
                // Revision delete links
                $revdlink = Linker::getRevDeleteLink( $user, $rev, $this->mTargetObj );
 
-               $revisionRow = $this->msg( 'undelete-revisionrow' )
-                       ->rawParams( $checkBox, $revdlink, $last, $pageLink, $userLink, $revTextSize, $comment )
+               $revisionRow = $this->msg( 'undelete-revision-row' )
+                       ->rawParams( $checkBox, $revdlink, $last, $pageLink, $userLink, $minor, $revTextSize, $comment, $tagSummary )
                        ->escaped();
 
-               return "<li>$revisionRow</li>";
+               return Xml::tags( 'li', $attribs, $revisionRow ) . "\n";
        }
 
        private function formatFileRow( $row ) {
index 4b63d03..e6ecc78 100644 (file)
@@ -3225,7 +3225,7 @@ It may have already been undeleted.',
 $1',
 'undelete-show-file-confirm'   => 'Are you sure you want to view the deleted revision of the file "<nowiki>$1</nowiki>" from $2 at $3?',
 'undelete-show-file-submit'    => 'Yes',
-'undelete-revisionrow'         => '$1 $2 ($3) $4 . . $5 $6 $7', # only translate this message to other languages if you have to change it
+'undelete-revision-row'         => '$1 $2 ($3) $4 . . $5 $6 $7 $8 $9', # only translate this message to other languages if you have to change it
 
 # Namespace form on various pages
 'namespace'                     => 'Namespace:',
index 755ccbe..4d84a95 100644 (file)
@@ -6014,15 +6014,17 @@ Parameters:
 * $3 - the time of the displayed revision
 {{Identical|Are you sure you want to view the deleted revision of the file...}}',
 'undelete-show-file-submit' => '{{Identical|Yes}}',
-'undelete-revisionrow' => "{{Optional}}
+'undelete-revision-row' => "{{Optional}}
 A revision row in the undelete page. Parameters:
 * $1 is a checkBox to indicate whether to restore this specific revision
 * $2 is a link to the revision
 * $3 is a link to the last revision of a page ({{msg-mw|last}})
 * $4 is a link to the page
 * $5 is a link to the revision's user
-* $6 is the revision size
-* $7 is the revision comment",
+* $6 is the revision's minor edit identifier
+* $7 is the revision size
+* $8 is the revision comment
+* $9 is the revision's tags",
 
 # Namespace form on various pages
 'namespace' => 'This message is located at [[Special:Contributions]].
index 7a10b66..b06c11f 100644 (file)
@@ -477,7 +477,7 @@ $wgOptionalMessages = array(
        'version-entrypoints-scriptpath',
        'mergehistory-revisionrow',
        'categoryviewer-pagedlinks',
-       'undelete-revisionrow',
+       'undelete-revision-row',
        'pageinfo-redirects-value',
        'created', // @deprecated. Remove in MediaWiki 1.23.
        'changed', // @deprecated. Remove in MediaWiki 1.23.
index 0451263..f0160cc 100644 (file)
@@ -2207,7 +2207,7 @@ $wgMessageStructure = array(
                'undelete-error-long',
                'undelete-show-file-confirm',
                'undelete-show-file-submit',
-               'undelete-revisionrow',
+               'undelete-revision-row',
        ),
        'nsform' => array(
                'namespace',