Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5564
image_timestamp.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:33 PM
2014-11-21 22:33:07 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
image_timestamp.patch
View Options
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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5114
Default Alt Text
image_timestamp.patch (1 KB)
Attached To
Mode
T19577: Thumbnail urls should be versioned and sent with Expires headers
Attached
Detach File
Event Timeline
Log In to Comment