PHP Class VersionPress\Database\DbSchemaInfo

Afficher le fichier Open project: versionpress/versionpress Class Usage Examples

Méthodes publiques

Méthode 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

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

Method Details

__construct() public méthode

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 méthode

Gets all entities defined by the schema
public getAllEntityNames ( ) : array
Résultat array

getAllMnReferences() public méthode

public getAllMnReferences ( )

getAllReferences() public méthode

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

getEntityInfo() public méthode

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

getEntityInfoByPrefixedTableName() public méthode

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

getEntityInfoByTableName() public méthode

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

getIntervalsForFrequentlyWrittenEntities() public méthode

getMnReferenceDetails() public méthode

public getMnReferenceDetails ( $junctionEntity )

getPrefixedTableName() public méthode

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

getRulesForFrequentlyWrittenEntities() public méthode

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

getTableName() public méthode

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

isChildEntity() public méthode

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

isEntity() public méthode

Useful for prefixing VP tables.
public isEntity ( $entityName ) : boolean
$entityName
Résultat boolean

refreshDbSchema() public méthode

public refreshDbSchema ( $schemaFiles )

trimPrefix() public méthode

public trimPrefix ( $tableName )