jenkins-bot has submitted this change and it was merged.
Change subject: [FileBackend] Added a "ttl" option to getFileHttpUrl().
......................................................................
[FileBackend] Added a "ttl" option to getFileHttpUrl().
Change-Id: Ifc7b9c012276ed1f1e436ffafbd5615689680054
---
M includes/filebackend/FileBackend.php
M includes/filebackend/SwiftFileBackend.php
2 files changed, 4 insertions(+), 2 deletions(-)
Approvals:
Reedy: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/filebackend/FileBackend.php
b/includes/filebackend/FileBackend.php
index 3ebfdb1..47bc7ac 100644
--- a/includes/filebackend/FileBackend.php
+++ b/includes/filebackend/FileBackend.php
@@ -1016,6 +1016,7 @@
* @param $params Array
* $params include:
* - src : source storage path
+ * - ttl : lifetime (seconds) if pre-authenticated; default is 1 day
* @return string|null
* @since 1.21
*/
diff --git a/includes/filebackend/SwiftFileBackend.php
b/includes/filebackend/SwiftFileBackend.php
index 9c271ea..471cd4b 100644
--- a/includes/filebackend/SwiftFileBackend.php
+++ b/includes/filebackend/SwiftFileBackend.php
@@ -1210,12 +1210,13 @@
return null; // invalid path
}
try {
+ $ttl = isset( $params['ttl'] ) ? $params['ttl']
: 86400;
$sContObj = $this->getContainer( $srcCont );
$obj = new CF_Object( $sContObj, $srcRel,
false, false ); // skip HEAD
if ( $this->swiftTempUrlKey != '' ) {
- return $obj->get_temp_url(
$this->swiftTempUrlKey, 86400, "GET" );
+ return $obj->get_temp_url(
$this->swiftTempUrlKey, $ttl, "GET" );
} else { // give S3 API URL for rgw
- $expires = time() + 86400;
+ $expires = time() + $ttl;
// Path for signature starts with the
bucket
$spath = '/' . rawurlencode( $srcCont )
. '/' .
str_replace( '%2F', '/',
rawurlencode( $srcRel ) );
--
To view, visit https://gerrit.wikimedia.org/r/52583
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc7b9c012276ed1f1e436ffafbd5615689680054
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits