MediaWiki
REL1_19
|
Public Member Functions | |
__construct ($context=null, $old=0, $new=0, $rcid=0, $refreshCache=false, $unhide=false) | |
#@- | |
addHeader ($diff, $otitle, $ntitle, $multi= '', $notice= '') | |
Add the header to a diff body. | |
deletedIdMarker ($id) | |
Build a wikitext link toward a deleted revision, if viewable. | |
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. | |
generateDiffBody ($otext, $ntext) | |
Generate a diff, no caching. | |
getDiff ($otitle, $ntitle, $notice= '') | |
Get complete diff table, including header. | |
getDiffBody () | |
Get the diff table body, without header. | |
getDiffLang () | |
getMultiNotice () | |
If there are revisions between the ones being compared, return a note saying so. | |
getNewid () | |
getOldid () | |
loadNewText () | |
Load the text of the new revision, not the old one. | |
loadRevisionData () | |
Load revision metadata for the specified articles. | |
loadText () | |
Load the text of the revisions, as well as revision data. | |
localiseLineNumbers ($text) | |
Replace line numbers with the text in the user's language. | |
localiseLineNumbersCb ($matches) | |
renderNewRevision () | |
Show the new revision of the page. | |
setReducedLineNumbers ($value=true) | |
setText ($oldText, $newText) | |
Use specified text instead of loading from the database. | |
setTextLanguage ($lang) | |
Set the language in which the diff text is written (Defaults to page content language). | |
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. | |
showDiffPage ($diffOnly=false) | |
showDiffStyle () | |
Add style sheets and supporting JS for diff display. | |
wasCacheHit () | |
Static Public Member Functions | |
static | intermediateEditsMsg ($numEdits, $numUsers, $limit) |
Get a notice about how many intermediate edits and users there are. | |
Public Attributes | |
$enableDebugComment = false | |
Set this to true to add debug info to the HTML output. | |
$mCacheHit = false | |
$mNewid | |
$mNewPage | |
$mNewRev | |
$mNewtext | |
$mOldid | |
#@+ | |
$mOldPage | |
$mOldRev | |
$mOldtext | |
$mRcidMarkPatrolled | |
$mRevisionsLoaded = false | |
$mTextLoaded = 0 | |
Protected Member Functions | |
debug ($generator="internal") | |
Generate a debug comment indicating diff generating time, server node, and generator backend. | |
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. | |
revisionDeleteLink ($rev) | |
Protected Attributes | |
$mDiffLang | |
$mMarkPatrolledLink = null | |
$mReducedLineNumbers = false | |
$unhide = false | |
Private Member Functions | |
getRevisionHeader (Revision $rev, $complete= '') | |
Get a header for a specified revision. | |
initDiffEngines () | |
Make sure the proper modules are loaded before we try to make the diff. | |
loadRevisionIds () | |
Load revision IDs. | |
Private Attributes | |
$mRevisionsIdsLoaded = false |
Definition at line 21 of file DifferenceEngine.php.
DifferenceEngine::__construct | ( | $ | context = null , |
$ | old = 0 , |
||
$ | new = 0 , |
||
$ | rcid = 0 , |
||
$ | refreshCache = false , |
||
$ | unhide = false |
||
) |
#@-
Constructor
$context | IContextSource context to use, anything else will be ignored |
$old | Integer old ID we want to show and diff with. |
$new | String either 'prev' or 'next'. |
$rcid | Integer ??? FIXME (default 0) |
$refreshCache | boolean If set, refreshes the diff cache |
$unhide | boolean If set, allow viewing deleted revs |
Definition at line 70 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.
Definition at line 884 of file DifferenceEngine.php.
References getDiffLang().
Referenced by getDiff(), and showDiffPage().
DifferenceEngine::debug | ( | $ | generator = "internal" | ) | [protected] |
Generate a debug comment indicating diff generating time, server node, and generator backend.
Definition at line 751 of file DifferenceEngine.php.
References $wgShowHostnames, wfHostname(), and wfTimestamp().
Referenced by generateDiffBody().
Build a wikitext link toward a deleted revision, if viewable.
int | $id | revision ID |
Definition at line 158 of file DifferenceEngine.php.
References deletedLink().
Referenced by showDiffPage().
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 134 of file DifferenceEngine.php.
References $dbr, $title, SpecialPage\getTitleFor(), ContextSource\getUser(), Title\makeTitleSafe(), Revision\newFromArchiveRow(), and wfGetDB().
Referenced by deletedIdMarker().
DifferenceEngine::generateDiffBody | ( | $ | otext, |
$ | ntext | ||
) |
Generate a diff, no caching.
$otext | String: old text, must be already segmented |
$ntext | String: new text, must be already segmented |
Definition at line 676 of file DifferenceEngine.php.
References $wgContLang, $wgExternalDiffEngine, $wgTmpDirectory, debug(), initDiffEngines(), wfEscapeShellArg(), wfProfileIn(), wfProfileOut(), and wfShellExec().
Referenced by getDiffBody().
DifferenceEngine::getDiff | ( | $ | otitle, |
$ | ntitle, | ||
$ | notice = '' |
||
) |
Get complete diff table, including header.
$otitle | Title: old title |
$ntitle | Title: new title |
$notice | String: HTML between diff header and body |
Definition at line 570 of file DifferenceEngine.php.
References addHeader(), getDiffBody(), and getMultiNotice().
Referenced by showDiff().
Get the diff table body, without header.
Definition at line 585 of file DifferenceEngine.php.
References $wgMemc, Revision\DELETED_TEXT, generateDiffBody(), loadRevisionData(), loadText(), localiseLineNumbers(), wfIncrStats(), wfMemcKey(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by getDiff().
Definition at line 96 of file DifferenceEngine.php.
References ContextSource\getTitle().
Referenced by addHeader().
If there are revisions between the ones being compared, return a note saying so.
Definition at line 787 of file DifferenceEngine.php.
References $limit, and intermediateEditsMsg().
Referenced by getDiff(), and showDiffPage().
Definition at line 122 of file DifferenceEngine.php.
References loadRevisionIds().
Referenced by ApiQueryRevisions\extractRowInfo().
Definition at line 114 of file DifferenceEngine.php.
References loadRevisionIds().
Referenced by ApiQueryRevisions\extractRowInfo().
DifferenceEngine::getRevisionHeader | ( | Revision $ | rev, |
$ | complete = '' |
||
) | [private] |
Get a header for a specified revision.
$rev | Revision |
$complete | String: 'complete' to get the header wrapped depending the visibility of the revision and a link to edit the page. |
Definition at line 837 of file DifferenceEngine.php.
References $title, $user, Revision\DELETED_TEXT, ContextSource\getLanguage(), Revision\getTimestamp(), Revision\getTitle(), ContextSource\getUser(), Revision\isCurrent(), Revision\isDeleted(), Linker\linkKnown(), ContextSource\msg(), Html\rawElement(), and Revision\userCan().
Referenced by renderNewRevision(), and showDiffPage().
DifferenceEngine::initDiffEngines | ( | ) | [private] |
Make sure the proper modules are loaded before we try to make the diff.
Definition at line 656 of file DifferenceEngine.php.
References $wgExternalDiffEngine, wfDl(), wfProfileIn(), and wfProfileOut().
Referenced by generateDiffBody().
static DifferenceEngine::intermediateEditsMsg | ( | $ | numEdits, |
$ | numUsers, | ||
$ | limit | ||
) | [static] |
Get a notice about how many intermediate edits and users there are.
$numEdits | int |
$numUsers | int |
$limit | int |
Definition at line 819 of file DifferenceEngine.php.
References $limit, and wfMessage().
Referenced by getMultiNotice().
Load the text of the new revision, not the old one.
Definition at line 1078 of file DifferenceEngine.php.
References Revision\FOR_THIS_USER, and loadRevisionData().
Referenced by renderNewRevision().
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 992 of file DifferenceEngine.php.
References ContextSource\getTitle(), loadRevisionIds(), Revision\newFromId(), and Revision\newFromTitle().
Referenced by getDiffBody(), loadNewText(), loadText(), and showDiffPage().
DifferenceEngine::loadRevisionIds | ( | ) | [private] |
Load revision IDs.
Definition at line 948 of file DifferenceEngine.php.
References ContextSource\getTitle(), and wfRunHooks().
Referenced by getNewid(), getOldid(), and loadRevisionData().
Load the text of the revisions, as well as revision data.
Definition at line 1047 of file DifferenceEngine.php.
References Revision\FOR_THIS_USER, and loadRevisionData().
Referenced by getDiffBody().
DifferenceEngine::localiseLineNumbers | ( | $ | text | ) |
Replace line numbers with the text in the user's language.
Definition at line 772 of file DifferenceEngine.php.
Referenced by getDiffBody().
DifferenceEngine::localiseLineNumbersCb | ( | $ | matches | ) |
Definition at line 777 of file DifferenceEngine.php.
References $matches, and ContextSource\msg().
DifferenceEngine::markPatrolledLink | ( | ) | [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: this method will call OutputPage::preventClickjacking() when a link is builded.
Definition at line 401 of file DifferenceEngine.php.
References $wgUseRCPatrol, ContextSource\getOutput(), ContextSource\getUser(), Linker\linkKnown(), ContextSource\msg(), RecentChange\newFromConds(), RecentChange\newFromId(), and wfGetDB().
Referenced by renderNewRevision(), and showDiffPage().
Show the new revision of the page.
Definition at line 475 of file DifferenceEngine.php.
References $out, WikiPage\factory(), ContextSource\getContext(), ContextSource\getOutput(), getRevisionHeader(), ContextSource\getTitle(), ContextSource\getWikiPage(), loadNewText(), markPatrolledLink(), ParserOptions\newFromContext(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by showDiffPage().
DifferenceEngine::revisionDeleteLink | ( | $ | rev | ) | [protected] |
$rev | Revision |
Definition at line 464 of file DifferenceEngine.php.
References Linker\getRevDeleteLink(), and ContextSource\getUser().
Referenced by showDiffPage().
DifferenceEngine::setReducedLineNumbers | ( | $ | value = true | ) |
$value | bool |
Definition at line 89 of file DifferenceEngine.php.
DifferenceEngine::setText | ( | $ | oldText, |
$ | newText | ||
) |
Use specified text instead of loading from the database.
Definition at line 929 of file DifferenceEngine.php.
Referenced by EditPage\showConflict(), EditPage\showDiff(), and EditPage\spamPageWithContent().
DifferenceEngine::setTextLanguage | ( | $ | lang | ) |
Set the language in which the diff text is written (Defaults to page content language).
Definition at line 941 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.
Definition at line 543 of file DifferenceEngine.php.
References getDiff(), ContextSource\getOutput(), and showDiffStyle().
Referenced by RollbackAction\onView(), and showDiffPage().
DifferenceEngine::showDiffPage | ( | $ | diffOnly = false | ) |
Definition at line 167 of file DifferenceEngine.php.
References $out, $t, $urls, $user, addHeader(), Revision\DELETED_RESTRICTED, Revision\DELETED_TEXT, deletedIdMarker(), Html\element(), ChangesList\flag(), Linker\generateRollback(), ContextSource\getContext(), getMultiNotice(), ContextSource\getOutput(), ContextSource\getRequest(), getRevisionHeader(), ContextSource\getSkin(), ContextSource\getTitle(), ContextSource\getUser(), Linker\linkKnown(), loadRevisionData(), markPatrolledLink(), ContextSource\msg(), renderNewRevision(), Linker\revComment(), revisionDeleteLink(), Linker\revUserTools(), showDiff(), showDiffStyle(), Linker\titleAttrib(), wfMergeErrorArrays(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by SpecialComparePages\showDiff().
Add style sheets and supporting JS for diff display.
Definition at line 558 of file DifferenceEngine.php.
References ContextSource\getOutput().
Referenced by showDiff(), and showDiffPage().
Definition at line 107 of file DifferenceEngine.php.
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 49 of file DifferenceEngine.php.
DifferenceEngine::$mCacheHit = false |
Definition at line 42 of file DifferenceEngine.php.
DifferenceEngine::$mDiffLang [protected] |
Definition at line 27 of file DifferenceEngine.php.
DifferenceEngine::$mMarkPatrolledLink = null [protected] |
Definition at line 56 of file DifferenceEngine.php.
DifferenceEngine::$mNewid |
Definition at line 25 of file DifferenceEngine.php.
DifferenceEngine::$mNewPage |
Definition at line 32 of file DifferenceEngine.php.
DifferenceEngine::$mNewRev |
Definition at line 38 of file DifferenceEngine.php.
DifferenceEngine::$mNewtext |
Definition at line 26 of file DifferenceEngine.php.
DifferenceEngine::$mOldid |
DifferenceEngine::$mOldPage |
Definition at line 32 of file DifferenceEngine.php.
DifferenceEngine::$mOldRev |
Definition at line 38 of file DifferenceEngine.php.
DifferenceEngine::$mOldtext |
Definition at line 26 of file DifferenceEngine.php.
DifferenceEngine::$mRcidMarkPatrolled |
Definition at line 33 of file DifferenceEngine.php.
DifferenceEngine::$mReducedLineNumbers = false [protected] |
Definition at line 53 of file DifferenceEngine.php.
DifferenceEngine::$mRevisionsIdsLoaded = false [private] |
Definition at line 39 of file DifferenceEngine.php.
DifferenceEngine::$mRevisionsLoaded = false |
Definition at line 40 of file DifferenceEngine.php.
DifferenceEngine::$mTextLoaded = 0 |
Definition at line 41 of file DifferenceEngine.php.
DifferenceEngine::$unhide = false [protected] |
Definition at line 58 of file DifferenceEngine.php.
Referenced by __construct().