PHP Class VersionPress\Database\DbSchemaInfo

ファイルを表示 Open project: versionpress/versionpress Class Usage Examples

Public Methods

Method Description
__construct ( string[] | Traversable $schemaFiles, string $prefix, integer $dbVersion )
getAllEntityNames ( ) : array Gets all entities defined by the schema
getAllMnReferences ( )
getAllReferences ( ) : array Returns a map where key is a name of an entity and value is a list of names of referenced entities.
getEntityInfo ( $entityName ) : EntityInfo Returns EntityInfo for a given entity name (e.g., "post" or "comment")
getEntityInfoByPrefixedTableName ( $tableName ) : EntityInfo Returns EntityInfo for a given table name with prefix (e.g., "wp_posts" or "wp_commentmeta")
getEntityInfoByTableName ( $tableName ) : EntityInfo Returns EntityInfo for a given table name (e.g., "posts" or "commentmeta")
getIntervalsForFrequentlyWrittenEntities ( )
getMnReferenceDetails ( $junctionEntity )
getPrefixedTableName ( $entityName ) : string For something like "post", returns "wp_posts"
getRulesForFrequentlyWrittenEntities ( ) : array Returns all rules for frequently written entities grouped by entity name.
getTableName ( $entityName ) : string For something like "post", returns "posts"
isChildEntity ( $entityName ) : boolean Returns true if entity has a parent reference.
isEntity ( $entityName ) : boolean Returns true if given name is an entity (is defined in schema).
refreshDbSchema ( $schemaFiles )
trimPrefix ( $tableName )

Private Methods

Method Description
useSchemaForCurrentVersion ( $schema ) : array Returns valid schema for current version of WP.

Method Details

__construct() public method

public __construct ( string[] | Traversable $schemaFiles, string $prefix, integer $dbVersion )
$schemaFiles string[] | Traversable
$prefix string
$dbVersion integer WordPress DB version (global variable $wp_db_version)

getAllEntityNames() public method

Gets all entities defined by the schema
public getAllEntityNames ( ) : array
return array

getAllMnReferences() public method

public getAllMnReferences ( )

getAllReferences() public method

Returns a map where key is a name of an entity and value is a list of names of referenced entities.
public getAllReferences ( ) : array
return array

getEntityInfo() public method

Returns EntityInfo for a given entity name (e.g., "post" or "comment")
public getEntityInfo ( $entityName ) : EntityInfo
$entityName
return EntityInfo

getEntityInfoByPrefixedTableName() public method

Returns EntityInfo for a given table name with prefix (e.g., "wp_posts" or "wp_commentmeta")
public getEntityInfoByPrefixedTableName ( $tableName ) : EntityInfo
$tableName
return EntityInfo

getEntityInfoByTableName() public method

Returns EntityInfo for a given table name (e.g., "posts" or "commentmeta")
public getEntityInfoByTableName ( $tableName ) : EntityInfo
$tableName
return EntityInfo

getIntervalsForFrequentlyWrittenEntities() public method

getMnReferenceDetails() public method

public getMnReferenceDetails ( $junctionEntity )

getPrefixedTableName() public method

For something like "post", returns "wp_posts"
public getPrefixedTableName ( $entityName ) : string
$entityName
return string

getRulesForFrequentlyWrittenEntities() public method

Returns all rules for frequently written entities grouped by entity name.

getTableName() public method

For something like "post", returns "posts"
public getTableName ( $entityName ) : string
$entityName
return string

isChildEntity() public method

Returns true if entity has a parent reference.
public isChildEntity ( $entityName ) : boolean
$entityName
return boolean

isEntity() public method

Useful for prefixing VP tables.
public isEntity ( $entityName ) : boolean
$entityName
return boolean

refreshDbSchema() public method

public refreshDbSchema ( $schemaFiles )

trimPrefix() public method

public trimPrefix ( $tableName )