Merge "Add option to expose original sha1 in thumb url"
[lhc/web/wiklou.git] / includes / filerepo / LocalRepo.php
index 7aa7919..6361463 100644 (file)
@@ -29,9 +29,6 @@
  * @ingroup FileRepo
  */
 class LocalRepo extends FileRepo {
-       /** @var bool */
-       protected $hasSha1Storage = false;
-
        /** @var array */
        protected $fileFactory = array( 'LocalFile', 'newFromTitle' );
 
@@ -203,6 +200,7 @@ class LocalRepo extends FileRepo {
                } else {
                        $expiry = 86400; // has invalidation, 1 day
                }
+
                $cachedValue = $cache->get( $memcKey );
                if ( $cachedValue === ' ' || $cachedValue === '' ) {
                        // Does not exist
@@ -211,9 +209,11 @@ class LocalRepo extends FileRepo {
                        return Title::newFromText( $cachedValue, NS_FILE );
                } // else $cachedValue is false or null: cache miss
 
+               $opts = array( 'since' => $this->getSlaveDB()->trxTimestamp() );
+
                $id = $this->getArticleID( $title );
                if ( !$id ) {
-                       $cache->set( $memcKey, " ", $expiry );
+                       $cache->set( $memcKey, " ", $expiry, $opts );
 
                        return false;
                }
@@ -227,11 +227,11 @@ class LocalRepo extends FileRepo {
 
                if ( $row && $row->rd_namespace == NS_FILE ) {
                        $targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title );
-                       $cache->set( $memcKey, $targetTitle->getDBkey(), $expiry );
+                       $cache->set( $memcKey, $targetTitle->getDBkey(), $expiry, $opts );
 
                        return $targetTitle;
                } else {
-                       $cache->set( $memcKey, '', $expiry );
+                       $cache->set( $memcKey, '', $expiry, $opts );
 
                        return false;
                }