Go to the documentation of this file.
30 define(
'MW_DIFF_VERSION',
'1.11a' );
109 $refreshCache =
false,
$unhide =
false
115 wfDebug(
"DifferenceEngine old '$old' new '$new' rcid '$rcid'\n" );
117 $this->mOldid = $old;
118 $this->mNewid = $new;
119 $this->mRefreshCache = $refreshCache;
127 $this->mReducedLineNumbers =
$value;
134 if ( $this->mDiffLang ===
null ) {
135 # Default language in which the diff text is written.
136 $this->mDiffLang = $this->
getTitle()->getPageLanguage();
176 if ( $this->
getUser()->isAllowed(
'deletedhistory' ) ) {
178 $row =
$dbr->selectRow(
'archive',
'*',
179 array(
'ar_rev_id' => $id ),
187 'timestamp' =>
$rev->getTimestamp()
205 return "[$link $id]";
215 if ( $this->mOldRev ===
null ||
216 ( $this->mOldRev && $this->mOldContent ===
null )
220 if ( $this->mNewRev ===
null ||
221 ( $this->mNewRev && $this->mNewContent ===
null )
226 $out->setPageTitle( $this->
msg(
'errorpagetitle' ) );
227 $out->addWikiMsg(
'difference-missing-revision',
228 $this->
getLanguage()->listToText( $missing ), count( $missing ) );
234 # Allow frames except in certain special cases
236 $out->allowClickjacking();
237 $out->setRobotPolicy(
'noindex,nofollow' );
247 $permErrors = $this->mNewPage->getUserPermissionsErrors(
'read',
$user );
248 if ( $this->mOldPage ) { # mOldPage might not be
set,
see below.
250 $this->mOldPage->getUserPermissionsErrors(
'read',
$user ) );
252 if ( count( $permErrors ) ) {
260 # Carry over 'diffonly' param via navigation links
261 if ( $diffOnly !=
$user->getBoolOption(
'diffonly' ) ) {
262 $query[
'diffonly'] = $diffOnly;
264 # Cascade unhide param in links for easy deletion browsing
265 if ( $this->unhide ) {
269 # Check if one of the revisions is deleted/suppressed
270 $deleted = $suppressed =
false;
273 $revisionTools =
array();
275 # mOldRev is false if the difference engine is called with a "vague" query for
276 # a diff between a version V and its previous version V' AND the version V
277 # is the first version of that article. In that case, V' does not exist.
278 if ( $this->mOldRev ===
false ) {
279 $out->setPageTitle( $this->
msg(
'difference-title', $this->mNewPage->getPrefixedText() ) );
283 wfRunHooks(
'DiffViewHeader',
array( $this, $this->mOldRev, $this->mNewRev ) );
285 if ( $this->mNewPage->equals( $this->mOldPage ) ) {
286 $out->setPageTitle( $this->
msg(
'difference-title', $this->mNewPage->getPrefixedText() ) );
289 $out->setPageTitle( $this->
msg(
'difference-title-multipage',
290 $this->mOldPage->getPrefixedText(), $this->mNewPage->getPrefixedText() ) );
291 $out->addSubtitle( $this->
msg(
'difference-multipage' ) );
295 if ( $samePage && $this->mNewPage->quickUserCan(
'edit',
$user ) ) {
296 if ( $this->mNewRev->isCurrent() && $this->mNewPage->userCan(
'rollback',
$user ) ) {
298 if ( $rollbackLink ) {
299 $out->preventClickjacking();
300 $rollback =
'   ' . $rollbackLink;
308 'href' => $this->mNewPage->getLocalURL(
array(
310 'undoafter' => $this->mOldid,
311 'undo' => $this->mNewid
315 $this->
msg(
'editundo' )->text()
317 $revisionTools[] = $undoLink;
321 # Make "previous revision link"
322 if ( $samePage && $this->mOldRev->getPrevious() ) {
325 $this->
msg(
'previousdiff' )->escaped(),
326 array(
'id' =>
'differences-prevlink' ),
327 array(
'diff' =>
'prev',
'oldid' => $this->mOldid ) +
$query
330 $prevlink =
' ';
333 if ( $this->mOldRev->isMinor() ) {
343 $oldHeader =
'<div id="mw-diff-otitle1"><strong>' . $oldRevisionHeader .
'</strong></div>' .
344 '<div id="mw-diff-otitle2">' .
346 '<div id="mw-diff-otitle3">' . $oldminor .
348 '<div id="mw-diff-otitle5">' . $oldChangeTags[0] .
'</div>' .
349 '<div id="mw-diff-otitle4">' . $prevlink .
'</div>';
358 # Check if this user can see the revisions
364 # Make "next revision link"
365 # Skip next link on the top revision
366 if ( $samePage && !$this->mNewRev->isCurrent() ) {
369 $this->
msg(
'nextdiff' )->escaped(),
370 array(
'id' =>
'differences-nextlink' ),
371 array(
'diff' =>
'next',
'oldid' => $this->mNewid ) +
$query
374 $nextlink =
' ';
377 if ( $this->mNewRev->isMinor() ) {
383 # Handle RevisionDelete links...
386 # Allow extensions to define their own revision tools
387 wfRunHooks(
'DiffRevisionTools',
array( $this->mNewRev, &$revisionTools, $this->mOldRev ) );
388 $formattedRevisionTools =
array();
390 foreach ( $revisionTools
as $tool ) {
391 $formattedRevisionTools[] = $this->
msg(
'parentheses' )->rawParams( $tool )->escaped();
394 ' ' . implode(
' ', $formattedRevisionTools );
397 $newHeader =
'<div id="mw-diff-ntitle1"><strong>' . $newRevisionHeader .
'</strong></div>' .
400 '<div id="mw-diff-ntitle3">' . $newminor .
402 '<div id="mw-diff-ntitle5">' . $newChangeTags[0] .
'</div>' .
403 '<div id="mw-diff-ntitle4">' . $nextlink . $this->
markPatrolledLink() .
'</div>';
412 # If the diff cannot be shown due to a deleted revision, then output
413 # the diff header and links to unhide (if available)...
414 if ( $deleted && ( !$this->unhide || !$allowed ) ) {
417 $out->addHTML( $this->
addHeader(
'', $oldHeader, $newHeader, $multi ) );
419 $msg = $suppressed ?
'rev-suppressed-no-diff' :
'rev-deleted-no-diff';
420 # Give explanation for why revision is not visible
421 $out->wrapWikiMsg(
"<div id='mw-$msg' class='mw-warning plainlinks'>\n$1\n</div>\n",
424 # Give explanation and add a link to view the diff...
427 $msg = $suppressed ?
'rev-suppressed-unhide-diff' :
'rev-deleted-unhide-diff';
429 "<div id='mw-$msg' class='mw-warning plainlinks'>\n$1\n</div>\n",
433 # Otherwise, output a regular diff...
435 # Add deletion notice if the user is viewing deleted content
438 $msg = $suppressed ?
'rev-suppressed-diff-view' :
'rev-deleted-diff-view';
439 $notice =
"<div id='mw-$msg' class='mw-warning plainlinks'>\n" .
440 $this->
msg( $msg )->parse() .
443 $this->
showDiff( $oldHeader, $newHeader, $notice );
460 global $wgUseRCPatrol, $wgEnableAPI, $wgEnableWriteAPI;
463 if ( $this->mMarkPatrolledLink ===
null ) {
467 $wgUseRCPatrol && $this->mNewPage->quickUserCan(
'patrol',
$user ) &&
477 'rc_timestamp' => $db->timestamp( $this->mNewRev->getTimestamp() ),
478 'rc_this_oldid' => $this->mNewid,
482 array(
'USE INDEX' =>
'rc_timestamp' )
485 if ( $change && $change->getPerformer()->getName() !==
$user->getName() ) {
486 $rcid = $change->getAttribute(
'rc_id' );
494 $this->
getOutput()->preventClickjacking();
495 if ( $wgEnableAPI && $wgEnableWriteAPI
496 &&
$user->isAllowed(
'writeapi' )
498 $this->
getOutput()->addModules(
'mediawiki.page.patrol.ajax' );
501 $token =
$user->getEditToken( $rcid );
504 $this->
msg(
'markaspatrolleddiff' )->escaped(),
507 'action' =>
'markpatrolled',
513 $this->mMarkPatrolledLink =
'';
516 $this->mMarkPatrolledLink =
'';
530 if (
$link !==
'' ) {
544 # Add "current version as of X" title
545 $out->addHTML(
"<hr class='diff-hr' />
546 <h2 class='diff-currentversion-title'>{$revHeader}</h2>\n" );
547 # Page content may be handled by a hooked call instead...
548 # @codingStandardsIgnoreStart Ignoring long lines.
551 $out->setRevisionId( $this->mNewid );
552 $out->setRevisionTimestamp( $this->mNewRev->getTimestamp() );
553 $out->setArticleFlag(
true );
556 if ( $this->mNewPage->isCssJsSubpage() || $this->mNewPage->isCssOrJsPage() ) {
563 $cnt = $this->mNewRev->getContent();
564 $po = $cnt ? $cnt->getParserOutput( $this->mNewRev->getTitle(), $this->mNewRev->getId() ) :
null;
565 $txt = $po ? $po->getText() :
'';
566 $out->addHTML( $txt );
568 } elseif ( !
wfRunHooks(
'ArticleContentViewCustom',
array( $this->mNewContent, $this->mNewPage,
$out ) ) ) {
575 if ( $this->
getTitle()->equals( $this->mNewPage ) ) {
587 # Also try to load it as a redirect
588 $rt = $this->mNewContent ? $this->mNewContent->getRedirectTarget() :
null;
594 # WikiPage::getParserOutput() should not return false, but just in case
595 if ( $parserOutput ) {
596 # Show categories etc.
597 $out->addParserOutputNoText( $parserOutput );
599 } elseif ( $parserOutput ) {
600 $out->addParserOutput( $parserOutput );
604 # @codingStandardsIgnoreEnd
606 # Add redundant patrol link on bottom...
615 if ( !$rev->
isCurrent() || !
$rev->getTitle()->quickUserCan(
"edit" ) ) {
616 $parserOptions->setEditSection(
false );
621 return $parserOutput;
634 public function showDiff( $otitle, $ntitle, $notice =
'' ) {
635 $diff = $this->
getDiff( $otitle, $ntitle, $notice );
636 if ( $diff ===
false ) {
652 $this->
getOutput()->addModuleStyles(
'mediawiki.action.history.diff' );
664 public function getDiff( $otitle, $ntitle, $notice =
'' ) {
666 if ( $body ===
false ) {
672 if ( $body ===
'' ) {
673 $notice .=
'<div class="mw-diff-empty">' .
674 $this->
msg(
'diff-empty' )->parse() .
678 return $this->
addHeader( $body, $otitle, $ntitle, $multi, $notice );
689 $this->mCacheHit =
true;
695 } elseif ( $this->mOldRev &&
701 } elseif ( $this->mNewRev &&
709 if ( $this->mOldRev ===
false || ( $this->mOldRev && $this->mNewRev
710 && $this->mOldRev->getID() == $this->mNewRev->getID() )
718 if ( $this->mOldid && $this->mNewid ) {
722 if ( !$this->mRefreshCache ) {
723 $difftext =
$wgMemc->get( $key );
727 $difftext .=
"\n<!-- diff cache key $key -->\n";
734 $this->mCacheHit =
false;
748 } elseif ( $key !==
false && $difftext !==
false ) {
750 $wgMemc->set( $key, $difftext, 7 * 86400 );
755 if ( $difftext !==
false ) {
772 if ( !$this->mOldid || !$this->mNewid ) {
773 throw new MWException(
'mOldid and mNewid must be set to get diff cache key.' );
777 'oldid', $this->mOldid,
'newid', $this->mNewid );
801 throw new MWException(
"Diff not implemented for " . get_class( $old ) .
"; " .
802 "override generateContentDiffBody to fix this." );
806 throw new MWException(
"Diff not implemented for " . get_class( $new ) .
"; "
807 .
"override generateContentDiffBody to fix this." );
846 $otext = str_replace(
"\r\n",
"\n", $otext );
847 $ntext = str_replace(
"\r\n",
"\n", $ntext );
849 if ( $wgExternalDiffEngine ==
'wikidiff' && function_exists(
'wikidiff_do_diff' ) ) {
850 # For historical reasons, external diff engine expects
851 # input text to be HTML-escaped already
852 $otext = htmlspecialchars(
$wgContLang->segmentForDiff( $otext ) );
853 $ntext = htmlspecialchars(
$wgContLang->segmentForDiff( $ntext ) );
856 return $wgContLang->unsegmentForDiff( wikidiff_do_diff( $otext, $ntext, 2 ) ) .
857 $this->
debug(
'wikidiff1' );
860 if ( $wgExternalDiffEngine ==
'wikidiff2' && function_exists(
'wikidiff2_do_diff' ) ) {
861 # Better external diff engine, the 2 may some day be dropped
862 # This one does the escaping and segmenting itself
864 $text = wikidiff2_do_diff( $otext, $ntext, 2 );
865 $text .= $this->
debug(
'wikidiff2' );
871 if ( $wgExternalDiffEngine !=
'wikidiff3' && $wgExternalDiffEngine !==
false ) {
874 $tempName1 = tempnam( $tmpDir,
'diff_' );
875 $tempName2 = tempnam( $tmpDir,
'diff_' );
877 $tempFile1 = fopen( $tempName1,
"w" );
883 $tempFile2 = fopen( $tempName2,
"w" );
889 fwrite( $tempFile1, $otext );
890 fwrite( $tempFile2, $ntext );
891 fclose( $tempFile1 );
892 fclose( $tempFile2 );
896 $difftext .= $this->
debug(
"external $wgExternalDiffEngine" );
898 unlink( $tempName1 );
899 unlink( $tempName2 );
906 $ota = explode(
"\n",
$wgContLang->segmentForDiff( $otext ) );
907 $nta = explode(
"\n",
$wgContLang->segmentForDiff( $ntext ) );
908 $diffs =
new Diff( $ota, $nta );
910 $difftext =
$wgContLang->unsegmentForDiff( $formatter->format( $diffs ) ) .
924 protected function debug( $generator =
"internal" ) {
926 if ( !$this->enableDebugComment ) {
929 $data =
array( $generator );
930 if ( $wgShowHostnames ) {
935 return "<!-- diff generator: " .
936 implode(
" ", array_map(
"htmlspecialchars", $data ) ) .
948 return preg_replace_callback(
949 '/<!--LINE (\d+)-->/',
950 array( &$this,
'localiseLineNumbersCb' ),
956 if (
$matches[1] ===
'1' && $this->mReducedLineNumbers ) {
960 return $this->
msg(
'lineno' )->numParams(
$matches[1] )->escaped();
969 if ( !is_object( $this->mOldRev ) || !is_object( $this->mNewRev ) ) {
971 } elseif ( !$this->mOldPage->equals( $this->mNewPage ) ) {
976 if ( $this->mOldRev->getTimestamp() > $this->mNewRev->getTimestamp() ) {
986 $nEdits = $this->mNewPage->countRevisionsBetween( $oldRev, $newRev, 1000 );
987 if ( $nEdits > 0 && $nEdits <= 1000 ) {
989 $users = $this->mNewPage->getAuthorsBetween( $oldRev, $newRev,
$limit );
990 $numUsers = count( $users );
992 if ( $numUsers == 1 && $users[0] == $newRev->getRawUserText() ) {
1012 if ( $numUsers === 0 ) {
1013 $msg =
'diff-multi-sameuser';
1014 } elseif ( $numUsers >
$limit ) {
1015 $msg =
'diff-multi-manyusers';
1018 $msg =
'diff-multi-otherusers';
1021 return wfMessage( $msg )->numParams( $numEdits, $numUsers )->parse();
1036 $revtimestamp =
$rev->getTimestamp();
1038 $dateofrev = $lang->userDate( $revtimestamp,
$user );
1039 $timeofrev = $lang->userTime( $revtimestamp,
$user );
1041 $header = $this->
msg(
1042 $rev->
isCurrent() ?
'currentrev-asof' :
'revisionasof',
1048 if ( $complete !==
'complete' ) {
1058 $editQuery =
array(
'action' =>
'edit' );
1059 if ( !
$rev->isCurrent() ) {
1060 $editQuery[
'oldid'] =
$rev->getID();
1063 $key =
$title->quickUserCan(
'edit',
$user ) ?
'editold' :
'viewsourceold';
1064 $msg = $this->
msg( $key )->escaped();
1065 $header .=
' ' . $this->
msg(
'parentheses' )->rawParams(
1070 array(
'class' =>
'history-deleted' ),
1093 public function addHeader( $diff, $otitle, $ntitle, $multi =
'', $notice =
'' ) {
1096 $tableClass =
'diff diff-contentalign-' . htmlspecialchars( $this->
getDiffLang()->alignStart() );
1097 $header =
"<table class='$tableClass'>";
1099 if ( !$diff && !$otitle ) {
1101 <tr style='vertical-align: top;'>
1102 <td class='diff-ntitle'>{$ntitle}</td>
1108 <col class='diff-marker' />
1109 <col class='diff-content' />
1110 <col class='diff-marker' />
1111 <col class='diff-content' />";
1118 if ( $otitle || $ntitle ) {
1120 <tr style='vertical-align: top;'>
1121 <td colspan='$colspan' class='diff-otitle'>{$otitle}</td>
1122 <td colspan='$colspan' class='diff-ntitle'>{$ntitle}</td>
1127 if ( $multi !=
'' ) {
1128 $header .=
"<tr><td colspan='{$multiColspan}' style='text-align: center;' " .
1129 "class='diff-multi'>{$multi}</td></tr>";
1131 if ( $notice !=
'' ) {
1132 $header .=
"<tr><td colspan='{$multiColspan}' style='text-align: center;'>{$notice}</td></tr>";
1135 return $header . $diff .
"</table>";
1142 public function setText( $oldText, $newText ) {
1148 $this->
setContent( $oldContent, $newContent );
1156 $this->mOldContent = $oldContent;
1157 $this->mNewContent = $newContent;
1159 $this->mTextLoaded = 2;
1160 $this->mRevisionsLoaded =
true;
1184 if ( $new ===
'prev' ) {
1186 $newid = intval( $old );
1187 $oldid = $this->
getTitle()->getPreviousRevisionID( $newid );
1188 } elseif ( $new ===
'next' ) {
1190 $oldid = intval( $old );
1191 $newid = $this->
getTitle()->getNextRevisionID( $oldid );
1193 $oldid = intval( $old );
1194 $newid = intval( $new );
1197 return array( $oldid, $newid );
1204 if ( $this->mRevisionsIdsLoaded ) {
1208 $this->mRevisionsIdsLoaded =
true;
1214 if ( $new ===
'next' && $this->mNewid ===
false ) {
1215 # if no result, NewId points to the newest old revision. The only newer
1216 # revision is cur, which is "0".
1221 'NewDifferenceEngine',
1239 if ( $this->mRevisionsLoaded ) {
1244 $this->mRevisionsLoaded =
true;
1249 if ( $this->mNewid ) {
1259 if ( !$this->mNewRev instanceof
Revision ) {
1264 $this->mNewid = $this->mNewRev->getId();
1265 $this->mNewPage = $this->mNewRev->getTitle();
1268 $this->mOldRev =
false;
1269 if ( $this->mOldid ) {
1271 } elseif ( $this->mOldid === 0 ) {
1272 $rev = $this->mNewRev->getPrevious();
1274 $this->mOldid =
$rev->getId();
1275 $this->mOldRev =
$rev;
1278 $this->mOldid =
false;
1279 $this->mOldRev =
false;
1283 if ( is_null( $this->mOldRev ) ) {
1287 if ( $this->mOldRev ) {
1288 $this->mOldPage = $this->mOldRev->getTitle();
1293 if ( $this->mOldid !==
false ) {
1294 $this->mOldTags =
$dbr->selectField(
1297 array(
'ts_rev_id' => $this->mOldid ),
1301 $this->mOldTags =
false;
1303 $this->mNewTags =
$dbr->selectField(
1306 array(
'ts_rev_id' => $this->mNewid ),
1319 if ( $this->mTextLoaded == 2 ) {
1324 $this->mTextLoaded = 2;
1330 if ( $this->mOldRev ) {
1332 if ( $this->mOldContent ===
null ) {
1337 if ( $this->mNewRev ) {
1339 if ( $this->mNewContent ===
null ) {
1353 if ( $this->mTextLoaded >= 1 ) {
1357 $this->mTextLoaded = 1;
bool $mRevisionsIdsLoaded
Have the revisions IDs been loaded *.
static deprecated( $func, $version, $component=false)
Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if self::$enableDeprecationWa...
revisionDeleteLink( $rev)
markPatrolledLink()
Get a link to mark the change as patrolled, or '' if there's either no revision to patrol or the user...
static generateRollback( $rev, IContextSource $context=null, $options=array( 'verify'))
Generate a rollback link for a given revision.
getContext()
Get the RequestContext object.
wfShellExec( $cmd, &$retval=null, $environ=array(), $limits=array(), $options=array())
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
int $mTextLoaded
How many text blobs have been loaded, 0, 1 or 2? *.
serialize( $format=null)
Convenience method for serializing this Content object.
wfMergeErrorArrays()
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
bool $unhide
Show rev_deleted content if allowed *.
setTextLanguage( $lang)
Set the language in which the diff text is written (Defaults to page content language).
setReducedLineNumbers( $value=true)
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
setContent(Content $oldContent, Content $newContent)
Use specified text instead of loading from the database.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfProfileIn( $functionname)
Begin profiling of a function.
Class representing a MediaWiki article and history.
static newFromConds( $conds, $fname=__METHOD__, $options=array())
Find the first recent change matching some specific conditions.
bool $mRevisionsLoaded
Have the revisions been loaded *.
deletedIdMarker( $id)
Build a wikitext link toward a deleted revision, if viewable.
makeParserOptions( $context)
Get parser options suitable for rendering the primary article wikitext.
wfHostname()
Fetch server name for use in error reporting etc.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
const TS_DB
MySQL DATETIME (YYYY-MM-DD HH:MM:SS)
getRequest()
Get the WebRequest object.
Show an error when a user tries to do something they do not have the necessary permissions for.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
showDiffStyle()
Add style sheets and supporting JS for diff display.
loadNewText()
Load the text of the new revision, not the old one.
getUser()
Get the User object.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
getTitle()
Get the Title object.
showDiff( $otitle, $ntitle, $notice='')
Get the diff text, send it to the OutputPage object Returns false if the diff could not be generated,...
getDiffBodyCacheKey()
Returns the cache key for diff body text or content.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static runLegacyHooks( $event, $args=array(), $warn=null)
Call a legacy hook that uses text instead of Content objects.
static flag( $flag)
Provide the "<abbr>" element appropriate to a given abbreviated flag, namely the flag indicating a ne...
generateTextDiffBody( $otext, $ntext)
Generate a diff, no caching.
getLanguage()
Get the Language object.
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control default value for MediaWiki still create a but requests to it are no ops and we always fall through to the database If the cache daemon can t be it should also disable itself fairly smoothly By $wgMemc is used but when it is $parserMemc or $messageMemc this is mentioned below
bool $mReducedLineNumbers
If true, line X is not displayed when X is 1, for example to increase readability and conserve space ...
loadRevisionData()
Load revision metadata for the specified articles.
localiseLineNumbersCb( $matches)
wfMemcKey()
Get a cache key.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
wfIncrStats( $key, $count=1)
Increment a statistics counter.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
getOutput()
Get the OutputPage object.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
getWikiPage()
Get the WikiPage object.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
deletedLink( $id)
Look up a special:Undelete link to the given deleted revision id, as a workaround for being unable to...
wfGetLangObj( $langcode=false)
Return a Language object from $langcode.
getDiffBody()
Get the diff table body, without header.
getRevisionHeader(Revision $rev, $complete='')
Get a header for a specified revision.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
loadText()
Load the text of the revisions, as well as revision data.
setContext(IContextSource $context)
Set the IContextSource object.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
bool $mCacheHit
Was the diff fetched from cache? *.
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
const MW_DIFF_VERSION
Constant to indicate diff cache compatibility.
$enableDebugComment
Set this to true to add debug info to the HTML output.
__construct( $context=null, $old=0, $new=0, $rcid=0, $refreshCache=false, $unhide=false)
#-
static newFromTitle( $title, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given title.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static revComment(Revision $rev, $local=false, $isPublic=false)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
presenting them properly to the user as errors is done by the caller $title
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their please see
if(!defined( 'MEDIAWIKI')) if(!isset( $wgVersion)) $matches
static getRevDeleteLink(User $user, Revision $rev, Title $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell,...
setText( $oldText, $newText)
Use specified text instead of loading from the database.
static newFromArchiveRow( $row, $overrides=array())
Make a fake revision object from an archive table row.
showDiffPage( $diffOnly=false)
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
generateDiffBody( $otext, $ntext)
Generate a diff, no caching.
Content object implementation for representing flat text.
Interface for objects which can provide a context on request.
static intermediateEditsMsg( $numEdits, $numUsers, $limit)
Get a notice about how many intermediate edits and users there are.
Base interface for content objects.
loadRevisionIds()
Load revision IDs.
getParserOutput(WikiPage $page, Revision $rev)
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Represents a title within MediaWiki.
wfTempDir()
Tries to get the system directory for temporary files.
static titleAttrib( $name, $options=null)
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static isInRCLifespan( $timestamp, $tolerance=0)
Check whether the given timestamp is new enough to have a RC row with a given tolerance as the recent...
string $mMarkPatrolledLink
Link to action=markpatrolled *.
localiseLineNumbers( $text)
Replace line numbers with the text in the user's language.
debug( $generator="internal")
Generate a debug comment indicating diff generating time, server node, and generator backend.
renderNewRevision()
Show the new revision of the page.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
getDiff( $otitle, $ntitle, $notice='')
Get complete diff table, including header.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
generateContentDiffBody(Content $old, Content $new)
Generate a diff, no caching.
mapDiffPrevNext( $old, $new)
Maps a revision pair definition as accepted by DifferenceEngine constructor to a pair of actual integ...
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
addHeader( $diff, $otitle, $ntitle, $multi='', $notice='')
Add the header to a diff body.
Internationalisation code.
getParserOutput(ParserOptions $parserOptions, $oldid=null)
Get a ParserOutput for the given ParserOptions and revision ID.
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
Class representing a 'diff' between two sequences of strings.
getMultiNotice()
If there are revisions between the ones being compared, return a note saying so.