Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Dumpers\JsonDumpGenerator Class Reference

JsonDumpGenerator generates an JSON dump of a given set of entities, excluding redirects. More...

+ Inheritance diagram for Wikibase\Repo\Dumpers\JsonDumpGenerator:
+ Collaboration diagram for Wikibase\Repo\Dumpers\JsonDumpGenerator:

Public Member Functions

 __construct ( $out, EntityRevisionLookup $lookup, Serializer $entitySerializer, EntityPrefetcher $entityPrefetcher, PropertyDataTypeLookup $dataTypeLookup, EntityIdParser $entityIdParser, EntityTitleStoreLookup $entityTitleStoreLookup)
 
 encode ( $data)
 Encodes the given data as JSON.
 
 setUseSnippets (bool $useSnippets)
 
 setAddPageMetadata (bool $addPageMetadata)
 
 setJsonFlags (int $jsonFlags)
 Flags to use with json_encode as a bit field, see PHP's JSON_XXX constants.
 
 getJsonFlags ()
 
- Public Member Functions inherited from Wikibase\Repo\Dumpers\DumpGenerator
 __construct ( $out, EntityPrefetcher $entityPrefetcher)
 
 setLimit (int $limit)
 Set maximum number of entities produced.
 
 setBatchSize (int $batchSize)
 Sets the batch size for processing.
 
 setProgressReporter (MessageReporter $progressReporter)
 
 setExceptionHandler (ExceptionHandler $exceptionHandler)
 
 setShardingFilter ( $shardingFactor, $shard)
 Set the sharding factor and desired shard.
 
 setEntityTypesFilter (?array $types)
 Set the entity types to be included in the output.
 
 setBatchCallback (callable $callback)
 Set a callback that is called once per batch, at the beginning of each batch.
 
 generateDump (EntityIdPager $idPager)
 Generates a dump, writing to the file handle provided to the constructor.
 

Protected Member Functions

 preDump ()
 Do something before dumping data.
 
 postDump ()
 Do something after dumping data.
 
 preEntityDump (int $dumpCount)
 Do something before dumping entity.
 
 generateDumpForEntityId (EntityId $entityId)
 
- Protected Member Functions inherited from Wikibase\Repo\Dumpers\DumpGenerator
 writeToDump (string $data)
 Writers the given string to the output provided to the constructor.
 
 preBatchDump (array $entities)
 Do something before dumping a batch of entities.
 
 postEntityDump (int $dumpCount)
 Do something after dumping entity.
 

Private Attributes

int $jsonFlags = 0
 
Serializer $entitySerializer
 
EntityRevisionLookup $entityLookup
 
EntityTitleStoreLookup $entityTitleStoreLookup
 
bool $useSnippets = false
 
bool $addPageMetadata = false
 
JsonDataTypeInjector $dataTypeInjector
 
AddPageInfo $addPageInfo
 

Additional Inherited Members

- Protected Attributes inherited from Wikibase\Repo\Dumpers\DumpGenerator
int $batchSize = 100
 
 $out
 
int $shardingFactor = 1
 
int $shard = 0
 
MessageReporter $progressReporter
 
ExceptionHandler $exceptionHandler
 
EntityPrefetcher $entityPrefetcher
 
array $entityTypes = null
 
int $limit = 0
 Entity count limit - dump will generate this many.
 

Detailed Description

JsonDumpGenerator generates an JSON dump of a given set of entities, excluding redirects.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Dumpers\JsonDumpGenerator::__construct ( $out,
EntityRevisionLookup $lookup,
Serializer $entitySerializer,
EntityPrefetcher $entityPrefetcher,
PropertyDataTypeLookup $dataTypeLookup,
EntityIdParser $entityIdParser,
EntityTitleStoreLookup $entityTitleStoreLookup )
Parameters
resource$out
EntityRevisionLookup$lookup
Serializer$entitySerializer
EntityPrefetcher$entityPrefetcher
PropertyDataTypeLookup$dataTypeLookup
EntityIdParser$entityIdParser
EntityTitleStoreLookup$entityTitleStoreLookup
Exceptions
InvalidArgumentException

Member Function Documentation

◆ encode()

Wikibase\Repo\Dumpers\JsonDumpGenerator::encode ( $data)

Encodes the given data as JSON.

Parameters
mixed$data
Exceptions
StorageException

◆ generateDumpForEntityId()

Wikibase\Repo\Dumpers\JsonDumpGenerator::generateDumpForEntityId ( EntityId $entityId)
protected
Exceptions
EntityLookupException
StorageException

Reimplemented from Wikibase\Repo\Dumpers\DumpGenerator.

◆ getJsonFlags()

Wikibase\Repo\Dumpers\JsonDumpGenerator::getJsonFlags ( )
See also
setJsonFlags

◆ postDump()

Wikibase\Repo\Dumpers\JsonDumpGenerator::postDump ( )
protected

Do something after dumping data.

Reimplemented from Wikibase\Repo\Dumpers\DumpGenerator.

◆ preDump()

Wikibase\Repo\Dumpers\JsonDumpGenerator::preDump ( )
protected

Do something before dumping data.

Reimplemented from Wikibase\Repo\Dumpers\DumpGenerator.

◆ preEntityDump()

Wikibase\Repo\Dumpers\JsonDumpGenerator::preEntityDump ( int $dumpCount)
protected

Do something before dumping entity.

Reimplemented from Wikibase\Repo\Dumpers\DumpGenerator.

◆ setAddPageMetadata()

Wikibase\Repo\Dumpers\JsonDumpGenerator::setAddPageMetadata ( bool $addPageMetadata)
Parameters
bool$addPageMetadataWhether to add page metadata to entities

◆ setJsonFlags()

Wikibase\Repo\Dumpers\JsonDumpGenerator::setJsonFlags ( int $jsonFlags)

Flags to use with json_encode as a bit field, see PHP's JSON_XXX constants.

◆ setUseSnippets()

Wikibase\Repo\Dumpers\JsonDumpGenerator::setUseSnippets ( bool $useSnippets)
Parameters
bool$useSnippetsWhether to output valid json (false) or only comma separated entities

Member Data Documentation

◆ $addPageInfo

AddPageInfo Wikibase\Repo\Dumpers\JsonDumpGenerator::$addPageInfo
private

◆ $addPageMetadata

bool Wikibase\Repo\Dumpers\JsonDumpGenerator::$addPageMetadata = false
private

◆ $dataTypeInjector

JsonDataTypeInjector Wikibase\Repo\Dumpers\JsonDumpGenerator::$dataTypeInjector
private

◆ $entityLookup

EntityRevisionLookup Wikibase\Repo\Dumpers\JsonDumpGenerator::$entityLookup
private

◆ $entitySerializer

Serializer Wikibase\Repo\Dumpers\JsonDumpGenerator::$entitySerializer
private

◆ $entityTitleStoreLookup

EntityTitleStoreLookup Wikibase\Repo\Dumpers\JsonDumpGenerator::$entityTitleStoreLookup
private

◆ $jsonFlags

int Wikibase\Repo\Dumpers\JsonDumpGenerator::$jsonFlags = 0
private

◆ $useSnippets

bool Wikibase\Repo\Dumpers\JsonDumpGenerator::$useSnippets = false
private

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