Wikibase
MediaWiki Wikibase extension
|
DumpGenerator generates a dump of a given set of entities, excluding redirects. More...
Public Member Functions | |
__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 | |
writeToDump (string $data) | |
Writers the given string to the output provided to the constructor. | |
preDump () | |
Do something before dumping data. | |
postDump () | |
Do something after dumping data. | |
preBatchDump (array $entities) | |
Do something before dumping a batch of entities. | |
preEntityDump (int $dumpCount) | |
Do something before dumping entity. | |
postEntityDump (int $dumpCount) | |
Do something after dumping entity. | |
generateDumpForEntityId (EntityId $entityId) | |
Produce dump data for specific entity. | |
Protected Attributes | |
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. | |
Private Member Functions | |
idMatchesFilters (EntityId $entityId) | |
idMatchesShard (EntityId $entityId) | |
idMatchesType (EntityId $entityId) | |
dumpEntities (array $entityIds, int &$dumpCount) | |
Dump list of entities. | |
Private Attributes | |
$batchCallback | |
DumpGenerator generates a dump of a given set of entities, excluding redirects.
Wikibase\Repo\Dumpers\DumpGenerator::__construct | ( | $out, | |
EntityPrefetcher | $entityPrefetcher ) |
resource | $out | |
EntityPrefetcher | $entityPrefetcher |
InvalidArgumentException |
|
private |
Dump list of entities.
EntityId[] | $entityIds | |
int | &$dumpCount | The number of entities already dumped (will be updated). |
Wikibase\Repo\Dumpers\DumpGenerator::generateDump | ( | EntityIdPager | $idPager | ) |
Generates a dump, writing to the file handle provided to the constructor.
|
abstractprotected |
Produce dump data for specific entity.
EntityId | $entityId |
EntityLookupException | |
StorageException |
Reimplemented in Wikibase\Repo\Dumpers\JsonDumpGenerator, and Wikibase\Repo\Dumpers\RdfDumpGenerator.
|
private |
|
private |
|
private |
|
protected |
Do something after dumping data.
Reimplemented in Wikibase\Repo\Dumpers\JsonDumpGenerator, and Wikibase\Repo\Dumpers\RdfDumpGenerator.
|
protected |
Do something after dumping entity.
|
protected |
Do something before dumping a batch of entities.
EntityId[] | $entities |
|
protected |
Do something before dumping data.
Reimplemented in Wikibase\Repo\Dumpers\JsonDumpGenerator, and Wikibase\Repo\Dumpers\RdfDumpGenerator.
|
protected |
Do something before dumping entity.
Reimplemented in Wikibase\Repo\Dumpers\JsonDumpGenerator.
Wikibase\Repo\Dumpers\DumpGenerator::setBatchCallback | ( | callable | $callback | ) |
Set a callback that is called once per batch, at the beginning of each batch.
Wikibase\Repo\Dumpers\DumpGenerator::setBatchSize | ( | int | $batchSize | ) |
Sets the batch size for processing.
The batch size is used as the limit when listing IDs via the EntityIdPager::getNextBatchOfIds() method, and also controls the interval of progress reports.
InvalidArgumentException |
Wikibase\Repo\Dumpers\DumpGenerator::setEntityTypesFilter | ( | ?array | $types | ) |
Set the entity types to be included in the output.
string[] | null | $types | The desired types (use null for any type). |
Wikibase\Repo\Dumpers\DumpGenerator::setExceptionHandler | ( | ExceptionHandler | $exceptionHandler | ) |
Wikibase\Repo\Dumpers\DumpGenerator::setLimit | ( | int | $limit | ) |
Set maximum number of entities produced.
Wikibase\Repo\Dumpers\DumpGenerator::setProgressReporter | ( | MessageReporter | $progressReporter | ) |
Wikibase\Repo\Dumpers\DumpGenerator::setShardingFilter | ( | $shardingFactor, | |
$shard ) |
Set the sharding factor and desired shard.
For instance, to generate four dumps in parallel, use setShardingFilter( 4, 0 ) for the first dump, setShardingFilter( 4, 1 ) for the second dump, etc.
int | $shardingFactor | |
int | $shard |
InvalidArgumentException |
|
protected |
Writers the given string to the output provided to the constructor.
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Entity count limit - dump will generate this many.
|
protected |
|
protected |
|
protected |
|
protected |