MediaWiki master
RevisionSearchResultTrait.php File Reference

Go to the source code of this file.

Functions

 getByteSize ()
 
 getCategorySnippet ()
 
 getCategorySnippetField ()
 
 getFile ()
 Get the file for this page, if one exists.
 
 getInterwikiNamespaceText ()
 
 getInterwikiPrefix ()
 
 getRedirectSnippet ()
 
 getRedirectSnippetField ()
 
 getRedirectTitle ()
 
 getSectionSnippet ()
 
 getSectionSnippetField ()
 
 getSectionTitle ()
 
 getTextSnippet ( $terms=[])
 
 getTextSnippetField ()
 
 getTimestamp ()
 
 getTitle ()
 
 getTitleSnippet ()
 
 getTitleSnippetField ()
 
 getWordCount ()
 
 initFromTitle ( $title)
 Initialize from a Title and if possible initializes a corresponding RevisionRecord and File.
 
 initText ()
 Lazy initialization of article text from DB.
 
 isBrokenTitle ()
 Check if this is result points to an invalid title.
 
 isFileMatch ()
 Did this match file contents (eg: PDF/DJVU)?
 
 isMissingRevision ()
 Check if target page is missing, happens when index is out of date.
 

Variables

File null $mImage = null
 
string $mText
 
Title null $mTitle
 
trait RevisionSearchResultTrait
 Transitional trait used to share the methods between SearchResult and RevisionSearchResult.
 

Function Documentation

◆ getByteSize()

getByteSize ( )
Returns
int Size in bytes

Definition at line 217 of file RevisionSearchResultTrait.php.

References initText().

◆ getCategorySnippet()

getCategorySnippet ( )
Returns
string Highlighted relevant category name or '' if none or not supported

Definition at line 183 of file RevisionSearchResultTrait.php.

◆ getCategorySnippetField()

getCategorySnippetField ( )
Returns
string Name of the field containing the category snippet, '' if not supported

Definition at line 190 of file RevisionSearchResultTrait.php.

◆ getFile()

◆ getInterwikiNamespaceText()

getInterwikiNamespaceText ( )
Returns
string Interwiki namespace of the title (since we likely can't resolve it locally)

Definition at line 232 of file RevisionSearchResultTrait.php.

◆ getInterwikiPrefix()

getInterwikiPrefix ( )
Returns
string Interwiki prefix of the title (return iw even if title is broken)

Definition at line 225 of file RevisionSearchResultTrait.php.

◆ getRedirectSnippet()

getRedirectSnippet ( )
Returns
string Highlighted redirect name (redirect to this page), '' if none or not supported

Definition at line 140 of file RevisionSearchResultTrait.php.

◆ getRedirectSnippetField()

getRedirectSnippetField ( )
Returns
string Name of the field containing the redirect snippet, '' if not supported

Definition at line 147 of file RevisionSearchResultTrait.php.

◆ getRedirectTitle()

getRedirectTitle ( )
Returns
Title|null Title object for the redirect to this page, null if none or not supported

Definition at line 154 of file RevisionSearchResultTrait.php.

◆ getSectionSnippet()

getSectionSnippet ( )
Returns
string Highlighted relevant section name, null if none or not supported

Definition at line 161 of file RevisionSearchResultTrait.php.

◆ getSectionSnippetField()

getSectionSnippetField ( )
Returns
string Name of the field containing the section snippet, '' if not supported

Definition at line 168 of file RevisionSearchResultTrait.php.

◆ getSectionTitle()

getSectionTitle ( )
Returns
Title|null Title object (pagename+fragment) for the section, null if none or not supported

Definition at line 176 of file RevisionSearchResultTrait.php.

◆ getTextSnippet()

getTextSnippet (   $terms = [])
Parameters
string[]$termsTerms to highlight (this parameter is deprecated and ignored)
Returns
string Highlighted text snippet, null (and not '') if not supported

Definition at line 112 of file RevisionSearchResultTrait.php.

◆ getTextSnippetField()

getTextSnippetField ( )
Returns
string Name of the field containing the text snippet, '' if not supported

Definition at line 119 of file RevisionSearchResultTrait.php.

◆ getTimestamp()

◆ getTitle()

getTitle ( )
Returns
Title|null

Definition at line 82 of file RevisionSearchResultTrait.php.

References $mTitle.

Referenced by UploadForm\__construct(), WatchAction\__construct(), PreferencesFormOOUI\addFields(), Article\addHelpLink(), MediaWiki\Output\OutputPage\addParserOutputMetadata(), Skin\addToSidebarPlain(), MediaWiki\Output\OutputPage\addWikiTextAsContent(), MediaWiki\Output\OutputPage\addWikiTextAsInterface(), DeleteAction\alterForm(), McrUndoAction\alterForm(), RevertAction\alterForm(), MediaWiki\Parser\Parser\braceSubstitution(), SkinTemplate\buildCreateAccountData(), SkinTemplate\buildLoginData(), SkinTemplate\buildLogoutLinkData(), Skin\buildNavUrls(), SkinTemplate\buildPersonalUrls(), Action\checkCanExecute(), McrUndoAction\checkCanExecute(), RevertAction\checkCanExecute(), WikiPage\doDeleteArticleBatched(), WikiPage\doDeleteArticleReal(), RecentChange\doMarkPatrolled(), ImagePage\doRenderLangOpt(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\Actions\ActionEntryPoint\execute(), Article\fetchRevisionRecord(), MediaWiki\Parser\Parser\fetchTemplateAndTitle(), MediaWiki\HTMLForm\HTMLForm\getAction(), WikiPage\getAutoDeleteReason(), Skin\getCategories(), Skin\getCategoryLinks(), WikiPage\getCreator(), DifferenceEngine\getDefaultLanguage(), Skin\getDefaultModules(), HistoryAction\getDescription(), RevertAction\getDescription(), LocalFile\getDescriptionText(), MediaWiki\Output\OutputPage\getDisplayTitle(), MediaWiki\Specials\SpecialUpload\getExistsWarning(), MediaWiki\EditPage\EditPage\getExpectedParentRevision(), MediaWiki\Parser\Parser\getExternalLinkAttribs(), MediaWiki\Pager\ImageListPager\getForm(), MediaWiki\Pager\UploadStashPager\getForm(), RevertAction\getFormFields(), MediaWiki\Output\OutputPage\getHeadLinksArray(), MediaWiki\Output\OutputPage\getJSVars(), Skin\getLanguages(), UploadBase\getLocalFile(), Article\getOldIDFromRequest(), Action\getPageTitle(), DeleteAction\getPageTitle(), HistoryAction\getPageTitle(), InfoAction\getPageTitle(), RevertAction\getPageTitle(), WikiPage\getParserOutput(), MediaWiki\EditPage\EditPage\getPreviewText(), RawAction\getRawText(), MediaWiki\Skin\SkinComponentRegistryContext\getRelevantTitle(), Skin\getRelevantTitle(), Article\getRobotPolicy(), WikiPage\getSourceURL(), MediaWiki\Parser\Parser\getTargetLanguage(), Skin\getTemplateData(), Skin\getUndeleteLink(), MediaWiki\Output\OutputPage\getUnprefixedDisplayTitle(), WikiPage\getWikiId(), RollbackAction\handleRollbackRequest(), MediaWiki\Output\OutputPage\headElement(), ImagePage\imageDupes(), ImagePage\imageLinks(), WikiRevision\importLogItem(), MediaWiki\EditPage\EditPage\internalAttemptSave(), WikiCategoryPage\isExpectedUnusedCategory(), Article\isFileCacheable(), WikiCategoryPage\isHidden(), ImagePage\loadFile(), WikiPage\loadLastEdit(), DifferenceEngine\loadRevisionData(), WikiPage\lockAndGetLatest(), MediaWiki\Pager\IndexPager\makeLink(), WikiPage\makeParserOptions(), McrUndoAction\onSubmit(), RevertAction\onSubmit(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), McrUndoAction\onSuccess(), RevertAction\onSuccess(), UnwatchAction\onSuccess(), WatchAction\onSuccess(), HistoryAction\onView(), RawAction\onView(), ImagePage\openShowImage(), CreditsAction\othersLink(), MediaWiki\Output\OutputPage\parseAsContent(), MediaWiki\Output\OutputPage\parseAsInterface(), MediaWiki\Actions\ActionEntryPoint\performAction(), UploadBase\performUpload(), MediaWiki\Specials\SpecialBlock\postHtml(), MediaWiki\Storage\DerivedPageDataUpdater\prepareContent(), SkinTemplate\prepareQuickTemplate(), LocalFile\prerenderThumbnails(), File\purgeDescription(), File\purgeEverything(), RecentChange\reallyMarkPatrolled(), MediaWiki\Parser\Parser\renderImageGallery(), DifferenceEngine\renderNewRevision(), MediaWiki\Actions\ActionEntryPoint\schedulePostSendJobs(), MediaWiki\Output\OutputPage\setFeedAppendQuery(), Article\setOldSubtitle(), SkinTemplate\setupTemplateContext(), Article\showDeletedRevisionHeader(), DifferenceEngine\showDiffPage(), DeleteAction\showEditReasonsLinks(), MediaWiki\Specials\SpecialMovePage\showForm(), MediaWiki\Specials\SpecialRevisionDelete\showForm(), MediaWiki\Specials\SpecialUndelete\showHistory(), Article\showMissingArticle(), Article\showNamespaceHeader(), Article\showPatrolFooter(), Article\showRedirectedFromHeader(), Article\showViewFooter(), DeleteAction\tempDelete(), MediaWiki\EditPage\EditPage\toEditContent(), Article\tryFileCache(), WikiPage\updateCategoryCounts(), ImagePage\uploadLinksBox(), ArchivedFile\userCan(), MediaWiki\Output\OutputPage\userCanPreview(), UploadBase\validateName(), UploadBase\verifyPartialFile(), UploadBase\verifyTitlePermissions(), Article\view(), CategoryPage\view(), ImagePage\view(), File\wasDeleted(), and MediaWiki\Output\OutputPage\wrapWikiTextAsInterface().

◆ getTitleSnippet()

getTitleSnippet ( )
Returns
string Highlighted title, '' if not supported

Definition at line 126 of file RevisionSearchResultTrait.php.

◆ getTitleSnippetField()

getTitleSnippetField ( )
Returns
string Name of the field containing the title snippet, '' if not supported

Definition at line 133 of file RevisionSearchResultTrait.php.

◆ getWordCount()

getWordCount ( )
Returns
int Number of words

Definition at line 209 of file RevisionSearchResultTrait.php.

References initText().

◆ initFromTitle()

initFromTitle (   $title)
protected

Initialize from a Title and if possible initializes a corresponding RevisionRecord and File.

Parameters
Title | null$title

Definition at line 43 of file RevisionSearchResultTrait.php.

References NS_FILE.

Referenced by RevisionSearchResult\__construct().

◆ initText()

initText ( )
protected

Lazy initialization of article text from DB.

Definition at line 97 of file RevisionSearchResultTrait.php.

Referenced by getByteSize(), SqlSearchResult\getTextSnippet(), and getWordCount().

◆ isBrokenTitle()

isBrokenTitle ( )

Check if this is result points to an invalid title.

Returns
bool

Definition at line 66 of file RevisionSearchResultTrait.php.

◆ isFileMatch()

isFileMatch ( )

Did this match file contents (eg: PDF/DJVU)?

Returns
bool

Definition at line 240 of file RevisionSearchResultTrait.php.

◆ isMissingRevision()

isMissingRevision ( )

Check if target page is missing, happens when index is out of date.

Returns
bool

Definition at line 75 of file RevisionSearchResultTrait.php.

References $mImage.

Variable Documentation

◆ $mImage

File null $mImage = null
protected

Definition at line 25 of file RevisionSearchResultTrait.php.

Referenced by getFile(), and isMissingRevision().

◆ $mText

string $mText
protected

◆ $mTitle

◆ RevisionSearchResultTrait

trait RevisionSearchResultTrait
Initial value:
{
protected RevisionRecord|null $mRevisionRecord = null
Page revision base class.

Transitional trait used to share the methods between SearchResult and RevisionSearchResult.

All the content of this trait can be moved to RevisionSearchResult once SearchResult is finally refactored into an abstract class. NOTE: This trait MUST NOT be used by something else than SearchResult and RevisionSearchResult. It will be removed without deprecation period once SearchResult

Definition at line 16 of file RevisionSearchResultTrait.php.