MediaWiki REL1_40
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 30 of file MetadataStorageHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MetadataStorageHelper::__construct ( LocalRepo $repo)

Definition at line 34 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 46 of file MetadataStorageHelper.php.

References $file, and jsonEncode().

◆ getMetadataFromBlobStore()

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

Definition at line 110 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 148 of file MetadataStorageHelper.php.

◆ jsonEncode()

MetadataStorageHelper::jsonEncode ( $data)

Do JSON encoding with local flags.

Throw an exception if the data cannot be serialized.

Exceptions
MWException
Parameters
mixed$data
Returns
string

Definition at line 95 of file MetadataStorageHelper.php.

Referenced by getJsonMetadata().


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