Implementation to all the hooks that CirrusSearch needs to listen in order to keep its index in sync with main SQL database.
More...
|
| __construct (JobQueueGroup $jobQueue, SearchConfig $searchConfig, LoadBalancer $loadBalancer) |
|
| onArticleRevisionVisibilitySet ( $title, $ids, $visibilityChangeMap) |
| Called when a revision is deleted.
|
|
| onLinksUpdateComplete ( $linksUpdate, $ticket) |
| Hooked to update the search index when pages change directly or when templates that they include change.
|
|
| onUploadComplete ( $uploadBase) |
| Hook into UploadComplete, overwritten files do not seem to trigger LinksUpdateComplete.
|
|
| onArticleDelete (WikiPage $page, User $user, &$reason, &$error, Status &$status, $suppress) |
| Hook to call before an article is deleted.
|
|
| onArticleDeleteComplete ( $wikiPage, $user, $reason, $id, $content, $logEntry, $archivedRevisionCount) |
| Hook to call after an article is deleted.
|
|
| onTitleMove (Title $old, Title $nt, User $user, $reason, Status &$status) |
| Before we've moved a title from $title to $newTitle.
|
|
| onPageMoveComplete ( $old, $new, $user, $pageid, $redirid, $reason, $revision) |
| When we've moved a Title from A to B.
|
|
| onArticleUndelete ( $title, $create, $comment, $oldPageId, $restoredPages) |
| When article is undeleted - check the archive for other instances of the title, if not there - drop it from the archive.
|
|
|
static | create (JobQueueGroup $jobQueue, ConfigFactory $configFactory, LoadBalancer $loadBalancer) |
|
static | prepareTitlesForLinksUpdate ( $titles, int $max, $excludeBadUTF=false) |
| Take a list of titles either linked or unlinked and prepare them for Job\LinksUpdate.
|
|
Implementation to all the hooks that CirrusSearch needs to listen in order to keep its index in sync with main SQL database.
◆ __construct()
CirrusSearch\ChangeListener::__construct |
( |
JobQueueGroup | $jobQueue, |
|
|
SearchConfig | $searchConfig, |
|
|
LoadBalancer | $loadBalancer ) |
- Parameters
-
JobQueueGroup | $jobQueue | |
SearchConfig | $searchConfig | |
LoadBalancer | $loadBalancer | |
◆ create()
static CirrusSearch\ChangeListener::create |
( |
JobQueueGroup | $jobQueue, |
|
|
ConfigFactory | $configFactory, |
|
|
LoadBalancer | $loadBalancer ) |
|
static |
@phan-suppress-next-line PhanTypeMismatchArgumentSuperType $config is actually a SearchConfig
◆ onArticleDelete()
CirrusSearch\ChangeListener::onArticleDelete |
( |
WikiPage | $page, |
|
|
User | $user, |
|
|
& | $reason, |
|
|
& | $error, |
|
|
Status & | $status, |
|
|
| $suppress ) |
Hook to call before an article is deleted.
- Parameters
-
WikiPage | $page | WikiPage being deleted |
User | $user | User deleting the article |
string | &$reason | Reason the article is being deleted |
string | &$error | If the deletion was prohibited, the (raw HTML) error message to display (added in 1.13) |
Status | &$status | Modify this to throw an error. Overridden by $error (added in 1.20) |
bool | $suppress | Whether this is a suppression deletion or not (added in 1.27) |
- Returns
- bool|void True or no return value to continue or false to abort
◆ onArticleDeleteComplete()
CirrusSearch\ChangeListener::onArticleDeleteComplete |
( |
| $wikiPage, |
|
|
| $user, |
|
|
| $reason, |
|
|
| $id, |
|
|
| $content, |
|
|
| $logEntry, |
|
|
| $archivedRevisionCount ) |
Hook to call after an article is deleted.
- Parameters
-
WikiPage | $wikiPage | WikiPage that was deleted |
User | $user | User that deleted the article |
string | $reason | Reason the article was deleted |
int | $id | ID of the article that was deleted |
\Content | null | $content | Content of the deleted page (or null, when deleting a broken page) |
\ManualLogEntry | $logEntry | ManualLogEntry used to record the deletion |
int | $archivedRevisionCount | Number of revisions archived during the deletion |
- Returns
- bool|void True or no return value to continue or false to abort
◆ onArticleRevisionVisibilitySet()
CirrusSearch\ChangeListener::onArticleRevisionVisibilitySet |
( |
| $title, |
|
|
| $ids, |
|
|
| $visibilityChangeMap ) |
Called when a revision is deleted.
In theory, we shouldn't need to to this since you can't delete the current text of a page (so we should've already updated when the page was updated last). But we're paranoid, because deleted revisions absolutely should not be in the index.
- Parameters
-
Title | $title | The page title we've had a revision deleted on |
int[] | $ids | IDs to set the visibility for |
array | $visibilityChangeMap | Map of revision ID to oldBits and newBits. This array can be examined to determine exactly what visibility bits have changed for each revision. This array is of the form: [id => ['oldBits' => $oldBits, 'newBits' => $newBits], ... ] |
◆ onArticleUndelete()
CirrusSearch\ChangeListener::onArticleUndelete |
( |
| $title, |
|
|
| $create, |
|
|
| $comment, |
|
|
| $oldPageId, |
|
|
| $restoredPages ) |
When article is undeleted - check the archive for other instances of the title, if not there - drop it from the archive.
- Parameters
-
Title | $title | Title corresponding to the article restored |
bool | $create | Whether or not the restoration caused the page to be created (i.e. it didn't exist before) |
string | $comment | Comment associated with the undeletion |
int | $oldPageId | ID of page previously deleted (from archive table). This ID will be used for the restored page. |
array | $restoredPages | Set of page IDs that have revisions restored for this undelete, with keys set to page IDs and values set to 'true' |
- Returns
- bool|void True or no return value to continue or false to abort
◆ onLinksUpdateComplete()
CirrusSearch\ChangeListener::onLinksUpdateComplete |
( |
| $linksUpdate, |
|
|
| $ticket ) |
Hooked to update the search index when pages change directly or when templates that they include change.
- Parameters
-
\LinksUpdate | $linksUpdate | |
mixed | $ticket | Prior result of LBFactory::getEmptyTransactionTicket() |
◆ onPageMoveComplete()
CirrusSearch\ChangeListener::onPageMoveComplete |
( |
| $old, |
|
|
| $new, |
|
|
| $user, |
|
|
| $pageid, |
|
|
| $redirid, |
|
|
| $reason, |
|
|
| $revision ) |
When we've moved a Title from A to B.
- Parameters
-
\MediaWiki\Linker\LinkTarget | $old | Old title |
\MediaWiki\Linker\LinkTarget | $new | New title |
\MediaWiki\User\UserIdentity | $user | User who did the move |
int | $pageid | Database ID of the page that's been moved |
int | $redirid | Database ID of the created redirect |
string | $reason | Reason for the move |
\MediaWiki\Revision\RevisionRecord | $revision | RevisionRecord created by the move |
- Returns
- bool|void True or no return value to continue or false stop other hook handlers, doesn't abort the move itself
◆ onTitleMove()
CirrusSearch\ChangeListener::onTitleMove |
( |
Title | $old, |
|
|
Title | $nt, |
|
|
User | $user, |
|
|
| $reason, |
|
|
Status & | $status ) |
Before we've moved a title from $title to $newTitle.
- Parameters
-
Title | $old | Old title |
Title | $nt | New title |
User | $user | User who does the move |
string | $reason | Reason provided by the user |
Status | &$status | To abort the move, add a fatal error to this object (i.e. call $status->fatal()) |
- Returns
- bool|void True or no return value to continue or false to abort
◆ onUploadComplete()
CirrusSearch\ChangeListener::onUploadComplete |
( |
| $uploadBase | ) |
|
Hook into UploadComplete, overwritten files do not seem to trigger LinksUpdateComplete.
Since files do contain indexed metadata we need to refresh the search index when a file is overwritten on an existing title.
- Parameters
-
◆ prepareTitlesForLinksUpdate()
static CirrusSearch\ChangeListener::prepareTitlesForLinksUpdate |
( |
| $titles, |
|
|
int | $max, |
|
|
| $excludeBadUTF = false ) |
|
static |
Take a list of titles either linked or unlinked and prepare them for Job\LinksUpdate.
This includes limiting them to $max titles.
- Parameters
-
Title[] | $titles | titles to prepare |
int | $max | maximum number of titles to return |
bool | $excludeBadUTF | exclude links that contains invalid UTF sequences |
- Returns
- array
The documentation for this class was generated from the following file:
- includes/ChangeListener.php