CirrusSearch
Elasticsearch-powered search for MediaWiki
|
Implementation to all the hooks that CirrusSearch needs to listen in order to keep its index in sync with main SQL database. More...
Public Member Functions | |
__construct (JobQueueGroup $jobQueue, SearchConfig $searchConfig, IConnectionProvider $dbProvider, RedirectLookup $redirectLookup) | |
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, because overwritten files mistakenly do not trigger LinksUpdateComplete (T344285). | |
onPageDelete (ProperPageIdentity $page, Authority $deleter, string $reason, \StatusValue $status, bool $suppress) | |
This hook is called before a page is deleted. | |
onPageDeleteComplete (ProperPageIdentity $page, Authority $deleter, string $reason, int $pageID, RevisionRecord $deletedRev, ManualLogEntry $logEntry, int $archivedRevisionCount) | |
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. | |
Public Member Functions inherited from CirrusSearch\PageChangeTracker | |
__construct (int $maxStateSize=512) | |
onPageDelete (ProperPageIdentity $page, Authority $deleter, string $reason, StatusValue $status, bool $suppress) | |
onPageSaveComplete ( $wikiPage, $user, $summary, $flags, $revisionRecord, $editResult) | |
isPageChange (int $pageId) | |
Test if this pageId was references in a hook call earlier. | |
Static Public Member Functions | |
static | create (JobQueueGroup $jobQueue, ConfigFactory $configFactory, IConnectionProvider $dbProvider, RedirectLookup $redirectLookup) |
static | preparePageReferencesForLinksUpdate ( $pageReferences, 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.
|
static |
@phan-suppress-next-line PhanTypeMismatchArgumentSuperType $config is actually a SearchConfig
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.
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], ... ] |
CirrusSearch\ChangeListener::onLinksUpdateComplete | ( | $linksUpdate, | |
$ticket ) |
Hooked to update the search index when pages change directly or when templates that they include change.
\MediaWiki\Deferred\LinksUpdate\LinksUpdate | $linksUpdate | |
mixed | $ticket | Prior result of LBFactory::getEmptyTransactionTicket() |
CirrusSearch\ChangeListener::onPageDelete | ( | ProperPageIdentity | $page, |
Authority | $deleter, | ||
string | $reason, | ||
\StatusValue | $status, | ||
bool | $suppress ) |
This hook is called before a page is deleted.
ProperPageIdentity | $page | Page being deleted. |
Authority | $deleter | Who is deleting the page |
string | $reason | Reason the page is being deleted |
\StatusValue | $status | Add any error here |
bool | $suppress | Whether this is a suppression deletion or not |
CirrusSearch\ChangeListener::onPageDeleteComplete | ( | ProperPageIdentity | $page, |
Authority | $deleter, | ||
string | $reason, | ||
int | $pageID, | ||
RevisionRecord | $deletedRev, | ||
ManualLogEntry | $logEntry, | ||
int | $archivedRevisionCount ) |
ProperPageIdentity | $page | |
Authority | $deleter | |
string | $reason | |
int | $pageID | |
RevisionRecord | $deletedRev | |
ManualLogEntry | $logEntry | |
int | $archivedRevisionCount |
Reimplemented from CirrusSearch\PageChangeTracker.
CirrusSearch\ChangeListener::onPageMoveComplete | ( | $old, | |
$new, | |||
$user, | |||
$pageid, | |||
$redirid, | |||
$reason, | |||
$revision ) |
When we've moved a Title from A to B.
\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 |
Reimplemented from CirrusSearch\PageChangeTracker.
CirrusSearch\ChangeListener::onTitleMove | ( | Title | $old, |
Title | $nt, | ||
User | $user, | ||
$reason, | |||
Status & | $status ) |
Before we've moved a title from $title to $newTitle.
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()) |
CirrusSearch\ChangeListener::onUploadComplete | ( | $uploadBase | ) |
Hook into UploadComplete, because overwritten files mistakenly do not trigger LinksUpdateComplete (T344285).
Since files do contain indexed metadata we need to refresh the search index when a file is overwritten on an existing title.
\UploadBase | $uploadBase |
|
static |
Take a list of titles either linked or unlinked and prepare them for Job\LinksUpdate.
This includes limiting them to $max titles.
PageReference[] | $pageReferences | titles to prepare |
int | $max | maximum number of titles to return |
bool | $excludeBadUTF | exclude links that contains invalid UTF sequences |