46 return $be->getFileContents( [
'src' => $url ] );
61 foreach (
$urls as $url ) {
64 $pathsByBackend[$be->getName()][] = $url;
68 foreach ( $pathsByBackend as $backendName => $paths ) {
70 $blobs = $blobs + $be->getFileContentsMulti( [
'srcs' => $paths ] );
76 public function store( $backend, $data ) {
80 $rand = Wikimedia\base_convert( mt_rand( 0, 46655 ), 10, 36, 3 );
84 $wiki = isset( $this->params[
'wiki'] ) ? $this->params[
'wiki'] :
wfWikiID();
86 $url = $be->getContainerStoragePath(
'data' ) .
'/' . rawurlencode( $wiki );
88 ?
"/{$rand[0]}/{$rand[1]}/{$rand[2]}/{$id}"
89 :
"/{$rand[0]}/{$rand[1]}/{$id}";
91 $be->prepare( [
'dir' => dirname( $url ),
'noAccess' => 1,
'noListing' => 1 ] );
92 if ( $be->create( [
'dst' => $url,
'content' => $data ] )->isOK() ) {
103 return $be ? $be->isReadOnly() :
false;
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Accessable external objects in a particular storage medium.
File backend accessible external objects.
batchFetchFromURLs(array $urls)
Fetch data from given external store URLs.
isReadOnly( $backend)
Check if a given location is read-only.
store( $backend, $data)
Insert a data item into a given location.
fetchFromURL( $url)
The URL returned is of the form of the form mwstore://backend/container/wiki/id.
Class for a file system (FS) based file backend.
Base class for all file backend classes (including multi-write backends).
static newTimestampedUID128( $base=10)
Get a statistically unique 128-bit unsigned integer ID string.