Removed old HTMLCacheUpdateJob b/c code
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index 47be4d2..699c915 100644 (file)
@@ -109,6 +109,9 @@ class LocalFile extends File {
        /** @var string Description of current revision of the file */
        private $description;
 
+       /** @var string TS_MW timestamp of the last change of the file description */
+       private $descriptionTouched;
+
        /** @var bool Whether the row was upgraded on load */
        private $upgraded;
 
@@ -278,7 +281,6 @@ class LocalFile extends File {
                        wfIncrStats( 'image_cache_miss' );
                }
 
-
                return $this->dataLoaded;
        }
 
@@ -1444,7 +1446,6 @@ class LocalFile extends File {
                        $dbw->commit( __METHOD__ ); // commit before anything bad can happen
                }
 
-
                if ( $reupload ) {
                        # Delete old thumbnails
                        $this->purgeThumbnails();
@@ -1463,7 +1464,6 @@ class LocalFile extends File {
                        LinksUpdate::queueRecursiveJobsForTable( $this->getTitle(), 'imagelinks' );
                }
 
-
                return true;
        }
 
@@ -1780,6 +1780,22 @@ class LocalFile extends File {
                return $this->timestamp;
        }
 
+       /**
+        * @return bool|string
+        */
+       public function getDescriptionTouched() {
+               // The DB lookup might return false, e.g. if the file was just deleted, or the shared DB repo
+               // itself gets it from elsewhere. To avoid repeating the DB lookups in such a case, we
+               // need to differentiate between null (uninitialized) and false (failed to load).
+               if ( $this->descriptionTouched === null ) {
+                       $cond = array( 'page_namespace' => $this->title->getNamespace(), 'page_title' => $this->title->getDBkey() );
+                       $touched = $this->repo->getSlaveDB()->selectField( 'page', 'page_touched', $cond, __METHOD__ );
+                       $this->descriptionTouched = $touched ? wfTimestamp( TS_MW, $touched ) : false;
+               }
+
+               return $this->descriptionTouched;
+       }
+
        /**
         * @return string
         */