Merge "mediawiki.page.gallery.slideshow: Avoid manual Deferred wrapping"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 6 Aug 2019 22:52:34 +0000 (22:52 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 6 Aug 2019 22:52:34 +0000 (22:52 +0000)
includes/DefaultSettings.php
includes/Revision/RevisionStore.php
includes/specials/SpecialVersion.php

index 7d3802c..1b348f3 100644 (file)
@@ -1563,7 +1563,7 @@ $wgUseTinyRGBForJPGThumbnails = false;
  *   - captionLength:  Length to truncate filename to in caption when using "showfilename".
  *                     A value of 'true' will truncate the filename to one line using CSS
  *                     and will be the behaviour after deprecation.
- * @deprecated since 1.28
+ *                     @deprecated since 1.28
  *   - showBytes:      Show the filesize in bytes in categories
  *   - showDimensions: Show the dimensions (width x height) in categories
  *   - mode:           Gallery mode
index fe5b5b9..9e8dfe7 100644 (file)
@@ -276,17 +276,6 @@ class RevisionStore
                return $this->loadBalancer;
        }
 
-       /**
-        * @param int $mode DB_MASTER or DB_REPLICA
-        * @param array $groups
-        *
-        * @return IDatabase
-        */
-       private function getDBConnection( $mode, $groups = [] ) {
-               $lb = $this->getDBLoadBalancer();
-               return $lb->getConnectionRef( $mode, $groups, $this->dbDomain );
-       }
-
        /**
         * @param int $queryFlags a bit field composed of READ_XXX flags
         *
@@ -297,22 +286,15 @@ class RevisionStore
                return $this->getDBConnectionRef( $mode );
        }
 
-       /**
-        * @param IDatabase $connection
-        */
-       private function releaseDBConnection( IDatabase $connection ) {
-               $lb = $this->getDBLoadBalancer();
-               $lb->reuseConnection( $connection );
-       }
-
        /**
         * @param int $mode DB_MASTER or DB_REPLICA
         *
+        * @param array $groups
         * @return DBConnRef
         */
-       private function getDBConnectionRef( $mode ) {
+       private function getDBConnectionRef( $mode, $groups = [] ) {
                $lb = $this->getDBLoadBalancer();
-               return $lb->getConnectionRef( $mode, [], $this->dbDomain );
+               return $lb->getConnectionRef( $mode, $groups, $this->dbDomain );
        }
 
        /**
@@ -1154,7 +1136,7 @@ class RevisionStore
         */
        public function getRecentChange( RevisionRecord $rev, $flags = 0 ) {
                list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
-               $db = $this->getDBConnection( $dbType );
+               $db = $this->getDBConnectionRef( $dbType );
 
                $userIdentity = $rev->getUser( RevisionRecord::RAW );
 
@@ -1176,8 +1158,6 @@ class RevisionStore
                        $dbType
                );
 
-               $this->releaseDBConnection( $db );
-
                // XXX: cache this locally? Glue it to the RevisionRecord?
                return $rc;
        }
@@ -1593,7 +1573,7 @@ class RevisionStore
         * @return RevisionRecord|null
         */
        public function getRevisionByTimestamp( $title, $timestamp ) {
-               $db = $this->getDBConnection( DB_REPLICA );
+               $db = $this->getDBConnectionRef( DB_REPLICA );
                return $this->newRevisionFromConds(
                        [
                                'rev_timestamp' => $db->timestamp( $timestamp ),
@@ -2203,9 +2183,8 @@ class RevisionStore
                        && $lb->hasOrMadeRecentMasterChanges()
                ) {
                        $flags = self::READ_LATEST;
-                       $dbw = $this->getDBConnection( DB_MASTER );
+                       $dbw = $this->getDBConnectionRef( DB_MASTER );
                        $rev = $this->loadRevisionFromConds( $dbw, $conditions, $flags, $title );
-                       $this->releaseDBConnection( $dbw );
                }
 
                return $rev;
@@ -2574,7 +2553,7 @@ class RevisionStore
         *         of the corresponding revision.
         */
        public function getRevisionSizes( array $revIds ) {
-               return $this->listRevisionSizes( $this->getDBConnection( DB_REPLICA ), $revIds );
+               return $this->listRevisionSizes( $this->getDBConnectionRef( DB_REPLICA ), $revIds );
        }
 
        /**
@@ -2634,7 +2613,7 @@ class RevisionStore
                }
 
                list( $dbType, ) = DBAccessObjectUtils::getDBOptions( $flags );
-               $db = $this->getDBConnection( $dbType, [ 'contributions' ] );
+               $db = $this->getDBConnectionRef( $dbType, [ 'contributions' ] );
 
                $ts = $this->getTimestampFromId( $rev->getId(), $flags );
                if ( $ts === false ) {
index ec34db8..fa78cbe 100644 (file)
@@ -31,13 +31,20 @@ use MediaWiki\MediaWikiServices;
  * @ingroup SpecialPage
  */
 class SpecialVersion extends SpecialPage {
+
+       /**
+        * @var bool
+        */
        protected $firstExtOpened = false;
 
        /**
-        * Stores the current rev id/SHA hash of MediaWiki core
+        * @var string The current rev id/SHA hash of MediaWiki core
         */
        protected $coreId = '';
 
+       /**
+        * @var string[]|false Lazy initialized key/value with message content
+        */
        protected static $extensionTypes = false;
 
        public function __construct() {
@@ -379,7 +386,7 @@ class SpecialVersion extends SpecialPage {
         *
         * @since 1.17
         *
-        * @return array
+        * @return string[]
         */
        public static function getExtensionTypes() {
                if ( self::$extensionTypes === false ) {