MediaWiki master
MetadataStorageHelper Class Reference

Helper for storage of metadata. More...

Public Member Functions

 __construct (LocalRepo $repo)
 
 getJsonMetadata ( $file, $envelope)
 Get metadata in JSON format ready for DB insertion, optionally splitting items out to BlobStore.
 
 getMetadataFromBlobStore (array $addresses)
 
 jsonDecode (string $s)
 Do JSON decoding with local flags.
 
 jsonEncode ( $data)
 Do JSON encoding with local flags.
 

Detailed Description

Helper for storage of metadata.

Sharing the code between LocalFile and ArchivedFile

Access: internal

Definition at line 31 of file MetadataStorageHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MetadataStorageHelper::__construct ( LocalRepo $repo)

Definition at line 35 of file MetadataStorageHelper.php.

Member Function Documentation

◆ getJsonMetadata()

MetadataStorageHelper::getJsonMetadata ( $file,
$envelope )

Get metadata in JSON format ready for DB insertion, optionally splitting items out to BlobStore.

Parameters
LocalFile | ArchivedFile$file
array$envelope
Returns
array

Definition at line 47 of file MetadataStorageHelper.php.

References jsonEncode().

◆ getMetadataFromBlobStore()

MetadataStorageHelper::getMetadataFromBlobStore ( array $addresses)
Parameters
array$addresses
Returns
array

Definition at line 109 of file MetadataStorageHelper.php.

◆ jsonDecode()

MetadataStorageHelper::jsonDecode ( string $s)

Do JSON decoding with local flags.

This doesn't use JsonCodec because JsonCodec can construct objects, which we don't want.

Does not throw. Returns false on failure.

Parameters
string$s
Returns
mixed The decoded value, or false on failure

Definition at line 147 of file MetadataStorageHelper.php.

◆ jsonEncode()

MetadataStorageHelper::jsonEncode ( $data)

Do JSON encoding with local flags.

Callers must make sure that the data can be serialized.

Parameters
mixed$data
Returns
string

Definition at line 94 of file MetadataStorageHelper.php.

Referenced by getJsonMetadata().


The documentation for this class was generated from the following file: