Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5310300
timestamp-urls.patch
NicJansma (Nic Jansma)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
NicJansma
Jan 19 2017, 3:45 AM
2017-01-19 03:45:09 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
timestamp-urls.patch
View Options
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -8460,6 +8460,11 @@ $wgCSPFalsePositiveUrls = [
'https://d5p.de17a.com' => true,
];
++/**
+ * For local file store use filetimestamp in the URLs to allow infinite expiration
+ */
+$wgAppendTimeStampToFileUrls = false;
+
/**
* For really cool vim folding this needs to be at the end:
* vim: foldmarker=@{,@} foldmethod=marker
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index c1d5573..ae8f65c 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -345,12 +345,22 @@ abstract class File implements IDBAccessObject {
* @return string
*/
public function getUrl() {
+ global $wgAppendTimeStampToFileUrls;
+
if ( !isset( $this->url ) ) {
$this->assertRepoDefined();
$ext = $this->getExtension();
$this->url = $this->repo->getZoneUrl( 'public', $ext ) . '/' . $this->getUrlRel();
}
+ if ($wgAppendTimeStampToFileUrls) {
+ $timestamp = $this->getTimestamp();
+
+ if ($timestamp) {
+ return $this->url . '?timestamp=' . $timestamp;
+ }
+ }
+
return $this->url;
}
@@ -1690,6 +1700,16 @@ abstract class File implements IDBAccessObject {
* @return string Path
*/
function getThumbUrl( $suffix = false ) {
+ global $wgAppendTimeStampToFileUrls;
+
+ if ($wgAppendTimeStampToFileUrls) {
+ $timestamp = $this->getTimestamp();
+
+ if ($timestamp) {
+ return $this->getZoneUrl( 'thumb', $suffix ) . '?timestamp=' . $timestamp;
+ }
+ }
+
return $this->getZoneUrl( 'thumb', $suffix );
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4278863
Default Alt Text
timestamp-urls.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