From: Aaron Schulz Date: Tue, 5 Jul 2011 05:23:26 +0000 (+0000) Subject: * Added getFileVersion()/setFileVersion() functions to OutputPage X-Git-Tag: 1.31.0-rc.0~29070 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=52968965e3abcac744f5ff3720e32ec8c947fbff;p=lhc%2Fweb%2Fwiklou.git * Added getFileVersion()/setFileVersion() functions to OutputPage * Removed getDisplayedFile() from FlaggedPage and simplified getFile() * Cleaned up getIncludeParams() to just do formatting * Made template/file IDs mandatory for RevisionReviewFormUI --- diff --git a/includes/ImagePage.php b/includes/ImagePage.php index bd0c8f0220..a461c4e64e 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -474,6 +474,7 @@ EOT $wgRequest->response()->header( 'HTTP/1.1 404 Not Found' ); } } + $wgOut->setFileVersion( $this->displayImg ); } /** diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e43c214957..808676a5e7 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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 *