Merge "Efficiently reset null user tokens"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 29 Aug 2013 00:20:52 +0000 (00:20 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 29 Aug 2013 00:20:52 +0000 (00:20 +0000)
RELEASE-NOTES-1.22
includes/db/LoadBalancer.php
languages/messages/MessagesEn.php

index c90fdbe..f0490d4 100644 (file)
@@ -204,6 +204,8 @@ production.
 * (bug 30607) Special:ListFiles can now show old versions of files. Additionally
   Special:AllMyUploads was introduced so the user can get a list of all things
   they have ever uploaded, even if it was subsequently overriden.
+* Introduced Special:MyFiles and Special:AllMyFiles as an alias for Special:MyUploads
+  and Special:AllMyUploads respectively.
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
index 60c2833..3358488 100644 (file)
@@ -561,6 +561,22 @@ class LoadBalancer {
                return new DBConnRef( $this, $this->getConnection( $db, $groups, $wiki ) );
        }
 
+       /**
+        * Get a database connection handle reference without connecting yet
+        *
+        * The handle's methods wrap simply wrap those of a DatabaseBase handle
+        *
+        * @see LoadBalancer::getConnection() for parameter information
+        *
+        * @param integer $db
+        * @param mixed $groups
+        * @param string $wiki
+        * @return DBConnRef
+        */
+       public function getLazyConnectionRef( $db, $groups = array(), $wiki = false ) {
+               return new DBConnRef( $this, array( $db, $groups, $wiki ) );
+       }
+
        /**
         * Open a connection to the server given by the specified index
         * Index must be an actual index into the array.
@@ -1088,6 +1104,7 @@ class LoadBalancer {
 
 /**
  * Helper class to handle automatically marking connectons as reusable (via RAII pattern)
+ * as well handling deferring the actual network connection until the handle is used
  *
  * @ingroup Database
  * @since 1.22
@@ -1095,23 +1112,35 @@ class LoadBalancer {
 class DBConnRef implements IDatabase {
        /** @var LoadBalancer */
        protected $lb;
-       /** @var DatabaseBase */
+       /** @var DatabaseBase|null */
        protected $conn;
+       /** @var Array|null */
+       protected $params;
 
        /**
         * @param $lb LoadBalancer
-        * @param $conn DatabaseBase
+        * @param $conn DatabaseBase|array Connection or (server index, group, wiki ID) array
         */
-       public function __construct( LoadBalancer $lb, DatabaseBase $conn ) {
+       public function __construct( LoadBalancer $lb, $conn ) {
                $this->lb = $lb;
-               $this->conn = $conn;
+               if ( $conn instanceof DatabaseBase ) {
+                       $this->conn = $conn;
+               } else {
+                       $this->params = $conn;
+               }
        }
 
        public function __call( $name, $arguments ) {
+               if ( $this->conn === null ) {
+                       list( $db, $groups, $wiki ) = $this->params;
+                       $this->conn = $this->lb->getConnection( $db, $groups, $wiki );
+               }
                return call_user_func_array( array( $this->conn, $name ), $arguments );
        }
 
        function __destruct() {
-               $this->lb->reuseConnection( $this->conn );
+               if ( $this->conn !== null ) {
+                       $this->lb->reuseConnection( $this->conn );
+               }
        }
 }
index 67f29d1..51c9e1a 100644 (file)
@@ -385,7 +385,7 @@ $magicWords = array(
 $specialPageAliases = array(
        'Activeusers'               => array( 'ActiveUsers' ),
        'Allmessages'               => array( 'AllMessages' ),
-       'AllMyUploads'              => array( 'AllMyUploads' ),
+       'AllMyUploads'              => array( 'AllMyUploads', 'AllMyFiles' ),
        'Allpages'                  => array( 'AllPages' ),
        'Ancientpages'              => array( 'AncientPages' ),
        'Badtitle'                  => array( 'Badtitle' ),
@@ -439,7 +439,7 @@ $specialPageAliases = array(
        'Mycontributions'           => array( 'MyContributions' ),
        'Mypage'                    => array( 'MyPage' ),
        'Mytalk'                    => array( 'MyTalk' ),
-       'Myuploads'                 => array( 'MyUploads' ),
+       'Myuploads'                 => array( 'MyUploads', 'MyFiles' ),
        'Newimages'                 => array( 'NewFiles', 'NewImages' ),
        'Newpages'                  => array( 'NewPages' ),
        'PagesWithProp'             => array( 'PagesWithProp', 'Pageswithprop', 'PagesByProp', 'Pagesbyprop' ),