X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fexternalstore%2FExternalStoreMwstore.php;h=b05843c4c888e319d90a3875e059e28e5bb3c853;hp=89ac7345173aef973a2ac0d5023867f56a468c07;hb=64b83bdb3afd0ee4f8fc1893a865409c198e601e;hpb=b2645d82849ca74b0e6b8df6a3e28e81d0561a58 diff --git a/includes/externalstore/ExternalStoreMwstore.php b/includes/externalstore/ExternalStoreMwstore.php index 89ac734517..b05843c4c8 100644 --- a/includes/externalstore/ExternalStoreMwstore.php +++ b/includes/externalstore/ExternalStoreMwstore.php @@ -41,7 +41,7 @@ class ExternalStoreMwstore extends ExternalStoreMedium { if ( $be instanceof FileBackend ) { // We don't need "latest" since objects are immutable and // backends should at least have "read-after-create" consistency. - return $be->getFileContents( array( 'src' => $url ) ); + return $be->getFileContents( [ 'src' => $url ] ); } return false; @@ -55,17 +55,17 @@ class ExternalStoreMwstore extends ExternalStoreMedium { * @return array A map from url to stored content. Failed results are not represented. */ public function batchFetchFromURLs( array $urls ) { - $pathsByBackend = array(); + $pathsByBackend = []; foreach ( $urls as $url ) { $be = FileBackendGroup::singleton()->backendFromPath( $url ); if ( $be instanceof FileBackend ) { $pathsByBackend[$be->getName()][] = $url; } } - $blobs = array(); + $blobs = []; foreach ( $pathsByBackend as $backendName => $paths ) { $be = FileBackendGroup::singleton()->get( $backendName ); - $blobs = $blobs + $be->getFileContentsMulti( array( 'srcs' => $paths ) ); + $blobs = $blobs + $be->getFileContentsMulti( [ 'srcs' => $paths ] ); } return $blobs; @@ -78,7 +78,7 @@ class ExternalStoreMwstore extends ExternalStoreMedium { $be = FileBackendGroup::singleton()->get( $backend ); if ( $be instanceof FileBackend ) { // Get three random base 36 characters to act as shard directories - $rand = wfBaseConvert( mt_rand( 0, 46655 ), 10, 36, 3 ); + $rand = Wikimedia\base_convert( mt_rand( 0, 46655 ), 10, 36, 3 ); // Make sure ID is roughly lexicographically increasing for performance $id = str_pad( UIDGenerator::newTimestampedUID128( 32 ), 26, '0', STR_PAD_LEFT ); // Segregate items by wiki ID for the sake of bookkeeping @@ -89,8 +89,8 @@ class ExternalStoreMwstore extends ExternalStoreMedium { ? "/{$rand[0]}/{$rand[1]}/{$rand[2]}/{$id}" // keep directories small : "/{$rand[0]}/{$rand[1]}/{$id}"; // container sharding is only 2-levels - $be->prepare( array( 'dir' => dirname( $url ), 'noAccess' => 1, 'noListing' => 1 ) ); - if ( $be->create( array( 'dst' => $url, 'content' => $data ) )->isOK() ) { + $be->prepare( [ 'dir' => dirname( $url ), 'noAccess' => 1, 'noListing' => 1 ] ); + if ( $be->create( [ 'dst' => $url, 'content' => $data ] )->isOK() ) { return $url; } }