Make ArchivedFile load title regardless of how constructed.
[lhc/web/wiklou.git] / includes / filerepo / file / ArchivedFile.php
index 8bf9040..effa3ee 100644 (file)
@@ -264,6 +264,9 @@ class ArchivedFile {
                        // old row, populate from key
                        $this->sha1 = LocalRepo::getHashFromKey( $this->key );
                }
+               if ( !$this->title ) {
+                       $this->title = Title::makeTitleSafe( NS_FILE, $row->fa_name );
+               }
        }
 
        /**
@@ -272,6 +275,9 @@ class ArchivedFile {
         * @return Title
         */
        public function getTitle() {
+               if ( !$this->title ) {
+                       $this->load();
+               }
                return $this->title;
        }