Wikibase
MediaWiki Wikibase extension
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. More...
 
 setUseSnippets ( $useSnippets)
 
 setAddPageMetadata ( $addPageMetadata)
 
 setJsonFlags ( $jsonFlags)
 Flags to use with json_encode as a bit field, see PHP's JSON_XXX constants. More...
 
 getJsonFlags ()
 
- Public Member Functions inherited from Wikibase\Repo\Dumpers\DumpGenerator
 __construct ( $out, EntityPrefetcher $entityPrefetcher)
 
 setLimit ( $limit)
 Set maximum number of entities produced. More...
 
 setBatchSize ( $batchSize)
 Sets the batch size for processing. More...
 
 setProgressReporter (MessageReporter $progressReporter)
 
 setExceptionHandler (ExceptionHandler $exceptionHandler)
 
 setShardingFilter ( $shardingFactor, $shard)
 Set the sharding factor and desired shard. More...
 
 setEntityTypesFilter ( $types)
 Set the entity types to be included in the output. More...
 
 generateDump (EntityIdPager $idPager)
 Generates a dump, writing to the file handle provided to the constructor. More...
 

Protected Member Functions

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

Private Attributes

 $jsonFlags = 0
 
 $entitySerializer
 
 $entityLookup
 
 $entityTitleStoreLookup
 
 $useSnippets = false
 
 $addPageMetadata = false
 
 $dataTypeInjector
 
 $addPageInfo
 

Additional Inherited Members

- Protected Attributes inherited from Wikibase\Repo\Dumpers\DumpGenerator
 $batchSize = 100
 
 $out
 
 $shardingFactor = 1
 
 $shard = 0
 
 $progressReporter
 
 $exceptionHandler
 
 $entityPrefetcher
 
 $entityTypes
 
 $limit = 0
 

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
Returns
string
Exceptions
MWException

◆ generateDumpForEntityId()

Wikibase\Repo\Dumpers\JsonDumpGenerator::generateDumpForEntityId ( EntityId  $entityId)
protected
Parameters
EntityId$entityId
Exceptions
EntityLookupException
StorageException
Returns
string|null

Reimplemented from Wikibase\Repo\Dumpers\DumpGenerator.

◆ getJsonFlags()

Wikibase\Repo\Dumpers\JsonDumpGenerator::getJsonFlags ( )
Returns
int
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 (   $dumpCount)
protected

Do something before dumping entity.

Parameters
int$dumpCount

Reimplemented from Wikibase\Repo\Dumpers\DumpGenerator.

◆ setAddPageMetadata()

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

◆ setJsonFlags()

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

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

Parameters
int$jsonFlags

◆ setUseSnippets()

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

Member Data Documentation

◆ $addPageInfo

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

◆ $addPageMetadata

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

◆ $dataTypeInjector

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

◆ $entityLookup

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

◆ $entitySerializer

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

◆ $entityTitleStoreLookup

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

◆ $jsonFlags

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

◆ $useSnippets

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

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