MediaWiki REL1_39
RevisionSearchResultTrait.php File Reference

Go to the source code of this file.

Functions

 getByteSize ()
 
 getCategorySnippet ()
 
 getFile ()
 Get the file for this page, if one exists.
 
 getInterwikiNamespaceText ()
 
 getInterwikiPrefix ()
 
 getRedirectSnippet ()
 
 getRedirectTitle ()
 
 getSectionSnippet ()
 
 getSectionTitle ()
 
 getTextSnippet ( $terms=[])
 
 getTimestamp ()
 
 getTitle ()
 
 getTitleSnippet ()
 
 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 181 of file RevisionSearchResultTrait.php.

References initText().

◆ getCategorySnippet()

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

Definition at line 154 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 196 of file RevisionSearchResultTrait.php.

◆ getInterwikiPrefix()

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

Definition at line 189 of file RevisionSearchResultTrait.php.

◆ getRedirectSnippet()

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

Definition at line 125 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 132 of file RevisionSearchResultTrait.php.

◆ getSectionSnippet()

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

Definition at line 139 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 147 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 111 of file RevisionSearchResultTrait.php.

◆ getTimestamp()

◆ getTitle()

getTitle ( )
Returns
Title|null

Definition at line 81 of file RevisionSearchResultTrait.php.

References $mTitle.

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

◆ getTitleSnippet()

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

Definition at line 118 of file RevisionSearchResultTrait.php.

◆ getWordCount()

getWordCount ( )
Returns
int Number of words

Definition at line 173 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 42 of file RevisionSearchResultTrait.php.

References $title, and NS_FILE.

Referenced by RevisionSearchResult\__construct().

◆ initText()

initText ( )
protected

Lazy initialization of article text from DB.

Definition at line 96 of file RevisionSearchResultTrait.php.

References $content.

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

◆ isBrokenTitle()

isBrokenTitle ( )

Check if this is result points to an invalid title.

Returns
bool

Definition at line 65 of file RevisionSearchResultTrait.php.

◆ isFileMatch()

isFileMatch ( )

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

Returns
bool

Definition at line 204 of file RevisionSearchResultTrait.php.

◆ isMissingRevision()

isMissingRevision ( )

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

Returns
bool

Definition at line 74 of file RevisionSearchResultTrait.php.

References $mImage.

Variable Documentation

◆ $mImage

File null $mImage = null
protected

Definition at line 24 of file RevisionSearchResultTrait.php.

Referenced by getFile(), and isMissingRevision().

◆ $mText

string $mText
protected

Definition at line 34 of file RevisionSearchResultTrait.php.

Referenced by ParserOutput\getRawText(), and TextContent\getText().

◆ $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 15 of file RevisionSearchResultTrait.php.