diff options
author | Tim Starling <tstarling@wikimedia.org> | 2024-08-28 17:28:56 +1000 |
---|---|---|
committer | Reedy <reedy@wikimedia.org> | 2024-10-29 01:51:02 +0000 |
commit | 8cdde9dcb03e33332e49aed06aa71b60ae2c9b33 (patch) | |
tree | 58c5f2100c3a20577562cb2bff894f1e813f45fe /includes/libs/filebackend/FileBackend.php | |
parent | fbc8c4fe7fa167cf116cb537bb5a585abc81a15f (diff) | |
download | mediawikicore-8cdde9dcb03e33332e49aed06aa71b60ae2c9b33.tar.gz mediawikicore-8cdde9dcb03e33332e49aed06aa71b60ae2c9b33.zip |
FileRepo: Add support for the new Shellbox large file feature
* Add FileBackend::addShellboxInputFile(), allowing Shellbox to read
directly from a FileBackend. Add generic, FS and Swift
implementations.
* Add FileRepo wrapper, which takes a FileRepo virtual URL.
* Add File::addToShellboxCommand(), which allows a File to be used as
input in a Shellbox command.
* Add configuration.
* Extend FileBackend::getFileHttpUrl(), adding method and ipRange
parameters. Unindent existing code.
I was going to add support for PUT requests, but I reverted it due to
the impossibility of supporting FileBackendMultiWrite. I left the method
parameter in getFileHttpUrl().
Bug: T292322
Change-Id: If9487a0c9586065bf044b69ac04cc7a06b6e8856
Diffstat (limited to 'includes/libs/filebackend/FileBackend.php')
-rw-r--r-- | includes/libs/filebackend/FileBackend.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index 42fa91d103e1..be8dd15f4787 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -39,6 +39,7 @@ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use ScopedLock; +use Shellbox\Command\BoxedCommand; use StatusValue; use Wikimedia\FileBackend\FSFile\FSFile; use Wikimedia\FileBackend\FSFile\TempFSFile; @@ -1249,14 +1250,31 @@ abstract class FileBackend implements LoggerAwareInterface { * @see FileBackend::TEMPURL_ERROR * * @param array $params Parameters include: - * - src : source storage path - * - ttl : lifetime (seconds) if pre-authenticated; default is 1 day + * - src : source storage path + * - ttl : lifetime (seconds) if pre-authenticated; default is 1 day + * - latest : use the latest available data + * - method : the allowed method; default GET + * - ipRange : the allowed IP range; default unlimited * @return string|null URL or null (not supported or I/O error) * @since 1.21 */ abstract public function getFileHttpUrl( array $params ); /** + * Add a file to a Shellbox command as an input file. + * + * @param BoxedCommand $command + * @param string $boxedName + * @param array $params Parameters include: + * - src : source storage path + * - latest : use the latest available data + * @return StatusValue + * @since 1.43 + */ + abstract public function addShellboxInputFile( BoxedCommand $command, string $boxedName, + array $params ); + + /** * Check if a directory exists at a given storage path * * For backends using key/value stores, a directory is said to exist whenever |