Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/115518

Change subject: Deprecated useless BagOStuff::replace method
......................................................................

Deprecated useless BagOStuff::replace method

* Almost nothing actually uses this (one extension)
  as it doesn't really solve race conditions like merge().
* Removed subclassed versions too.

Change-Id: I4d4123afcc0576a90a3cbf1e4e6daff7ebce39c3
---
M includes/objectcache/BagOStuff.php
M includes/objectcache/MemcachedBagOStuff.php
M includes/objectcache/MemcachedPeclBagOStuff.php
M includes/objectcache/RedisBagOStuff.php
4 files changed, 2 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/18/115518/1

diff --git a/includes/objectcache/BagOStuff.php 
b/includes/objectcache/BagOStuff.php
index 857943e..f6fe243 100644
--- a/includes/objectcache/BagOStuff.php
+++ b/includes/objectcache/BagOStuff.php
@@ -250,8 +250,10 @@
         * @param $value mixed
         * @param $exptime int
         * @return bool success
+        * @deprecated 1.23
         */
        public function replace( $key, $value, $exptime = 0 ) {
+               wfDeprecated( __METHOD__, '1.23' );
                if ( $this->get( $key ) !== false ) {
                        return $this->set( $key, $value, $exptime );
                }
diff --git a/includes/objectcache/MemcachedBagOStuff.php 
b/includes/objectcache/MemcachedBagOStuff.php
index f1644ed..87acb53 100644
--- a/includes/objectcache/MemcachedBagOStuff.php
+++ b/includes/objectcache/MemcachedBagOStuff.php
@@ -108,17 +108,6 @@
        }
 
        /**
-        * @param $key string
-        * @param $value int
-        * @param $exptime
-        * @return Mixed
-        */
-       public function replace( $key, $value, $exptime = 0 ) {
-               return $this->client->replace( $this->encodeKey( $key ), $value,
-                       $this->fixExpiry( $exptime ) );
-       }
-
-       /**
         * Get the underlying client object. This is provided for debugging
         * purposes.
         */
diff --git a/includes/objectcache/MemcachedPeclBagOStuff.php 
b/includes/objectcache/MemcachedPeclBagOStuff.php
index 0c3b228..18546d4 100644
--- a/includes/objectcache/MemcachedPeclBagOStuff.php
+++ b/includes/objectcache/MemcachedPeclBagOStuff.php
@@ -179,17 +179,6 @@
        /**
         * @param $key string
         * @param $value int
-        * @param $exptime
-        * @return Mixed
-        */
-       public function replace( $key, $value, $exptime = 0 ) {
-               $this->debugLog( "replace($key)" );
-               return $this->checkResult( $key, parent::replace( $key, $value, 
$exptime ) );
-       }
-
-       /**
-        * @param $key string
-        * @param $value int
         * @return Mixed
         */
        public function incr( $key, $value = 1 ) {
diff --git a/includes/objectcache/RedisBagOStuff.php 
b/includes/objectcache/RedisBagOStuff.php
index 427143c..f54726f 100644
--- a/includes/objectcache/RedisBagOStuff.php
+++ b/includes/objectcache/RedisBagOStuff.php
@@ -237,37 +237,6 @@
        }
 
        /**
-        * Non-atomic implementation of replace(). Could perhaps be done 
atomically
-        * with WATCH or scripting, but this function is rarely used.
-        */
-       public function replace( $key, $value, $expiry = 0 ) {
-               $section = new ProfileSection( __METHOD__ );
-
-               list( $server, $conn ) = $this->getConnection( $key );
-               if ( !$conn ) {
-                       return false;
-               }
-               if ( !$conn->exists( $key ) ) {
-                       return false;
-               }
-
-               $expiry = $this->convertToRelative( $expiry );
-               try {
-                       if ( !$expiry ) {
-                               $result = $conn->set( $key, $this->serialize( 
$value ) );
-                       } else {
-                               $result = $conn->setex( $key, $expiry, 
$this->serialize( $value ) );
-                       }
-               } catch ( RedisException $e ) {
-                       $result = false;
-                       $this->handleException( $conn, $e );
-               }
-
-               $this->logRequest( 'replace', $key, $server, $result );
-               return $result;
-       }
-
-       /**
         * Non-atomic implementation of incr().
         *
         * Probably all callers actually want incr() to atomically initialise

-- 
To view, visit https://gerrit.wikimedia.org/r/115518
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d4123afcc0576a90a3cbf1e4e6daff7ebce39c3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to