Page MenuHomePhabricator

image_timestamp.patch

Authored By
bzimport
Nov 21 2014, 10:33 PM
Size
1 KB
Referenced Files
None
Subscribers
None

image_timestamp.patch

Index: includes/filerepo/File.php
===================================================================
--- includes/filerepo/File.php (revision 47293)
+++ includes/filerepo/File.php (working copy)
@@ -167,9 +167,18 @@
* Return the URL of the file
*/
public function getUrl() {
+ global $wgAppendTimeStampToFileUrls;
+
if ( !isset( $this->url ) ) {
$this->url = $this->repo->getZoneUrl( 'public' ) . '/' . $this->getUrlRel();
}
+
+ $timestamp = $this->getTimestamp();
+ if ($wgAppendTimeStampToFileUrls && $timestamp)
+ {
+ return $this->url . '?timestamp=' . $timestamp;
+ }
+
return $this->url;
}
@@ -778,10 +787,19 @@
/** Get the URL of the thumbnail directory, or a particular file if $suffix is specified */
function getThumbUrl( $suffix = false ) {
+ global $wgAppendTimeStampToFileUrls;
+
$path = $this->repo->getZoneUrl('public') . '/thumb/' . $this->getUrlRel();
if ( $suffix !== false ) {
$path .= '/' . rawurlencode( $suffix );
}
+
+ $timestamp = $this->getTimestamp();
+ if ($wgAppendTimeStampToFileUrls && $timestamp)
+ {
+ return $path . '?timestamp=' . $timestamp;
+ }
+
return $path;
}
Index: includes/DefaultSettings.php
===================================================================
--- includes/DefaultSettings.php (revision 47293)
+++ includes/DefaultSettings.php (working copy)
@@ -3638,3 +3638,8 @@
* and the functionality will be enabled universally.
*/
$wgEnforceHtmlIds = true;
+
+/**
+ * For local file store use filetimestamp in the URLs to allow infinite expiration
+ */
+$wgAppendTimeStampToFileUrls = false;

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5114
Default Alt Text
image_timestamp.patch (1 KB)

Event Timeline