52 if ( !$this->repo->isSplitMetadataEnabled()
53 || !
$file->getHandler()
54 || !
$file->getHandler()->useSplitMetadata()
58 $threshold = $this->repo->getSplitMetadataThreshold();
59 if ( !$threshold || strlen(
$s ) <= $threshold ) {
62 $blobStore = $this->repo->getBlobStore();
70 foreach ( $envelope[
'data'] as $name => $value ) {
72 if ( strlen( $encoded ) > $threshold ) {
73 $blobAddresses[$name] = $blobStore->storeBlob(
75 [ BlobStore::IMAGE_HINT =>
$file->getName() ]
80 $envelope[
'data'] = array_diff_key( $envelope[
'data'], $blobAddresses );
81 $envelope[
'blobs'] = $blobAddresses;
84 return [
$s, $blobAddresses ];
96 $s = json_encode( $data,
97 JSON_INVALID_UTF8_IGNORE |
98 JSON_UNESCAPED_SLASHES |
99 JSON_UNESCAPED_UNICODE );
100 if (
$s ===
false ) {
101 throw new MWException( __METHOD__ .
': metadata is not JSON-serializable ' );
113 $blobStore = $this->repo->getBlobStore();
115 LoggerFactory::getInstance(
'LocalFile' )->warning(
116 "Unable to load metadata: repo has no blob store" );
119 $status = $blobStore->getBlobBatch( $addresses );
120 if ( !$status->isGood() ) {
121 $msg = Status::wrap( $status )->getWikiText(
122 false,
false,
'en' );
123 LoggerFactory::getInstance(
'LocalFile' )->warning(
124 "Error loading metadata from BlobStore: $msg" );
126 foreach ( $addresses as $itemName => $address ) {
127 $json = $status->getValue()[$address] ??
null;
128 if ( $json !==
null ) {
129 $value = $this->jsonDecode( $json );
130 $result[$itemName] = $value;
150 return @json_decode(
$s,
true, 512, JSON_INVALID_UTF8_IGNORE );
Local repository that stores files in the local filesystem and registers them in the wiki's own datab...
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.