Semantic MediaWiki and related extensions
|
Public Member Functions | |
__construct (SQLStore $store, SQLStoreFactory $factory) | |
setEqualitySupport (int $equalitySupport) | |
applyChangesFromListener (string $key, ChangeRecord $changeRecord) | |
findRedirectSource (DIWikiPage $target, ?string $flag=null) | |
isRedirect (DIWikiPage $subject) | |
findRedirect ( $title, $namespace) | |
addRedirect ( $id, $title, $namespace) | |
updateRedirect ( $id, $title, $namespace) | |
deleteRedirect ( $title, $namespace) | |
getSMWPageIDandSort ( $title, $namespace, $iw, $subobjectName, &$sortkey, $canonical, $fetchHashes=false) | |
isUnique (DataItem $dataItem) | |
findDuplicates () | |
findIdsByTitle ( $title, $namespace, $iw=null, $subobjectName='') | |
exists (DIWikiPage $subject) | |
getId (DIWikiPage $subject) | |
getSMWPageID ( $title, $namespace, $iw, $subobjectName, $canonical=true, $fetchHashes=false) | |
makeSMWPageID ( $title, $namespace, $iw, $subobjectName, $canonical=true, $sortkey='', $fetchHashes=false) | |
getPropertyInterwiki (DIProperty $property) | |
updateInterwikiField ( $sid, DIWikiPage $subject, $interwiki=null) | |
findAssociatedRev ( $title, $namespace='', $iw='') | |
updateRevField ( $sid, $rev_id) | |
getSMWPropertyID (DIProperty $property) | |
makeSMWPropertyID (DIProperty $property) | |
moveSMWPageID ( $curid, $targetid=0) | |
computeSha1 ( $args='') | |
warmUpCache ( $list=[], $flag=null) | |
setCache ( $title, $namespace, $interwiki, $subobject, $id, $sortkey) | |
getDataItemById ( $id) | |
getDataItemsFromList (array $idlist, RequestOptions $requestOptions=null) | |
getDataItemPoolHashListFor (array $idlist, RequestOptions $requestOptions=null) | |
deleteCache ( $title, $namespace, $interwiki, $subobject) | |
initCache () | |
getPropertyTableHashes ( $sid) | |
setPropertyTableHashes ( $sid, $hash=null) | |
preload (array $subjects) | |
updateFieldMaps ( $sid, array $sequenceMap=null, array $countMap=null) | |
getSequenceMap ( $sid, $key=null) | |
loadSequenceMap (array $ids) | |
Public Attributes | |
const | MAX_CACHE_SIZE = 1000 |
const | POOLCACHE_ID = 'smw.sqlstore' |
$store | |
Static Public Attributes | |
static | $special_ids = [] |
Protected Member Functions | |
getDatabaseIdAndSort ( $title, $namespace, $iw, $subobjectName, &$sortkey, $canonical, $fetchHashes) | |
makeDatabaseId ( $title, $namespace, $iw, $subobjectName, $canonical, $sortkey, $fetchHashes) | |
getPredefinedData (&$title, &$namespace, &$iw, &$subobjectName, &$sortkey) | |
Class to access the SMW IDs table in SQLStore3. Provides transparent in-memory caching facilities.
Documentation for the SMW IDs table: This table is a dictionary that assigns integer IDs to pages, properties, and other objects used by SMW. All tables that refer to such objects store these IDs instead. If the ID information is lost (e.g., table gets deleted), then the data stored in SMW is no longer meaningful: all tables need to be dropped, recreated, and refreshed to get back to a working database.
The table has a column for storing interwiki prefixes, used to refer to pages on external sites (like in MediaWiki). This column is also used to mark some special objects in the table, using "interwiki prefixes" that cannot occur in MediaWiki:
GNU GPL v2+
SMW\SQLStore\EntityStore\EntityIdManager::__construct | ( | SQLStore | $store, |
SQLStoreFactory | $factory | ||
) |
SQLStore | $store |
SMW\SQLStore\EntityStore\EntityIdManager::addRedirect | ( | $id, | |
$title, | |||
$namespace | |||
) |
SMW\SQLStore\EntityStore\EntityIdManager::applyChangesFromListener | ( | string | $key, |
ChangeRecord | $changeRecord | ||
) |
This method applies changes from when the Settings
change listener receives change events from Settings:set
.
string | $key | |
ChangeRecord | $changeRecord |
SMW\SQLStore\EntityStore\EntityIdManager::computeSha1 | ( | $args = '' | ) |
string | array | $args |
SMW\SQLStore\EntityStore\EntityIdManager::deleteCache | ( | $title, | |
$namespace, | |||
$interwiki, | |||
$subobject | |||
) |
Remove any cache entry for the given data. The key consists of the parameters $title, $namespace, $interwiki, and $subobject. The cached data is $id and $sortkey.
string | $title | |
integer | $namespace | |
string | $interwiki | |
string | $subobject |
SMW\SQLStore\EntityStore\EntityIdManager::deleteRedirect | ( | $title, | |
$namespace | |||
) |
SMW\SQLStore\EntityStore\EntityIdManager::exists | ( | DIWikiPage | $subject | ) |
DIWikiPage | $subject | |
boolean |
SMW\SQLStore\EntityStore\EntityIdManager::findAssociatedRev | ( | $title, | |
$namespace = '' , |
|||
$iw = '' |
|||
) |
DIWikiPage | string | $title | |
integer | $namespace | |
string | $iw |
SMW\SQLStore\EntityStore\EntityIdManager::findDuplicates | ( | ) |
SMW\SQLStore\EntityStore\EntityIdManager::findIdsByTitle | ( | $title, | |
$namespace, | |||
$iw = null , |
|||
$subobjectName = '' |
|||
) |
string | $title | DB key |
integer | $namespace | namespace |
string | null | $iw | interwiki prefix |
string | $subobjectName | name of subobject |
array |
SMW\SQLStore\EntityStore\EntityIdManager::findRedirect | ( | $title, | |
$namespace | |||
) |
string | $title | DB key |
integer | $namespace |
SMW\SQLStore\EntityStore\EntityIdManager::findRedirectSource | ( | DIWikiPage | $target, |
?string | $flag = null |
||
) |
|
protected |
Find the numeric ID used for the page of the given normalized title, namespace, interwiki, and subobjectName. Predefined IDs are not taken into account (however, they would still be found correctly by an avoidable database read if they are stored correctly in the database; this should always be the case). In all other aspects, the method works just like getSMWPageIDandSort().
string | $title | DB key |
integer | $namespace | namespace |
string | $iw | interwiki prefix |
string | $subobjectName | name of subobject |
string | $sortkey | call-by-ref will be set to sortkey |
boolean | $canonical | should redirects be resolved? |
boolean | $fetchHashes | should the property hashes be obtained and cached? |
SMW\SQLStore\EntityStore\EntityIdManager::getDataItemById | ( | $id | ) |
integer | $id |
SMW\SQLStore\EntityStore\EntityIdManager::getDataItemPoolHashListFor | ( | array | $idlist, |
RequestOptions | $requestOptions = null |
||
) |
SMW\SQLStore\EntityStore\EntityIdManager::getDataItemsFromList | ( | array | $idlist, |
RequestOptions | $requestOptions = null |
||
) |
SMW\SQLStore\EntityStore\EntityIdManager::getId | ( | DIWikiPage | $subject | ) |
It uses the PoolCache which means Lru is in place to avoid memory leakage.
DIWikiPage | $subject |
|
protected |
Normalize the information for an SMW object (page etc.) and return the predefined ID if any. All parameters are call-by-reference and will be changed to perform any kind of built-in normalization that SMW requires. This mainly applies to predefined properties that should always use their property key as a title, have fixed sortkeys, etc. Some very special properties also have fixed IDs that do not require any DB lookups. In such cases, the method returns this ID; otherwise it returns 0.
string | $title | DB key |
integer | $namespace | namespace |
string | $iw | interwiki prefix |
string | $subobjectName | |
string | $sortkey |
SMW\SQLStore\EntityStore\EntityIdManager::getPropertyInterwiki | ( | DIProperty | $property | ) |
Properties have a mechanisms for being predefined (i.e. in PHP instead of in wiki). Special "interwiki" prefixes separate the ids of such predefined properties from the ids for the current pages (which may, e.g., be moved, while the predefined object is not movable).
DIProperty | $property |
SMW\SQLStore\EntityStore\EntityIdManager::getPropertyTableHashes | ( | $sid | ) |
Return an array of hashes with table names as keys. These hashes are used to compare new data with old data for each property-value table when updating data
integer | $subjectId | ID of the page as stored in the SMW IDs table |
SMW\SQLStore\EntityStore\EntityIdManager::getSequenceMap | ( | $sid, | |
$key = null |
|||
) |
integer | $sid | |
string | null | $key |
SMW\SQLStore\EntityStore\EntityIdManager::getSMWPageID | ( | $title, | |
$namespace, | |||
$iw, | |||
$subobjectName, | |||
$canonical = true , |
|||
$fetchHashes = false |
|||
) |
Convenience method for calling getSMWPageIDandSort without specifying a sortkey (if not asked for).
string | $title | DB key |
integer | $namespace | namespace |
string | $iw | interwiki prefix |
string | $subobjectName | name of subobject |
boolean | $canonical | should redirects be resolved? |
boolean | $fetchHashes | should the property hashes be obtained and cached? |
SMW\SQLStore\EntityStore\EntityIdManager::getSMWPageIDandSort | ( | $title, | |
$namespace, | |||
$iw, | |||
$subobjectName, | |||
& | $sortkey, | ||
$canonical, | |||
$fetchHashes = false |
|||
) |
Find the numeric ID used for the page of the given title, namespace, interwiki, and subobject. If $canonical is set to true, redirects are taken into account to find the canonical alias ID for the given page. If no such ID exists, 0 is returned. The Call-By-Ref parameter $sortkey is set to the current sortkey, or to '' if no ID exists.
If $fetchhashes is true, the property table hash blob will be retrieved in passing if the opportunity arises, and cached internally. This will speed up a subsequent call to getPropertyTableHashes() for this id. This should only be done if such a call is intended, both to safe the previous cache and to avoid extra work (even if only a little) to fill it.
string | $title | DB key |
integer | $namespace | namespace |
string | $iw | interwiki prefix |
string | $subobjectName | name of subobject |
string | $sortkey | call-by-ref will be set to sortkey |
boolean | $canonical | should redirects be resolved? |
boolean | $fetchHashes | should the property hashes be obtained and cached? |
SMW\SQLStore\EntityStore\EntityIdManager::getSMWPropertyID | ( | DIProperty | $property | ) |
Fetch the ID for an DIProperty object. This method achieves the same as getSMWPageID(), but avoids additional normalization steps that have already been performed when creating an DIProperty object.
DIProperty | $property |
SMW\SQLStore\EntityStore\EntityIdManager::initCache | ( | ) |
SMW\SQLStore\EntityStore\EntityIdManager::isRedirect | ( | DIWikiPage | $subject | ) |
SMW\SQLStore\EntityStore\EntityIdManager::isUnique | ( | DataItem | $dataItem | ) |
DataItem | $dataItem |
SMW\SQLStore\EntityStore\EntityIdManager::loadSequenceMap | ( | array | $ids | ) |
array | $ids |
|
protected |
Find the numeric ID used for the page of the given normalized title, namespace, interwiki, and subobjectName. Predefined IDs are not taken into account (however, they would still be found correctly by an avoidable database read if they are stored correctly in the database; this should always be the case). In all other aspects, the method works just like makeSMWPageID(). Especially, if no ID exists, a new ID is created and returned.
string | $title | DB key |
integer | $namespace | namespace |
string | $iw | interwiki prefix |
string | $subobjectName | name of subobject |
boolean | $canonical | should redirects be resolved? |
string | $sortkey | call-by-ref will be set to sortkey |
boolean | $fetchHashes | should the property hashes be obtained and cached? |
SMW\SQLStore\EntityStore\EntityIdManager::makeSMWPageID | ( | $title, | |
$namespace, | |||
$iw, | |||
$subobjectName, | |||
$canonical = true , |
|||
$sortkey = '' , |
|||
$fetchHashes = false |
|||
) |
Find the numeric ID used for the page of the given title, namespace, interwiki, and subobjectName. If $canonical is set to true, redirects are taken into account to find the canonical alias ID for the given page. If no such ID exists, a new ID is created and returned. In any case, the current sortkey is set to the given one unless $sortkey is empty.
string | $title | DB key |
integer | $namespace | namespace |
string | $iw | interwiki prefix |
string | $subobjectName | name of subobject |
boolean | $canonical | should redirects be resolved? |
string | $sortkey | call-by-ref will be set to sortkey |
boolean | $fetchHashes | should the property hashes be obtained and cached? |
SMW\SQLStore\EntityStore\EntityIdManager::makeSMWPropertyID | ( | DIProperty | $property | ) |
Fetch and possibly create the ID for an DIProperty object. The method achieves the same as getSMWPageID() but avoids additional normalization steps that have already been performed when creating an DIProperty object.
DIProperty | $property |
SMW\SQLStore\EntityStore\EntityIdManager::moveSMWPageID | ( | $curid, | |
$targetid = 0 |
|||
) |
SMW\SQLStore\EntityStore\EntityIdManager::preload | ( | array | $subjects | ) |
DIWikiPage[] | $subjects |
SMW\SQLStore\EntityStore\EntityIdManager::setCache | ( | $title, | |
$namespace, | |||
$interwiki, | |||
$subobject, | |||
$id, | |||
$sortkey | |||
) |
Add or modify a cache entry. The key consists of the parameters $title, $namespace, $interwiki, and $subobject. The cached data is $id and $sortkey.
string | $title | |
integer | $namespace | |
string | $interwiki | |
string | $subobject | |
integer | $id | |
string | $sortkey |
SMW\SQLStore\EntityStore\EntityIdManager::setEqualitySupport | ( | int | $equalitySupport | ) |
integer | $equalitySupport |
SMW\SQLStore\EntityStore\EntityIdManager::setPropertyTableHashes | ( | $sid, | |
$hash = null |
|||
) |
Update the proptable_hash for a given page.
integer | $sid | ID of the page as stored in SMW IDs table |
string[] | of hash values with table names as keys |
SMW\SQLStore\EntityStore\EntityIdManager::updateFieldMaps | ( | $sid, | |
array | $sequenceMap = null , |
||
array | $countMap = null |
||
) |
integer | $sid | |
array | $sequenceMap | |
array | $countMap |
SMW\SQLStore\EntityStore\EntityIdManager::updateInterwikiField | ( | $sid, | |
DIWikiPage | $subject, | ||
$interwiki = null |
|||
) |
integer | $sid | |
DIWikiPage | $subject | |
integer | string | null | $interwiki |
SMW\SQLStore\EntityStore\EntityIdManager::updateRedirect | ( | $id, | |
$title, | |||
$namespace | |||
) |
SMW\SQLStore\EntityStore\EntityIdManager::updateRevField | ( | $sid, | |
$rev_id | |||
) |
integer | $sid | |
integer | $sid |
SMW\SQLStore\EntityStore\EntityIdManager::warmUpCache | ( | $list = [] , |
|
$flag = null |
|||
) |
array | $list | |
string | null | $flag |