* Added getFileVersion()/setFileVersion() functions to OutputPage
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 5 Jul 2011 05:23:26 +0000 (05:23 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 5 Jul 2011 05:23:26 +0000 (05:23 +0000)
* Removed getDisplayedFile() from FlaggedPage and simplified getFile()
* Cleaned up getIncludeParams() to just do formatting
* Made template/file IDs mandatory for RevisionReviewFormUI

includes/ImagePage.php
includes/OutputPage.php

index bd0c8f0..a461c4e 100644 (file)
@@ -474,6 +474,7 @@ EOT
                                $wgRequest->response()->header( 'HTTP/1.1 404 Not Found' );
                        }
                }
+               $wgOut->setFileVersion( $this->displayImg );
        }
 
        /**
index e43c214..808676a 100644 (file)
@@ -190,6 +190,8 @@ class OutputPage {
        /// should be private. To include the variable {{REVISIONID}}
        var $mRevisionId = null;
 
+       var $mFileVersion = null;
+
        private $mContext;
 
        /**
@@ -1290,7 +1292,7 @@ class OutputPage {
        }
 
        /**
-        * Get the current revision ID
+        * Get the displayed revision ID
         *
         * @return Integer
         */
@@ -1298,6 +1300,28 @@ class OutputPage {
                return $this->mRevisionId;
        }
 
+       /**
+        * Set the displayed file version
+        *
+        * @param $file File|false
+        * @return Mixed: previous value
+        */
+       public function setFileVersion( $file ) {
+               if ( $file instanceof File && $file->exists() ) {
+                       $val = array( 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() );
+               }
+               return wfSetVar( $this->mFileVersion, $val );
+       }
+
+       /**
+        * Get the displayed file version
+        *
+        * @return Array|null ('time' => MW timestamp, 'sha1' => sha1)
+        */
+       public function getFileVersion() {
+               return $this->mFileVersion;
+       }
+
        /**
         * Get the templates used on this page
         *