Aaron Schulz has uploaded a new change for review.

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

Change subject: [WIP] Remove isVolatile/markVolatile logic from LocalFile
......................................................................

[WIP] Remove isVolatile/markVolatile logic from LocalFile

* This is obsoleted by the "latest" flag

Bug: T89184
Change-Id: I808c3a6f0edb3466cb600c06c5e742ab030baf14
---
M includes/filerepo/file/LocalFile.php
1 file changed, 0 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/89/194589/1

diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 3056ad8..e5ce220 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -124,13 +124,8 @@
        /** @var bool True if file is not present in file system. Not to be 
cached in memcached */
        private $missing;
 
-       /** @var int UNIX timestamp of last markVolatile() call */
-       private $lastMarkedVolatile = 0;
-
        // @note: higher than IDBAccessObject constants
        const LOAD_ALL = 16; // integer; load all the lazy fields too (like 
metadata)
-
-       const VOLATILE_TTL = 300; // integer; seconds
 
        /**
         * Create a LocalFile from a title
@@ -531,10 +526,6 @@
        function load( $flags = 0 ) {
                if ( !$this->dataLoaded ) {
                        if ( ( $flags & self::READ_LATEST ) || 
!$this->loadFromCache() ) {
-                               // b/c for now for data consistency
-                               if ( $this->isVolatile() ) {
-                                       $flags |= self::READ_LATEST;
-                               }
                                $this->loadFromDB( $flags );
                                $this->saveToCache();
                        }
@@ -1866,8 +1857,6 @@
                        } );
                }
 
-               $this->markVolatile(); // file may change soon
-
                return $this->lockedOwnTrx;
        }
 
@@ -1884,48 +1873,6 @@
                                $this->lockedOwnTrx = false;
                        }
                }
-       }
-
-       /**
-        * Mark a file as about to be changed
-        *
-        * This sets a cache key that alters master/slave DB loading behavior
-        *
-        * @return bool Success
-        */
-       protected function markVolatile() {
-               global $wgMemc;
-
-               $key = $this->repo->getSharedCacheKey( 'file-volatile', md5( 
$this->getName() ) );
-               if ( $key ) {
-                       $this->lastMarkedVolatile = time();
-                       return $wgMemc->set( $key, $this->lastMarkedVolatile, 
self::VOLATILE_TTL );
-               }
-
-               return true;
-       }
-
-       /**
-        * Check if a file is about to be changed or has been changed recently
-        *
-        * @see LocalFile::isVolatile()
-        * @return bool Whether the file is volatile
-        */
-       protected function isVolatile() {
-               global $wgMemc;
-
-               $key = $this->repo->getSharedCacheKey( 'file-volatile', md5( 
$this->getName() ) );
-               if ( !$key ) {
-                       // repo unavailable; bail.
-                       return false;
-               }
-
-               if ( $this->lastMarkedVolatile === 0 ) {
-                       $this->lastMarkedVolatile = $wgMemc->get( $key ) ?: 0;
-               }
-
-               $volatileDuration = time() - $this->lastMarkedVolatile;
-               return $volatileDuration <= self::VOLATILE_TTL;
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I808c3a6f0edb3466cb600c06c5e742ab030baf14
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