MediaWiki
1.23.2
|
Public Member Functions | |
__construct ( $context=null, $old=0, $new=0, $rcid=0, $refreshCache=false, $unhide=false) | |
#- More... | |
addHeader ( $diff, $otitle, $ntitle, $multi='', $notice='') | |
Add the header to a diff body. More... | |
deletedIdMarker ( $id) | |
Build a wikitext link toward a deleted revision, if viewable. More... | |
deletedLink ( $id) | |
Look up a special:Undelete link to the given deleted revision id, as a workaround for being unable to load deleted diffs in currently. More... | |
generateContentDiffBody (Content $old, Content $new) | |
Generate a diff, no caching. More... | |
generateDiffBody ( $otext, $ntext) | |
Generate a diff, no caching. More... | |
generateTextDiffBody ( $otext, $ntext) | |
Generate a diff, no caching. More... | |
getDiff ( $otitle, $ntitle, $notice='') | |
Get complete diff table, including header. More... | |
getDiffBody () | |
Get the diff table body, without header. More... | |
getDiffLang () | |
getMultiNotice () | |
If there are revisions between the ones being compared, return a note saying so. More... | |
getNewid () | |
getOldid () | |
loadNewText () | |
Load the text of the new revision, not the old one. More... | |
loadRevisionData () | |
Load revision metadata for the specified articles. More... | |
loadText () | |
Load the text of the revisions, as well as revision data. More... | |
localiseLineNumbers ( $text) | |
Replace line numbers with the text in the user's language. More... | |
localiseLineNumbersCb ( $matches) | |
mapDiffPrevNext ( $old, $new) | |
Maps a revision pair definition as accepted by DifferenceEngine constructor to a pair of actual integers representing revision ids. More... | |
renderNewRevision () | |
Show the new revision of the page. More... | |
setContent (Content $oldContent, Content $newContent) | |
Use specified text instead of loading from the database. More... | |
setReducedLineNumbers ( $value=true) | |
setText ( $oldText, $newText) | |
Use specified text instead of loading from the database. More... | |
setTextLanguage ( $lang) | |
Set the language in which the diff text is written (Defaults to page content language). More... | |
showDiff ( $otitle, $ntitle, $notice='') | |
Get the diff text, send it to the OutputPage object Returns false if the diff could not be generated, otherwise returns true. More... | |
showDiffPage ( $diffOnly=false) | |
showDiffStyle () | |
Add style sheets and supporting JS for diff display. More... | |
wasCacheHit () | |
Public Member Functions inherited from ContextSource | |
canUseWikiPage () | |
Check whether a WikiPage object can be get with getWikiPage(). More... | |
exportSession () | |
Export the resolved user IP, HTTP headers, user ID, and session ID. More... | |
getConfig () | |
Get the Config object. More... | |
getContext () | |
Get the RequestContext object. More... | |
getLang () | |
Get the Language object. More... | |
getLanguage () | |
Get the Language object. More... | |
getOutput () | |
Get the OutputPage object. More... | |
getRequest () | |
Get the WebRequest object. More... | |
getSkin () | |
Get the Skin object. More... | |
getTitle () | |
Get the Title object. More... | |
getUser () | |
Get the User object. More... | |
getWikiPage () | |
Get the WikiPage object. More... | |
msg () | |
Get a Message object with context set Parameters are the same as wfMessage() More... | |
setContext (IContextSource $context) | |
Set the IContextSource object. More... | |
Static Public Member Functions | |
static | intermediateEditsMsg ( $numEdits, $numUsers, $limit) |
Get a notice about how many intermediate edits and users there are. More... | |
Public Attributes | |
$enableDebugComment = false | |
Set this to true to add debug info to the HTML output. More... | |
bool | $mCacheHit = false |
Was the diff fetched from cache? *. More... | |
Content | $mNewContent |
int | $mNewid |
Title | $mNewPage |
Revision | $mNewRev |
Content | $mOldContent |
int | $mOldid |
Title | $mOldPage |
Revision | $mOldRev |
bool | $mRevisionsLoaded = false |
Have the revisions been loaded *. More... | |
int | $mTextLoaded = 0 |
How many text blobs have been loaded, 0, 1 or 2? *. More... | |
Protected Member Functions | |
debug ( $generator="internal") | |
Generate a debug comment indicating diff generating time, server node, and generator backend. More... | |
getDiffBodyCacheKey () | |
Returns the cache key for diff body text or content. More... | |
getParserOutput (WikiPage $page, Revision $rev) | |
getRevisionHeader (Revision $rev, $complete='') | |
Get a header for a specified revision. More... | |
markPatrolledLink () | |
Get a link to mark the change as patrolled, or '' if there's either no revision to patrol or the user is not allowed to to it. More... | |
revisionDeleteLink ( $rev) | |
Protected Attributes | |
Language | $mDiffLang |
string | $mMarkPatrolledLink = null |
Link to action=markpatrolled *. More... | |
bool | $mReducedLineNumbers = false |
If true, line X is not displayed when X is 1, for example to increase readability and conserve space with many small diffs. More... | |
bool | $unhide = false |
Show rev_deleted content if allowed *. More... | |
Private Member Functions | |
loadRevisionIds () | |
Load revision IDs. More... | |
showMissingRevision () | |
Private Attributes | |
$mNewTags | |
$mOldTags | |
bool | $mRevisionsIdsLoaded = false |
Have the revisions IDs been loaded *. More... | |
Definition at line 36 of file DifferenceEngine.php.
DifferenceEngine::__construct | ( | $context = null , |
|
$old = 0 , |
|||
$new = 0 , |
|||
$rcid = 0 , |
|||
$refreshCache = false , |
|||
$unhide = false |
|||
) |
#-
Constructor
IContextSource | $context | context to use, anything else will be ignored |
int | $old | old ID we want to show and diff with. |
string | int | $new | either revision ID or 'prev' or 'next'. Default: 0. |
int | $rcid | Deprecated, no longer used! |
bool | $refreshCache | If set, refreshes the diff cache |
bool | $unhide | If set, allow viewing deleted revs |
Definition at line 92 of file DifferenceEngine.php.
References ContextSource\$context, $unhide, ContextSource\setContext(), and wfDebug().
DifferenceEngine::addHeader | ( | $diff, | |
$otitle, | |||
$ntitle, | |||
$multi = '' , |
|||
$notice = '' |
|||
) |
Add the header to a diff body.
string | $diff | Diff body |
string | $otitle | Old revision header |
string | $ntitle | New revision header |
string | $multi | Notice telling user that there are intermediate revisions between the ones being compared |
string | $notice | Other notices, e.g. that user is viewing deleted content |
Definition at line 1077 of file DifferenceEngine.php.
References getDiffLang().
Referenced by getDiff(), and showDiffPage().
|
protected |
Generate a debug comment indicating diff generating time, server node, and generator backend.
string | $generator | : What diff engine was used |
Definition at line 908 of file DifferenceEngine.php.
References array(), global, TS_DB, wfHostname(), and wfTimestamp().
Referenced by generateTextDiffBody().
DifferenceEngine::deletedIdMarker | ( | $id | ) |
Build a wikitext link toward a deleted revision, if viewable.
int | $id | Revision ID |
Definition at line 186 of file DifferenceEngine.php.
References $link, and deletedLink().
Referenced by showMissingRevision().
DifferenceEngine::deletedLink | ( | $id | ) |
Look up a special:Undelete link to the given deleted revision id, as a workaround for being unable to load deleted diffs in currently.
int | $id | Revision ID |
Definition at line 159 of file DifferenceEngine.php.
References $dbr, $rev, $title, array(), DB_SLAVE, SpecialPage\getTitleFor(), ContextSource\getUser(), Title\makeTitleSafe(), Revision\newFromArchiveRow(), and wfGetDB().
Referenced by deletedIdMarker().
Generate a diff, no caching.
This implementation uses generateTextDiffBody() to generate a diff based on the default serialization of the given Content objects. This will fail if $old or $new are not instances of TextContent.
Subclasses may override this to provide a different rendering for the diff, perhaps taking advantage of the content's native form. This is required for all content models that are not text based.
MWException | If old or new content is not an instance of TextContent. |
Definition at line 783 of file DifferenceEngine.php.
References generateTextDiffBody(), and Content\serialize().
Referenced by getDiffBody().
DifferenceEngine::generateDiffBody | ( | $otext, | |
$ntext | |||
) |
Generate a diff, no caching.
string | $otext | Old text, must be already segmented |
string | $ntext | New text, must be already segmented |
Definition at line 809 of file DifferenceEngine.php.
References ContentHandler\deprecated(), and generateTextDiffBody().
DifferenceEngine::generateTextDiffBody | ( | $otext, | |
$ntext | |||
) |
Generate a diff, no caching.
string | $otext | old text, must be already segmented |
string | $ntext | new text, must be already segmented |
Definition at line 825 of file DifferenceEngine.php.
References $wgContLang, debug(), global, wfEscapeShellArg(), wfProfileIn(), wfProfileOut(), wfShellExec(), and wfTempDir().
Referenced by generateContentDiffBody(), and generateDiffBody().
DifferenceEngine::getDiff | ( | $otitle, | |
$ntitle, | |||
$notice = '' |
|||
) |
Get complete diff table, including header.
string | bool | $otitle | Header for old text or false |
string | bool | $ntitle | Header for new text or false |
string | $notice | HTML between diff header and body |
Definition at line 648 of file DifferenceEngine.php.
References addHeader(), getDiffBody(), getMultiNotice(), and ContextSource\msg().
Referenced by showDiff().
DifferenceEngine::getDiffBody | ( | ) |
Get the diff table body, without header.
Definition at line 670 of file DifferenceEngine.php.
References $wgMemc, array(), Revision\DELETED_TEXT, generateContentDiffBody(), getDiffBodyCacheKey(), global, loadRevisionData(), loadText(), localiseLineNumbers(), wfIncrStats(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by getDiff().
|
protected |
Returns the cache key for diff body text or content.
MWException |
Definition at line 755 of file DifferenceEngine.php.
References MW_DIFF_VERSION, and wfMemcKey().
Referenced by getDiffBody().
DifferenceEngine::getDiffLang | ( | ) |
Definition at line 117 of file DifferenceEngine.php.
References $mDiffLang, and ContextSource\getTitle().
Referenced by addHeader().
DifferenceEngine::getMultiNotice | ( | ) |
If there are revisions between the ones being compared, return a note saying so.
Definition at line 952 of file DifferenceEngine.php.
References $limit, $mNewRev, $mOldRev, and intermediateEditsMsg().
Referenced by getDiff(), and showDiffPage().
DifferenceEngine::getNewid | ( | ) |
Definition at line 145 of file DifferenceEngine.php.
References $mNewid, and loadRevisionIds().
DifferenceEngine::getOldid | ( | ) |
Definition at line 136 of file DifferenceEngine.php.
References $mOldid, and loadRevisionIds().
Definition at line 596 of file DifferenceEngine.php.
References $rev, ContextSource\getContext(), WikiPage\getParserOutput(), Revision\isCurrent(), and WikiPage\makeParserOptions().
Referenced by renderNewRevision().
|
protected |
Get a header for a specified revision.
Revision | $rev | |
string | $complete | 'complete' to get the header wrapped depending the visibility of the revision and a link to edit the page. |
Definition at line 1017 of file DifferenceEngine.php.
References $rev, $timestamp, $title, $user, array(), Revision\DELETED_TEXT, ContextSource\getLanguage(), ContextSource\getUser(), Revision\isCurrent(), Linker\linkKnown(), ContextSource\msg(), and Html\rawElement().
Referenced by renderNewRevision(), and showDiffPage().
|
static |
Get a notice about how many intermediate edits and users there are.
int | $numEdits | |
int | $numUsers | |
int | $limit |
Definition at line 995 of file DifferenceEngine.php.
References $limit, and wfMessage().
Referenced by getMultiNotice().
DifferenceEngine::loadNewText | ( | ) |
Load the text of the new revision, not the old one.
Definition at line 1336 of file DifferenceEngine.php.
References Revision\FOR_THIS_USER, ContextSource\getUser(), and loadRevisionData().
Referenced by renderNewRevision().
DifferenceEngine::loadRevisionData | ( | ) |
Load revision metadata for the specified articles.
If newid is 0, then compare the old article in oldid to the current article; if oldid is 0, then compare the current article to the immediately previous one (ignoring the value of newid).
If oldid is false, leave the corresponding revision object set to false. This is impossible via ordinary user input, and is provided for API convenience.
Definition at line 1222 of file DifferenceEngine.php.
References $dbr, $rev, array(), DB_SLAVE, ContextSource\getTitle(), loadRevisionIds(), Revision\newFromId(), Revision\newFromTitle(), IDBAccessObject\READ_NORMAL, and wfGetDB().
Referenced by getDiffBody(), loadNewText(), loadText(), and showDiffPage().
|
private |
Load revision IDs.
Definition at line 1187 of file DifferenceEngine.php.
References $mNewid, $mOldid, array(), ContextSource\getTitle(), list, mapDiffPrevNext(), and wfRunHooks().
Referenced by getNewid(), getOldid(), and loadRevisionData().
DifferenceEngine::loadText | ( | ) |
Load the text of the revisions, as well as revision data.
Definition at line 1302 of file DifferenceEngine.php.
References Revision\FOR_THIS_USER, ContextSource\getUser(), and loadRevisionData().
Referenced by getDiffBody().
DifferenceEngine::localiseLineNumbers | ( | $text | ) |
Replace line numbers with the text in the user's language.
string | $text |
Definition at line 931 of file DifferenceEngine.php.
References array().
Referenced by getDiffBody().
DifferenceEngine::localiseLineNumbersCb | ( | $matches | ) |
Definition at line 939 of file DifferenceEngine.php.
References $matches, and ContextSource\msg().
DifferenceEngine::mapDiffPrevNext | ( | $old, | |
$new | |||
) |
Maps a revision pair definition as accepted by DifferenceEngine constructor to a pair of actual integers representing revision ids.
int | $old | Revision id, e.g. from URL parameter 'oldid' |
int | string | $new | Revision id or strings 'next' or 'prev', e.g. from URL parameter 'diff' |
Definition at line 1167 of file DifferenceEngine.php.
References array(), and ContextSource\getTitle().
Referenced by loadRevisionIds().
|
protected |
Get a link to mark the change as patrolled, or '' if there's either no revision to patrol or the user is not allowed to to it.
Side effect: When the patrol link is build, this method will call OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.
Definition at line 443 of file DifferenceEngine.php.
References $mMarkPatrolledLink, $user, array(), DB_SLAVE, ContextSource\getOutput(), ContextSource\getUser(), global, RecentChange\isInRCLifespan(), Linker\linkKnown(), ContextSource\msg(), RecentChange\newFromConds(), and wfGetDB().
Referenced by renderNewRevision(), and showDiffPage().
DifferenceEngine::renderNewRevision | ( | ) |
Show the new revision of the page.
Definition at line 524 of file DifferenceEngine.php.
References $article, $out, array(), WikiPage\factory(), ContextSource\getContext(), ContextSource\getOutput(), getParserOutput(), getRevisionHeader(), ContextSource\getTitle(), ContextSource\getWikiPage(), loadNewText(), markPatrolledLink(), Article\newFromTitle(), ContentHandler\runLegacyHooks(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by showDiffPage().
|
protected |
Revision | $rev |
Definition at line 512 of file DifferenceEngine.php.
References $link, $rev, Linker\getRevDeleteLink(), and ContextSource\getUser().
Referenced by showDiffPage().
Use specified text instead of loading from the database.
Definition at line 1139 of file DifferenceEngine.php.
Referenced by setText().
DifferenceEngine::setReducedLineNumbers | ( | $value = true | ) |
DifferenceEngine::setText | ( | $oldText, | |
$newText | |||
) |
Use specified text instead of loading from the database.
Definition at line 1126 of file DifferenceEngine.php.
References ContentHandler\deprecated(), ContextSource\getTitle(), ContentHandler\makeContent(), and setContent().
DifferenceEngine::setTextLanguage | ( | $lang | ) |
Set the language in which the diff text is written (Defaults to page content language).
Definition at line 1152 of file DifferenceEngine.php.
References wfGetLangObj().
DifferenceEngine::showDiff | ( | $otitle, | |
$ntitle, | |||
$notice = '' |
|||
) |
Get the diff text, send it to the OutputPage object Returns false if the diff could not be generated, otherwise returns true.
string | bool | $otitle | Header for old text or false |
string | bool | $ntitle | Header for new text or false |
string | $notice | HTML between diff header and body |
Definition at line 618 of file DifferenceEngine.php.
References getDiff(), ContextSource\getOutput(), showDiffStyle(), and showMissingRevision().
Referenced by showDiffPage().
DifferenceEngine::showDiffPage | ( | $diffOnly = false | ) |
Definition at line 215 of file DifferenceEngine.php.
References $link, $out, $query, $user, addHeader(), array(), as, below, Revision\DELETED_RESTRICTED, Revision\DELETED_TEXT, Html\element(), ChangesList\flag(), ChangeTags\formatSummaryRow(), Linker\generateRollback(), ContextSource\getContext(), getMultiNotice(), ContextSource\getOutput(), ContextSource\getRequest(), getRevisionHeader(), ContextSource\getTitle(), ContextSource\getUser(), Linker\linkKnown(), loadRevisionData(), markPatrolledLink(), ContextSource\msg(), renderNewRevision(), Linker\revComment(), revisionDeleteLink(), Linker\revUserTools(), see, showDiff(), showDiffStyle(), showMissingRevision(), Linker\titleAttrib(), wfMergeErrorArrays(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
DifferenceEngine::showDiffStyle | ( | ) |
Add style sheets and supporting JS for diff display.
Definition at line 635 of file DifferenceEngine.php.
References ContextSource\getOutput().
Referenced by showDiff(), and showDiffPage().
|
private |
Definition at line 195 of file DifferenceEngine.php.
References $out, array(), deletedIdMarker(), ContextSource\getLanguage(), ContextSource\getOutput(), and ContextSource\msg().
Referenced by showDiff(), and showDiffPage().
DifferenceEngine::wasCacheHit | ( | ) |
DifferenceEngine::$enableDebugComment = false |
Set this to true to add debug info to the HTML output.
Warning: this may cause RSS readers to spuriously mark articles as "new" (bug 20601)
Definition at line 72 of file DifferenceEngine.php.
bool DifferenceEngine::$mCacheHit = false |
Was the diff fetched from cache? *.
Definition at line 65 of file DifferenceEngine.php.
Referenced by wasCacheHit().
|
protected |
|
protected |
Link to action=markpatrolled *.
Definition at line 78 of file DifferenceEngine.php.
Referenced by markPatrolledLink().
Content DifferenceEngine::$mNewContent |
Definition at line 47 of file DifferenceEngine.php.
int DifferenceEngine::$mNewid |
Definition at line 40 of file DifferenceEngine.php.
Referenced by getNewid(), and loadRevisionIds().
Title DifferenceEngine::$mNewPage |
Definition at line 53 of file DifferenceEngine.php.
Revision DifferenceEngine::$mNewRev |
|
private |
Definition at line 43 of file DifferenceEngine.php.
Content DifferenceEngine::$mOldContent |
Definition at line 45 of file DifferenceEngine.php.
int DifferenceEngine::$mOldid |
Definition at line 38 of file DifferenceEngine.php.
Referenced by getOldid(), and loadRevisionIds().
Title DifferenceEngine::$mOldPage |
Definition at line 51 of file DifferenceEngine.php.
Revision DifferenceEngine::$mOldRev |
|
private |
Definition at line 42 of file DifferenceEngine.php.
|
protected |
If true, line X is not displayed when X is 1, for example to increase readability and conserve space with many small diffs.
Definition at line 76 of file DifferenceEngine.php.
|
private |
Have the revisions IDs been loaded *.
Definition at line 59 of file DifferenceEngine.php.
bool DifferenceEngine::$mRevisionsLoaded = false |
Have the revisions been loaded *.
Definition at line 61 of file DifferenceEngine.php.
int DifferenceEngine::$mTextLoaded = 0 |
How many text blobs have been loaded, 0, 1 or 2? *.
Definition at line 63 of file DifferenceEngine.php.
|
protected |
Show rev_deleted content if allowed *.
Definition at line 80 of file DifferenceEngine.php.
Referenced by __construct().