Ori.livneh has uploaded a new change for review.

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

Change subject: Revert "Avoiding writing sessions for no reason"
......................................................................

Revert "Avoiding writing sessions for no reason"

This reverts commit 532ef7851c696cbbccecdad365d5dd44486245fd.

Change-Id: Ie67f4ca000afcf3d4f44155c13f91cd4c286866d
---
M includes/objectcache/ObjectCacheSessionHandler.php
1 file changed, 7 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/23/228423/1

diff --git a/includes/objectcache/ObjectCacheSessionHandler.php 
b/includes/objectcache/ObjectCacheSessionHandler.php
index 24d2a22..40b40d1 100644
--- a/includes/objectcache/ObjectCacheSessionHandler.php
+++ b/includes/objectcache/ObjectCacheSessionHandler.php
@@ -28,9 +28,6 @@
  * @ingroup Cache
  */
 class ObjectCacheSessionHandler {
-       /** @var array Map of (session ID => SHA-1 of the data) */
-       protected static $hashCache = array();
-
        /**
         * Install a session handler for the current web request
         */
@@ -54,9 +51,8 @@
         * Get the cache storage object to use for session storage
         * @return BagOStuff
         */
-       protected static function getCache() {
+       static function getCache() {
                global $wgSessionCacheType;
-
                return ObjectCache::getInstance( $wgSessionCacheType );
        }
 
@@ -66,16 +62,8 @@
         * @param string $id Session id
         * @return string Cache key
         */
-       protected static function getKey( $id ) {
+       static function getKey( $id ) {
                return wfMemcKey( 'session', $id );
-       }
-
-       /**
-        * @param mixed $data
-        * @return string
-        */
-       protected static function getHash( $data ) {
-               return sha1( serialize( $data ) );
        }
 
        /**
@@ -107,10 +95,10 @@
         */
        static function read( $id ) {
                $data = self::getCache()->get( self::getKey( $id ) );
-
-               self::$hashCache = array( $id => self::getHash( $data ) );
-
-               return ( $data === false ) ? '' : $data;
+               if ( $data === false ) {
+                       return '';
+               }
+               return $data;
        }
 
        /**
@@ -122,14 +110,7 @@
         */
        static function write( $id, $data ) {
                global $wgObjectCacheSessionExpiry;
-
-               // Only issue a write if anything changed (PHP 5.6 already does 
this)
-               if ( !isset( self::$hashCache[$id] )
-                       || self::getHash( $data ) !== self::$hashCache[$id]
-               ) {
-                       self::getCache()->set( self::getKey( $id ), $data, 
$wgObjectCacheSessionExpiry );
-               }
-
+               self::getCache()->set( self::getKey( $id ), $data, 
$wgObjectCacheSessionExpiry );
                return true;
        }
 
@@ -141,7 +122,6 @@
         */
        static function destroy( $id ) {
                self::getCache()->delete( self::getKey( $id ) );
-
                return true;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie67f4ca000afcf3d4f44155c13f91cd4c286866d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

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

Reply via email to