Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / includes / filerepo / LocalRepo.php
index c4730d7..d5e29ab 100644 (file)
@@ -22,6 +22,8 @@
  * @ingroup FileRepo
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A repository that stores files in the local filesystem and registers them
  * in the wiki's own database. This is the most commonly used repository class.
@@ -200,7 +202,7 @@ class LocalRepo extends FileRepo {
                        $memcKey,
                        $expiry,
                        function ( $oldValue, &$ttl, array &$setOpts ) use ( $method, $title ) {
-                               $dbr = $this->getSlaveDB(); // possibly remote DB
+                               $dbr = $this->getReplicaDB(); // possibly remote DB
 
                                $setOpts += Database::getCacheSetOptions( $dbr );
 
@@ -298,7 +300,7 @@ class LocalRepo extends FileRepo {
                        }
                };
 
-               $dbr = $this->getSlaveDB();
+               $dbr = $this->getReplicaDB();
 
                // Query image table
                $imgNames = [];
@@ -368,7 +370,7 @@ class LocalRepo extends FileRepo {
         * @return File[]
         */
        function findBySha1( $hash ) {
-               $dbr = $this->getSlaveDB();
+               $dbr = $this->getReplicaDB();
                $res = $dbr->select(
                        'image',
                        LocalFile::selectFields(),
@@ -400,7 +402,7 @@ class LocalRepo extends FileRepo {
                        return []; // empty parameter
                }
 
-               $dbr = $this->getSlaveDB();
+               $dbr = $this->getReplicaDB();
                $res = $dbr->select(
                        'image',
                        LocalFile::selectFields(),
@@ -430,7 +432,7 @@ class LocalRepo extends FileRepo {
                $selectOptions = [ 'ORDER BY' => 'img_name', 'LIMIT' => intval( $limit ) ];
 
                // Query database
-               $dbr = $this->getSlaveDB();
+               $dbr = $this->getReplicaDB();
                $res = $dbr->select(
                        'image',
                        LocalFile::selectFields(),
@@ -452,10 +454,20 @@ class LocalRepo extends FileRepo {
         * Get a connection to the replica DB
         * @return IDatabase
         */
-       function getSlaveDB() {
+       function getReplicaDB() {
                return wfGetDB( DB_REPLICA );
        }
 
+       /**
+        * Alias for getReplicaDB()
+        *
+        * @return IDatabase
+        * @deprecated Since 1.29
+        */
+       function getSlaveDB() {
+               return $this->getReplicaDB();
+       }
+
        /**
         * Get a connection to the master DB
         * @return IDatabase