PHP 클래스 VersionPress\Synchronizers\Synchronizer

Synchronizer does work that is kind of opposite to the ones of storages but with one major difference: while storages usually add or delete entities one by one or by small amounts, synchronizer usually operates over all entities or some subset (see $entitiesToSynchronize). Synchronizers are run by the {@link VersionPress\Synchronizers\SynchronizationProcess}.
파일 보기 프로젝트 열기: versionpress/versionpress 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$database VersionPress\Database\Database
$entities array | null

공개 메소드들

메소드 설명
__construct ( Storage $storage, Database $database, EntityInfo $entityInfo, DbSchemaInfo $dbSchemaInfo, VpidRepository $vpidRepository, AbsoluteUrlReplacer $urlReplacer, ShortcodesReplacer $shortcodesReplacer, TableSchemaStorage $tableSchemaStorage )
reset ( ) Resets values persisted for the multipass processing.
synchronize ( string $task, array $entitiesToSynchronize = null ) : string[] Synchronizes entities from storage to the database. It generally only works with tracked entities, i.e. the ignored (untracked) rows in the database are left untouched. The rows corresponding to tracked entities are usually in sync with the storage after this method is done. It may happen that the synchronizer cannot synchronize everything in the first pass. Because of this, the synchronize method takes a task for sychronization (usually "everything" for the first pass) and returns a list of tasks that aren't done yet. It's up to the SynchronizationProcess to call the synchronize method again with this tasks when the previous pass is done.

보호된 메소드들

메소드 설명
buildCreateQuery ( $entity )
computeColumnValues ( ) Specific entities might contain ignored colums, which values should be computed on synchronizing process e.g. posts.

비공개 메소드들

메소드 설명
addOrUpdateEntities ( )
buildUpdateQuery ( $updateData )
buildUpdateQueryForEntityWithGeneratedVpid ( $updateData )
buildUpdateQueryForEntityWithNaturalVpid ( $updateData )
cleanCache ( ) Cleans caches specified in schema.yml.
createEntityInDatabase ( $entity )
createIdentifierRecord ( $vpid, $id )
createTable ( ) --------------------------------------
deleteEntitiesWhichAreNotInStorage ( )
entityContainsComputedValues ( )
existsInDatabase ( $vpid )
fixMnReferences ( )
fixReferences ( ) --------------------------------------
getAllVpIdsUsedInReferences ( $referencesToSave ) : array
getExistingMnReferences ( ) : array
getIdsForVpIds ( $referencesToUpdate )
idMapContainsAllVpIds ( $idMap, $vpIds )
loadEntitiesFromStorage ( ) : array Loads entities from storage. For full synchronization it loads all entities. For selective synchronization it loads only entities from $this->entitiesToSynchronize.
maybeInit ( )
maybeStripMetaEntities ( array $entities ) : array Strips meta entities from their parents. Called after entities have been loaded from storage.
restoreShortcodesInAllEntities ( )
updateDatabase ( ) Adds, updates and deletes rows in the database
updateEntityInDatabase ( $entity )

메소드 상세

__construct() 공개 메소드

public __construct ( Storage $storage, Database $database, EntityInfo $entityInfo, DbSchemaInfo $dbSchemaInfo, VpidRepository $vpidRepository, AbsoluteUrlReplacer $urlReplacer, ShortcodesReplacer $shortcodesReplacer, TableSchemaStorage $tableSchemaStorage )
$storage VersionPress\Storages\Storage Specific Synchronizers will use specific storage types, see SynchronizerFactory
$database VersionPress\Database\Database
$entityInfo VersionPress\Database\EntityInfo
$dbSchemaInfo VersionPress\Database\DbSchemaInfo
$vpidRepository VersionPress\Database\VpidRepository
$urlReplacer VersionPress\Utils\AbsoluteUrlReplacer
$shortcodesReplacer VersionPress\Database\ShortcodesReplacer
$tableSchemaStorage VersionPress\Database\TableSchemaStorage

buildCreateQuery() 보호된 메소드

protected buildCreateQuery ( $entity )

computeColumnValues() 보호된 메소드

Specific entities might contain ignored colums, which values should be computed on synchronizing process e.g. posts.
protected computeColumnValues ( )

reset() 공개 메소드

Useful for tests.
public reset ( )

synchronize() 공개 메소드

If the $entitiesToSynchronize is null, the synchronizer will synchronize all entities. If it's an array, the synchronizer will synchronize only those entities.
public synchronize ( string $task, array $entitiesToSynchronize = null ) : string[]
$task string
$entitiesToSynchronize array List of VPIDs and their possible parents {@see \SynchronizationProcess::synchronize()}
리턴 string[]

프로퍼티 상세

$database 보호되어 있는 프로퍼티

protected Database,VersionPress\Database $database
리턴 VersionPress\Database\Database

$entities 보호되어 있는 프로퍼티

protected array|null $entities
리턴 array | null