PHP 클래스 VersionPress\Storages\Storage

파일 보기 프로젝트 열기: versionpress/versionpress 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$ignoreFrequentlyWrittenEntities boolean

보호된 프로퍼티들

프로퍼티 타입 설명
$entityInfo VersionPress\Database\EntityInfo
$isTransaction boolean

공개 메소드들

메소드 설명
__construct ( EntityInfo $entityInfo, $dbPrefix )
commit ( ) Transfers data from memory (saved by Storage::saveLater()) to the files.
delete ( array $restriction ) : VersionPress\ChangeInfos\ChangeInfo | null Deletes entity from a storage
exists ( string $id, string | null $parentId ) : boolean Returns true if the entity exists.
getEntityFilename ( string $id, string | null $parentId ) : string Returns a physical path to an INI file where the entity is stored
getPathCommonToAllEntities ( )
loadAll ( ) : array[] Loads all entities managed by this storage
loadEntity ( string $id, string $parentId ) : array Load an entity by given VPID
prepareStorage ( ) Called from {@link VersionPress\Initialization\Initializer} to give storage a chance to prepare itself.
save ( array $data ) : VersionPress\ChangeInfos\ChangeInfo | null Saves data to a storage
saveLater ( array $data ) Saves data only in memory (used during initialization).
shouldBeSaved ( array $data ) : boolean True / false if the entity should be saved / ignored. Works as a filtering method.

보호된 메소드들

메소드 설명
deserializeEntity ( $serializedEntity )
maybeReplacePlaceholderWithPrefix ( $key )
maybeReplacePrefixWithPlaceholder ( $key )
serializeEntity ( $vpid, $entity )

비공개 메소드들

메소드 설명
flattenEntity ( $entity )

메소드 상세

__construct() 공개 메소드

public __construct ( EntityInfo $entityInfo, $dbPrefix )
$entityInfo VersionPress\Database\EntityInfo

commit() 추상적인 공개 메소드

Transfers data from memory (saved by Storage::saveLater()) to the files.
abstract public commit ( )

delete() 추상적인 공개 메소드

Deletes entity from a storage
abstract public delete ( array $restriction ) : VersionPress\ChangeInfos\ChangeInfo | null
$restriction array An array that typically contains a 'vp_id' key that specifies which entity to delete
리턴 VersionPress\ChangeInfos\ChangeInfo | null Null indicates that no actual delete happened (for example, the INI file for a given VPID didn't exist). Otherwise, the ChangeInfo object is returned (its action is usually 'delete').

deserializeEntity() 보호된 메소드

protected deserializeEntity ( $serializedEntity )

exists() 추상적인 공개 메소드

Returns true if the entity exists.
abstract public exists ( string $id, string | null $parentId ) : boolean
$id string VPID
$parentId string | null VPID of parent entity (for example post for postmeta)
리턴 boolean

getEntityFilename() 추상적인 공개 메소드

Returns a physical path to an INI file where the entity is stored
abstract public getEntityFilename ( string $id, string | null $parentId ) : string
$id string VPID
$parentId string | null VPID of parent entity (for example post for postmeta)
리턴 string

getPathCommonToAllEntities() 추상적인 공개 메소드

abstract public getPathCommonToAllEntities ( )

loadAll() 추상적인 공개 메소드

Loads all entities managed by this storage
abstract public loadAll ( ) : array[]
리턴 array[] Array of arrays where keys are VPIDs and values are arrays with entity data

loadEntity() 추상적인 공개 메소드

Load an entity by given VPID
abstract public loadEntity ( string $id, string $parentId ) : array
$id string VPID
$parentId string VPID of parent entity (for example post for postmeta)
리턴 array Array representing an entity

maybeReplacePlaceholderWithPrefix() 보호된 메소드

maybeReplacePrefixWithPlaceholder() 보호된 메소드

prepareStorage() 추상적인 공개 메소드

For example, directory storage uses this to create its folder. Note: consider if this method needs to be here
abstract public prepareStorage ( )

save() 추상적인 공개 메소드

Saves data to a storage
abstract public save ( array $data ) : VersionPress\ChangeInfos\ChangeInfo | null
$data array Associative array with values to save. On `insert`, the $data will contain full entity data plus things like VPID. On further updates, the data will typically contain just the updated values and a VPID (assigned in {@link VersionPress\Database\WpdbMirrorBridge} so that the appropriate file could be located).
리턴 VersionPress\ChangeInfos\ChangeInfo | null Null indicates that the save operation didn't really change anything (may happen). Otherwise, the ChangeInfo object is returned.

saveLater() 추상적인 공개 메소드

Saves data only in memory (used during initialization).
abstract public saveLater ( array $data )
$data array {@see \Storage::save()}

serializeEntity() 보호된 메소드

protected serializeEntity ( $vpid, $entity )

shouldBeSaved() 공개 메소드

True / false if the entity should be saved / ignored. Works as a filtering method.
public shouldBeSaved ( array $data ) : boolean
$data array
리턴 boolean

프로퍼티 상세

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

protected EntityInfo,VersionPress\Database $entityInfo
리턴 VersionPress\Database\EntityInfo

$ignoreFrequentlyWrittenEntities 공개적으로 프로퍼티

public bool $ignoreFrequentlyWrittenEntities
리턴 boolean

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

protected bool $isTransaction
리턴 boolean