WikiLambda
MediaWiki WikiLambda extension
|
Public Member Functions | |
__construct (IConnectionProvider $dbProvider, TitleFactory $titleFactory, WikiPageFactory $wikiPageFactory, RevisionStore $revisionStore, UserGroupManager $userGroupManager, LoggerInterface $logger) | |
getNextAvailableZid () | |
Find next available ZID in the database to create a new ZObject. | |
fetchZObjectByTitle (Title $title, ?int $requestedRevision=null) | |
Fetch the ZObject given its title and return it wrapped in a ZObjectContent object. | |
fetchBatchZObjects ( $zids) | |
Returns an array of ZPersistentObjects fetched from the DB given an array of their Zids. | |
createNewZObject (string $data, string $summary, User $user) | |
Create a new ZObject, with a newly assigned ZID, and store it in the Database. | |
updateZObject (string $zid, string $data, string $summary, User $user, int $flags=EDIT_UPDATE) | |
Create or update a ZObject it in the Database. | |
updateZObjectAsSystemUser (string $zid, string $data, string $summary, int $flags=EDIT_UPDATE) | |
Create or update a ZObject it in the Database as a System User. | |
deleteZObjectLabelsByZid (string $zid) | |
Delete the labels from the wikilambda_zobject_labels database that correspond to the given ZID. | |
deleteZObjectLabelConflictsByZid (string $zid) | |
Delete the label conflicts from the wikilambda_zobject_label_conflicts database that correspond to the given ZID. | |
findZObjectLabelConflicts ( $zid, $ztype, $labels) | |
Query the wikilambda_zobject_labels database for primary labels that have the same combination of language code and value for a different ZID than the given in the parameters. | |
insertZObjectLabels ( $zid, $ztype, $labels, $returnType=null) | |
Insert labels into the wikilambda_zobject_labels database for a given ZID and Type. | |
insertZLanguageToLanguagesCache (string $zid, string $languageCode) | |
Insert language code into the wikilambda_zlanguages database for a given ZID. | |
insertZObjectLabelConflicts ( $zid, $conflicts) | |
Insert label conflicts into the wikilambda_zobject_label_conflicts database for a given ZID. | |
insertZObjectAliases ( $zid, $ztype, $aliases, $returnType=null) | |
Insert alias (secondary labels) into the wikilambda_zobject_labels database for a given ZID and Type. | |
fetchZidsOfType ( $ztype) | |
Gets from the secondary database a list of all Zids belonging to a given type. | |
fetchAllZids () | |
Get a list of all Zids persisted in the database. | |
fetchAllZLanguageObjects () | |
Gets from the secondary database a list of all natural language ZIDs, mapping from ZID to BCP47 (or MediaWiki) language code. | |
searchZObjectLabels ( $label, $exact, $languages, $type, $returnType, $strictReturnType, $continue, $limit) | |
Search labels in the secondary database, filtering by language Zids, type or label string. | |
fetchZObjectLabel ( $zid, $languageCode, $fallback=true) | |
Fetch the label in the secondary database for a given object by Zid, in a given language. | |
fetchZFunctionReturnType ( $zid) | |
Get the return type of a given Function Zid or null if not available. | |
findFirstZImplementationFunction () | |
Search implementations in the secondary database, return the first one This function is primarily used for the example API request. | |
findReferencedZObjectsByZFunctionIdAsList ( $zid, $type) | |
Converts findReferencedZObjectsByZFunctionId into a list of zids. | |
findReferencedZObjectsByZFunctionId ( $zid, $type, $continue=null, $limit=10) | |
Search implementations in the secondary database and return all matching a given ZID. | |
insertZFunctionReference ( $refId, $zFunctionId, $type) | |
Add a record to the database for a given ZObject ID and ZFunction ID. | |
deleteZFunctionReference ( $refId) | |
Remove a given ZObject ref from the secondary database. | |
findZTesterResult (?string $functionZID, ?int $functionRevision, ?string $implementationZID, ?int $implementationRevision, ?string $testerZID, ?int $testerRevision) | |
Search test run results in the secondary tester results table; the latest result (highest database ID) will be used. | |
insertZTesterResult (string $functionZID, int $functionRevision, string $implementationZID, int $implementationRevision, string $testerZID, int $testerRevision, bool $testerResult, string $testerResponse) | |
Cache a test run result in the secondary tester results table. | |
deleteZFunctionFromZTesterResultsCache (string $refId) | |
Remove a given ZFunction's results from the secondary tester results table. | |
deleteZImplementationFromZTesterResultsCache (string $refId) | |
Remove a given ZImplementation's results from the secondary tester results table. | |
deleteZTesterFromZTesterResultsCache (string $refId) | |
Remove a given ZTester's results from the secondary tester results table. | |
deleteZLanguageFromLanguagesCache (string $zid) | |
Remove a given ZNaturalLanguage's entry from the secondary languages table. | |
deleteFromLabelsSecondaryTables (array $zids) | |
Delete data related to the given zids from the secondary labels table. | |
deleteFromFunctionsSecondaryTables (array $zids) | |
Delete data related to the given zids from the secondary function joins table. | |
deleteFromLanguageCacheSecondaryTables (array $zids) | |
Delete data related to the given zids from the secondary languages table. | |
deleteFromTesterResultsSecondaryTables (array $zids) | |
Delete data related to the given zids from the secondary tester results table. | |
clearLabelsSecondaryTables () | |
Clear all data from the secondary labels table. | |
clearFunctionsSecondaryTables () | |
Clear all data from the secondary function joins table. | |
clearTesterResultsSecondaryTables () | |
Clear all data from the secondary tester results table. | |
clearLanguageCacheSecondaryTables () | |
Clear all data from the secondary languages table. | |
Protected Attributes | |
$titleFactory | |
$wikiPageFactory | |
$revisionStore | |
$userGroupManager | |
MediaWiki\Extension\WikiLambda\ZObjectStore::__construct | ( | IConnectionProvider | $dbProvider, |
TitleFactory | $titleFactory, | ||
WikiPageFactory | $wikiPageFactory, | ||
RevisionStore | $revisionStore, | ||
UserGroupManager | $userGroupManager, | ||
LoggerInterface | $logger ) |
IConnectionProvider | $dbProvider | |
TitleFactory | $titleFactory | |
WikiPageFactory | $wikiPageFactory | |
RevisionStore | $revisionStore | |
UserGroupManager | $userGroupManager | |
LoggerInterface | $logger |
MediaWiki\Extension\WikiLambda\ZObjectStore::clearFunctionsSecondaryTables | ( | ) |
Clear all data from the secondary function joins table.
This method is only for its use by reloadBuiltinData with the –force flag.
MediaWiki\Extension\WikiLambda\ZObjectStore::clearLabelsSecondaryTables | ( | ) |
Clear all data from the secondary labels table.
This method is only for its use by reloadBuiltinData with the –force flag.
MediaWiki\Extension\WikiLambda\ZObjectStore::clearLanguageCacheSecondaryTables | ( | ) |
Clear all data from the secondary languages table.
This method is only for its use by reloadBuiltinData with the –force flag.
MediaWiki\Extension\WikiLambda\ZObjectStore::clearTesterResultsSecondaryTables | ( | ) |
Clear all data from the secondary tester results table.
This method is only for its use by reloadBuiltinData with the –force flag.
MediaWiki\Extension\WikiLambda\ZObjectStore::createNewZObject | ( | string | $data, |
string | $summary, | ||
User | $user ) |
Create a new ZObject, with a newly assigned ZID, and store it in the Database.
string | $data | |
string | $summary | |
User | $user |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteFromFunctionsSecondaryTables | ( | array | $zids | ) |
Delete data related to the given zids from the secondary function joins table.
This method is only for its use by reloadBuiltinData with the –force flag.
string[] | $zids | list of zids to clear |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteFromLabelsSecondaryTables | ( | array | $zids | ) |
Delete data related to the given zids from the secondary labels table.
This method is only for its use by reloadBuiltinData with the –force flag.
string[] | $zids | list of zids to clear |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteFromLanguageCacheSecondaryTables | ( | array | $zids | ) |
Delete data related to the given zids from the secondary languages table.
This method is only for its use by reloadBuiltinData with the –force flag.
string[] | $zids | list of zids to clear |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteFromTesterResultsSecondaryTables | ( | array | $zids | ) |
Delete data related to the given zids from the secondary tester results table.
This method is only for its use by reloadBuiltinData with the –force flag.
string[] | $zids | list of zids to clear |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteZFunctionFromZTesterResultsCache | ( | string | $refId | ) |
Remove a given ZFunction's results from the secondary tester results table.
string | $refId | the ZID of the ZFunction whose results you wish to delete |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteZFunctionReference | ( | $refId | ) |
Remove a given ZObject ref from the secondary database.
string | $refId | the ZObject ID |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteZImplementationFromZTesterResultsCache | ( | string | $refId | ) |
Remove a given ZImplementation's results from the secondary tester results table.
string | $refId | the ZID of the ZImplementation whose results you wish to delete |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteZLanguageFromLanguagesCache | ( | string | $zid | ) |
Remove a given ZNaturalLanguage's entry from the secondary languages table.
string | $zid | the ZID of the ZNaturalLanguage you wish to delete |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteZObjectLabelConflictsByZid | ( | string | $zid | ) |
Delete the label conflicts from the wikilambda_zobject_label_conflicts database that correspond to the given ZID.
string | $zid |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteZObjectLabelsByZid | ( | string | $zid | ) |
Delete the labels from the wikilambda_zobject_labels database that correspond to the given ZID.
string | $zid |
MediaWiki\Extension\WikiLambda\ZObjectStore::deleteZTesterFromZTesterResultsCache | ( | string | $refId | ) |
Remove a given ZTester's results from the secondary tester results table.
string | $refId | the ZID of the ZTester whose results you wish to delete |
MediaWiki\Extension\WikiLambda\ZObjectStore::fetchAllZids | ( | ) |
Get a list of all Zids persisted in the database.
MediaWiki\Extension\WikiLambda\ZObjectStore::fetchAllZLanguageObjects | ( | ) |
Gets from the secondary database a list of all natural language ZIDs, mapping from ZID to BCP47 (or MediaWiki) language code.
MediaWiki\Extension\WikiLambda\ZObjectStore::fetchBatchZObjects | ( | $zids | ) |
Returns an array of ZPersistentObjects fetched from the DB given an array of their Zids.
Note that this will only fetch the latest revision of a ZObject; if you want a specific revision, you need to use ZObjectStore::fetchZObjectByTitle() instead.
string[] | $zids |
MediaWiki\Extension\WikiLambda\ZObjectStore::fetchZFunctionReturnType | ( | $zid | ) |
Get the return type of a given Function Zid or null if not available.
string | $zid |
MediaWiki\Extension\WikiLambda\ZObjectStore::fetchZidsOfType | ( | $ztype | ) |
Gets from the secondary database a list of all Zids belonging to a given type.
string | $ztype |
MediaWiki\Extension\WikiLambda\ZObjectStore::fetchZObjectByTitle | ( | Title | $title, |
?int | $requestedRevision = null ) |
Fetch the ZObject given its title and return it wrapped in a ZObjectContent object.
Title | $title | The ZObject to fetch |
int | null | $requestedRevision | The revision ID of the page to fetch. If unset, the latest is returned. |
MediaWiki\Extension\WikiLambda\ZObjectStore::fetchZObjectLabel | ( | $zid, | |
$languageCode, | |||
$fallback = true ) |
Fetch the label in the secondary database for a given object by Zid, in a given language.
Returns null if no labels are found in the given language or any other language in that language's fallback chain, including English (Z1002). If the language code given is not recognised, this will fall back to returning the English label, if available.
string | $zid | Term to search in the label database |
string | $languageCode | Code of the language in which to fetch the label |
bool | $fallback | Whether to only match in the given language, or use the language fallback change (default behaviour). |
MediaWiki\Extension\WikiLambda\ZObjectStore::findFirstZImplementationFunction | ( | ) |
Search implementations in the secondary database, return the first one This function is primarily used for the example API request.
MediaWiki\Extension\WikiLambda\ZObjectStore::findReferencedZObjectsByZFunctionId | ( | $zid, | |
$type, | |||
$continue = null, | |||
$limit = 10 ) |
Search implementations in the secondary database and return all matching a given ZID.
string | $zid | the ZID of the ZFunction |
string | $type | the type of the ZFunction reference |
string | null | $continue | Id to start. If null (the default), start from the first result. |
int | $limit | Maximum number of results to return. Defaults to 10 |
MediaWiki\Extension\WikiLambda\ZObjectStore::findReferencedZObjectsByZFunctionIdAsList | ( | $zid, | |
$type ) |
Converts findReferencedZObjectsByZFunctionId into a list of zids.
string | $zid | the ZID of the ZFunction |
string | $type | the type of the ZFunction reference |
MediaWiki\Extension\WikiLambda\ZObjectStore::findZObjectLabelConflicts | ( | $zid, | |
$ztype, | |||
$labels ) |
Query the wikilambda_zobject_labels database for primary labels that have the same combination of language code and value for a different ZID than the given in the parameters.
These will be considered conflicting labels.
string | $zid | |
string | $ztype | |
array | $labels | Array of labels, where the key is the language code and the value is the string representation of the label in that language |
MediaWiki\Extension\WikiLambda\ZObjectStore::findZTesterResult | ( | ?string | $functionZID, |
?int | $functionRevision, | ||
?string | $implementationZID, | ||
?int | $implementationRevision, | ||
?string | $testerZID, | ||
?int | $testerRevision ) |
Search test run results in the secondary tester results table; the latest result (highest database ID) will be used.
?string | $functionZID | The ZID of the ZFunction |
?int | $functionRevision | The revision ID of the ZFunction |
?string | $implementationZID | The ZID of the ZImplementation |
?int | $implementationRevision | The revision ID of the ZImplementation |
?string | $testerZID | The ZID of the ZTester |
?int | $testerRevision | The revision ID of the ZTester |
MediaWiki\Extension\WikiLambda\ZObjectStore::getNextAvailableZid | ( | ) |
Find next available ZID in the database to create a new ZObject.
MediaWiki\Extension\WikiLambda\ZObjectStore::insertZFunctionReference | ( | $refId, | |
$zFunctionId, | |||
$type ) |
Add a record to the database for a given ZObject ID and ZFunction ID.
string | $refId | the ZObject ref ID |
string | $zFunctionId | the ZFunction ID |
string | $type | the type of the ZFunction reference |
MediaWiki\Extension\WikiLambda\ZObjectStore::insertZLanguageToLanguagesCache | ( | string | $zid, |
string | $languageCode ) |
Insert language code into the wikilambda_zlanguages database for a given ZID.
string | $zid | |
string | $languageCode |
MediaWiki\Extension\WikiLambda\ZObjectStore::insertZObjectAliases | ( | $zid, | |
$ztype, | |||
$aliases, | |||
$returnType = null ) |
Insert alias (secondary labels) into the wikilambda_zobject_labels database for a given ZID and Type.
string | $zid | |
string | $ztype | |
array | $aliases | Set of labels, where the key is the language code and the value is an array of strings |
string | null | $returnType |
MediaWiki\Extension\WikiLambda\ZObjectStore::insertZObjectLabelConflicts | ( | $zid, | |
$conflicts ) |
Insert label conflicts into the wikilambda_zobject_label_conflicts database for a given ZID.
string | $zid | |
array | $conflicts | Array of labels, where the key is the language code and the value is the other ZID for which this label is repeated |
MediaWiki\Extension\WikiLambda\ZObjectStore::insertZObjectLabels | ( | $zid, | |
$ztype, | |||
$labels, | |||
$returnType = null ) |
Insert labels into the wikilambda_zobject_labels database for a given ZID and Type.
string | $zid | |
string | $ztype | |
array | $labels | Array of labels, where the key is the language code and the value is the string representation of the label in that language |
string | null | $returnType |
MediaWiki\Extension\WikiLambda\ZObjectStore::insertZTesterResult | ( | string | $functionZID, |
int | $functionRevision, | ||
string | $implementationZID, | ||
int | $implementationRevision, | ||
string | $testerZID, | ||
int | $testerRevision, | ||
bool | $testerResult, | ||
string | $testerResponse ) |
Cache a test run result in the secondary tester results table.
string | $functionZID | The ZID of the ZFunction |
int | $functionRevision | The revision ID of the ZFunction |
string | $implementationZID | The ZID of the ZImplementation |
int | $implementationRevision | The revision ID of the ZImplementation |
string | $testerZID | The ZID of the ZTester |
int | $testerRevision | The revision ID of the ZTester |
bool | $testerResult | Whether the test run passed (true) or failed (false) |
string | $testerResponse | The test run response JSON object |
MediaWiki\Extension\WikiLambda\ZObjectStore::searchZObjectLabels | ( | $label, | |
$exact, | |||
$languages, | |||
$type, | |||
$returnType, | |||
$strictReturnType, | |||
$continue, | |||
$limit ) |
Search labels in the secondary database, filtering by language Zids, type or label string.
string | $label | Term to search in the label database |
bool | $exact | Whether to search by exact match |
string[] | $languages | List of language Zids to filter by |
string | null | $type | Zid of the type to filter by. If null, don't filter by type. |
string | null | $returnType | Zid of the return type to filter by. If null, don't filter by return type. |
bool | $strictReturnType | Whether to exclude Z1s as return type. |
string | null | $continue | Id to start. If null, start from the first result. |
int | $limit | Maximum number of results to return. |
MediaWiki\Extension\WikiLambda\ZObjectStore::updateZObject | ( | string | $zid, |
string | $data, | ||
string | $summary, | ||
User | $user, | ||
int | $flags = EDIT_UPDATE ) |
Create or update a ZObject it in the Database.
string | $zid | The ZID of the page to create/update, e.g. 'Z12345' |
string | $data | The ZObject's JSON to store, in string form, i.e. "{ Z1K1: "Z2", Z2K1: … }" |
string | $summary | An edit summary to display in the page's history, Recent Changes, watchlists, etc. |
User | $user | The user making the edit. |
int | $flags | Either EDIT_UPDATE (default) if editing or EDIT_NEW if creating a page |
MediaWiki\Extension\WikiLambda\ZObjectStore::updateZObjectAsSystemUser | ( | string | $zid, |
string | $data, | ||
string | $summary, | ||
int | $flags = EDIT_UPDATE ) |
Create or update a ZObject it in the Database as a System User.
string | $zid | |
string | $data | |
string | $summary | |
int | $flags |