Go to the documentation of this file.
41 throw new MWException( __METHOD__ .
' given a null title.' );
81 'ar_namespace' => $ns,
82 'ar_title' .
$dbr->buildLike( $prefix,
$dbr->anyString() ),
94 return $dbr->resultObject(
$dbr->select(
104 'GROUP BY' =>
array(
'ar_namespace',
'ar_title' ),
105 'ORDER BY' =>
array(
'ar_namespace',
'ar_title' ),
118 global $wgContentHandlerUseDB;
125 'ar_minor_edit',
'ar_timestamp',
'ar_user',
'ar_user_text',
126 'ar_comment',
'ar_len',
'ar_deleted',
'ar_rev_id',
'ar_sha1',
129 if ( $wgContentHandlerUseDB ) {
130 $fields[] =
'ar_content_format';
131 $fields[] =
'ar_content_model';
134 $conds =
array(
'ar_namespace' => $this->
title->getNamespace(),
135 'ar_title' => $this->
title->getDBkey() );
139 $join_conds =
array();
177 array(
'fa_name' => $this->
title->getDBkey() ),
179 array(
'ORDER BY' =>
'fa_timestamp DESC' )
193 global $wgContentHandlerUseDB;
212 if ( $wgContentHandlerUseDB ) {
213 $fields[] =
'ar_content_format';
214 $fields[] =
'ar_content_model';
217 $row =
$dbr->selectRow(
'archive',
219 array(
'ar_namespace' => $this->
title->getNamespace(),
220 'ar_title' => $this->
title->getDBkey(),
245 $row =
$dbr->selectRow(
'archive',
247 array(
'ar_namespace' => $this->
title->getNamespace(),
248 'ar_title' => $this->
title->getDBkey(),
253 'ORDER BY' =>
'ar_timestamp DESC',
257 $row =
$dbr->selectRow(
array(
'page',
'revision' ),
258 array(
'rev_id',
'rev_timestamp' ),
260 'page_namespace' => $this->
title->getNamespace(),
261 'page_title' => $this->
title->getDBkey(),
262 'page_id = rev_page',
267 'ORDER BY' =>
'rev_timestamp DESC',
270 $prevLiveId = $row ? intval( $row->rev_id ) : null;
272 if ( $prevLive && $prevLive > $prevDeleted ) {
275 } elseif ( $prevDeleted ) {
291 if ( is_null( $row->ar_text_id ) ) {
299 $text =
$dbr->selectRow(
'text',
300 array(
'old_text',
'old_flags' ),
301 array(
'old_id' => $row->ar_text_id ),
317 $row =
$dbr->selectRow(
'archive',
318 array(
'ar_text',
'ar_flags',
'ar_text_id' ),
319 array(
'ar_namespace' => $this->
title->getNamespace(),
320 'ar_title' => $this->
title->getDBkey() ),
322 array(
'ORDER BY' =>
'ar_timestamp DESC' ) );
338 $n =
$dbr->selectField(
'archive',
'COUNT(ar_title)',
339 array(
'ar_namespace' => $this->
title->getNamespace(),
340 'ar_title' => $this->
title->getDBkey() ),
366 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
368 $restoreText = $restoreAll || !empty( $timestamps );
369 $restoreFiles = $restoreAll || !empty( $fileVersions );
371 if ( $restoreFiles && $this->
title->getNamespace() ==
NS_FILE ) {
373 $this->fileStatus = $img->restore( $fileVersions, $unsuppress );
374 if ( !$this->fileStatus->isOK() ) {
377 $filesRestored = $this->fileStatus->successCount;
382 if ( $restoreText ) {
384 if ( !$this->revisionStatus->isOK() ) {
388 $textRestored = $this->revisionStatus->getValue();
395 if ( $textRestored && $filesRestored ) {
396 $reason =
wfMessage(
'undeletedrevisions-files' )
397 ->numParams( $textRestored, $filesRestored )->inContentLanguage()->text();
398 } elseif ( $textRestored ) {
399 $reason =
wfMessage(
'undeletedrevisions' )->numParams( $textRestored )
400 ->inContentLanguage()->text();
401 } elseif ( $filesRestored ) {
402 $reason =
wfMessage(
'undeletedfiles' )->numParams( $filesRestored )
403 ->inContentLanguage()->text();
405 wfDebug(
"Undelete: nothing undeleted...\n" );
411 $reason .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() .
$comment;
414 if (
$user ===
null ) {
420 $logEntry->setPerformer(
$user );
421 $logEntry->setTarget( $this->
title );
422 $logEntry->setComment( $reason );
426 $logid = $logEntry->insert();
427 $logEntry->publish( $logid );
429 return array( $textRestored, $filesRestored, $reason );
445 global $wgContentHandlerUseDB;
451 $restoreAll = empty( $timestamps );
454 # Does this page already exist? We'll have to update it...
456 # Load latest data for the current page (bug 31179)
457 $article->loadPageData(
'fromdbmaster' );
458 $oldcountable =
$article->isCountable();
460 $page = $dbw->selectRow(
'page',
461 array(
'page_id',
'page_latest' ),
462 array(
'page_namespace' => $this->
title->getNamespace(),
463 'page_title' => $this->
title->getDBkey() ),
465 array(
'FOR UPDATE' )
470 # Page already exists. Import the history, and if necessary
471 # we'll update the latest revision field in the record.
473 $previousRevId = $page->page_latest;
475 # Get the time span of this page
476 $previousTimestamp = $dbw->selectField(
'revision',
'rev_timestamp',
477 array(
'rev_id' => $previousRevId ),
480 if ( $previousTimestamp ===
false ) {
481 wfDebug( __METHOD__ .
": existing page refers to a page_latest that does not exist\n" );
484 $status->warning(
'undeleterevision-missing' );
489 # Have to create a new article...
492 $previousTimestamp = 0;
496 $oldones =
'1 = 1'; # All revisions...
498 $oldts = implode(
',',
499 array_map(
array( &$dbw,
'addQuotes' ),
500 array_map(
array( &$dbw,
'timestamp' ),
503 $oldones =
"ar_timestamp IN ( {$oldts} )";
522 if ( $wgContentHandlerUseDB ) {
523 $fields[] =
'ar_content_format';
524 $fields[] =
'ar_content_model';
530 $result = $dbw->select(
'archive',
533 'ar_namespace' => $this->
title->getNamespace(),
534 'ar_title' => $this->
title->getDBkey(),
537 array(
'ORDER BY' =>
'ar_timestamp' )
540 $rev_count = $dbw->numRows(
$result );
543 wfDebug( __METHOD__ .
": no revisions to restore\n" );
546 $status->warning(
"undelete-no-results" );
551 $ret->seek( $rev_count - 1 );
552 $row =
$ret->fetchObject();
567 if ( !$status->isOK() ) {
577 $newid =
$article->insertOn( $dbw );
581 if ( $row->ar_timestamp > $previousTimestamp ) {
595 foreach (
$ret as $row ) {
597 if ( $row->ar_rev_id ) {
598 $exists = $dbw->selectField(
'revision',
'1',
599 array(
'rev_id' => $row->ar_rev_id ), __METHOD__ );
609 'title' => $this->
title,
610 'deleted' => $unsuppress ? 0 : $row->ar_deleted
613 $revision->insertOn( $dbw );
618 # Now that it's safely stored, take it out of the archive
619 $dbw->delete(
'archive',
621 'ar_namespace' => $this->
title->getNamespace(),
622 'ar_title' => $this->
title->getDBkey(),
627 if ( $restored == 0 ) {
631 $created = (bool)$newid;
634 $wasnew =
$article->updateIfNewerOn( $dbw, $revision, $previousRevId );
635 if ( $created || $wasnew ) {
641 array(
'created' => $created,
'oldcountable' => $oldcountable )
693 parent::__construct(
'Undelete',
'deletedhistory' );
700 $this->mAction = $request->getVal(
'action' );
701 if ( $par !==
null && $par !==
'' ) {
702 $this->mTarget = $par;
704 $this->mTarget = $request->getVal(
'target' );
707 $this->mTargetObj =
null;
709 if ( $this->mTarget !==
null && $this->mTarget !==
'' ) {
713 $this->mSearchPrefix = $request->getText(
'prefix' );
714 $time = $request->getVal(
'timestamp' );
716 $this->mFilename = $request->getVal(
'file' );
718 $posted = $request->wasPosted() &&
719 $user->matchEditToken( $request->getVal(
'wpEditToken' ) );
720 $this->mRestore = $request->getCheck(
'restore' ) && $posted;
721 $this->mInvert = $request->getCheck(
'invert' ) && $posted;
722 $this->mPreview = $request->getCheck(
'preview' ) && $posted;
723 $this->mDiff = $request->getCheck(
'diff' );
724 $this->mDiffOnly = $request->getBool(
'diffonly', $this->
getUser()->getOption(
'diffonly' ) );
725 $this->mComment = $request->getText(
'wpComment' );
726 $this->mUnsuppress = $request->getVal(
'wpUnsuppress' ) &&
$user->isAllowed(
'suppressrevision' );
727 $this->mToken = $request->getVal(
'token' );
729 if (
$user->isAllowed(
'undelete' ) && !
$user->isBlocked() ) {
730 $this->mAllowed =
true;
731 $this->mCanView =
true;
732 } elseif (
$user->isAllowed(
'deletedtext' ) ) {
733 $this->mAllowed =
false;
734 $this->mCanView =
true;
735 $this->mRestore =
false;
737 $this->mAllowed =
false;
738 $this->mCanView =
false;
739 $this->mTimestamp =
'';
740 $this->mRestore =
false;
743 if ( $this->mRestore || $this->mInvert ) {
744 $timestamps =
array();
745 $this->mFileVersions =
array();
746 foreach ( $request->getValues()
as $key => $val ) {
748 if ( preg_match(
'/^ts(\d{14})$/', $key,
$matches ) ) {
749 array_push( $timestamps,
$matches[1] );
752 if ( preg_match(
'/^fileid(\d+)$/', $key,
$matches ) ) {
753 $this->mFileVersions[] = intval(
$matches[1] );
756 rsort( $timestamps );
757 $this->mTargetTimestamp = $timestamps;
772 if ( is_null( $this->mTargetObj ) ) {
773 $out->addWikiMsg(
'undelete-header' );
775 # Not all users can just browse every deleted page from the list
776 if (
$user->isAllowed(
'browsearchive' ) ) {
783 if ( $this->mAllowed ) {
784 $out->setPageTitle( $this->
msg(
'undeletepage' ) );
786 $out->setPageTitle( $this->
msg(
'viewdeletedpage' ) );
789 $this->
getSkin()->setRelevantTitle( $this->mTargetObj );
791 if ( $this->mTimestamp !==
'' ) {
793 } elseif ( $this->mFilename !==
null && $this->mTargetObj->inNamespace(
NS_FILE ) ) {
796 if ( !
$file->exists() ) {
797 $out->addWikiMsg(
'filedelete-nofile', $this->mFilename );
804 } elseif ( !
$user->matchEditToken( $this->mToken, $this->mFilename ) ) {
807 $this->
showFile( $this->mFilename );
809 } elseif ( $this->mRestore && $this->mAction ==
'submit' ) {
820 $out->setPageTitle( $this->
msg(
'undelete-search-title' ) );
827 array(
'for' =>
'prefix' ),
828 $this->
msg(
'undelete-search-prefix' )->parse()
833 $this->mSearchPrefix,
834 array(
'id' =>
'prefix',
'autofocus' =>
true )
841 # List undeletable articles
842 if ( $this->mSearchPrefix ) {
857 if (
$result->numRows() == 0 ) {
858 $out->addWikiMsg(
'undelete-no-results' );
866 $out->addHTML(
"<ul>\n" );
872 htmlspecialchars(
$title->getPrefixedText() ),
880 array(
'class' =>
'mw-invalidtitle' ),
888 $revs = $this->
msg(
'undeleterevisions' )->numParams( $row->count )->parse();
889 $out->addHTML(
"<li>{$item} ({$revs})</li>\n" );
892 $out->addHTML(
"</ul>\n" );
898 if ( !preg_match(
'/[0-9]{14}/',
$timestamp ) ) {
903 if ( !
wfRunHooks(
'UndeleteForm::showRevision',
array( &$archive, $this->mTargetObj ) ) ) {
912 $out->addWikiMsg(
'undeleterevision-missing' );
920 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
921 'rev-deleted-text-permission'
928 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
929 'rev-deleted-text-view'
931 $out->addHTML(
'<br />' );
935 if ( $this->mDiff ) {
936 $previousRev = $archive->getPreviousRevision(
$timestamp );
937 if ( $previousRev ) {
939 if ( $this->mDiffOnly ) {
943 $out->addHTML(
'<hr />' );
945 $out->addWikiMsg(
'undelete-nodiff' );
950 $this->
getPageTitle( $this->mTargetObj->getPrefixedDBkey() ),
951 htmlspecialchars( $this->mTargetObj->getPrefixedText() )
967 if ( $this->mPreview || $isText ) {
968 $openDiv =
'<div id="mw-undelete-revision" class="mw-warning">';
970 $openDiv =
'<div id="mw-undelete-revision">';
972 $out->addHTML( $openDiv );
975 if ( !$this->mDiff ) {
978 $out->addHTML(
"$revdel " );
982 $out->addHTML( $this->
msg(
'undelete-revision' )->rawParams(
$link )->params(
983 $time )->rawParams( $userLink )->params( $d,
$t )->parse() .
'</div>' );
989 if ( $this->mPreview || !$isText ) {
993 $popts =
$out->parserOptions();
994 $popts->setEditSection(
false );
996 $pout = $content->getParserOutput( $this->mTargetObj,
$rev->getId(), $popts,
true );
997 $out->addParserOutput( $pout );
1005 'readonly' =>
'readonly',
1006 'cols' =>
$user->getIntOption(
'cols' ),
1007 'rows' =>
$user->getIntOption(
'rows' )
1009 $content->getNativeData() .
"\n"
1014 'name' =>
'preview',
1015 'value' => $this->
msg(
'showpreview' )->
text()
1019 $previewButton =
'';
1025 'value' => $this->
msg(
'showdiff' )->
text() ) );
1030 'style' =>
'clear: both' ) ) .
1033 'action' => $this->
getPageTitle()->getLocalURL(
array(
'action' =>
'submit' ) ) ) ) .
1037 'value' => $this->mTargetObj->getPrefixedDBkey() ) ) .
1040 'name' =>
'timestamp',
1044 'name' =>
'wpEditToken',
1045 'value' =>
$user->getEditToken() ) ) .
1061 function showDiff( $previousRev, $currentRev ) {
1063 $diffContext->setTitle( $currentRev->getTitle() );
1066 $diffEngine = $currentRev->getContentHandler()->createDifferenceEngine( $diffContext );
1067 $diffEngine->showDiffStyle();
1069 $formattedDiff = $diffEngine->generateContentDiffBody(
1074 $formattedDiff = $diffEngine->addHeader(
1080 $this->
getOutput()->addHTML(
"<div>$formattedDiff</div>\n" );
1089 $isDeleted = !(
$rev->getId() &&
$rev->getTitle() );
1093 $targetQuery =
array(
1094 'target' => $this->mTargetObj->getPrefixedText(),
1099 $targetPage =
$rev->getTitle();
1100 $targetQuery =
array(
'oldid' =>
$rev->getId() );
1124 return '<div id="mw-diff-' . $prefix .
'title1"><strong>' .
1129 $lang->userTimeAndDate(
$rev->getTimestamp(),
$user ),
1130 $lang->userDate(
$rev->getTimestamp(),
$user ),
1131 $lang->userTime(
$rev->getTimestamp(),
$user )
1137 '<div id="mw-diff-' . $prefix .
'title2">' .
1140 '<div id="mw-diff-' . $prefix .
'title3">' .
1143 '<div id="mw-diff-' . $prefix .
'title5">' .
1144 $tagSummary[0] .
'<br />' .
1156 $out->addWikiMsg(
'undelete-show-file-confirm',
1157 $this->mTargetObj->getText(),
1158 $lang->userDate(
$file->getTimestamp(),
$user ),
1159 $lang->userTime(
$file->getTimestamp(),
$user ) );
1164 'target' => $this->mTarget,
1166 'token' =>
$user->getEditToken( $key ),
1178 private function showFile( $key ) {
1181 # We mustn't allow the output to be Squid cached, otherwise
1182 # if an admin previews a deleted image, and it's cached, then
1183 # a user without appropriate permissions can toddle off and
1184 # nab the image, and Squid will serve it
1186 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
1187 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
1188 $response->header(
'Pragma: no-cache' );
1191 $path = $repo->getZonePath(
'deleted' ) .
'/' . $repo->getDeletedHashPath( $key ) . $key;
1192 $repo->streamFile(
$path );
1197 if ( $this->mAllowed ) {
1198 $out->addModules(
'mediawiki.special.undelete' );
1201 "<div class='mw-undelete-pagetitle'>\n$1\n</div>\n",
1206 wfRunHooks(
'UndeleteForm::showHistory',
array( &$archive, $this->mTargetObj ) );
1214 $out->addHTML(
'<div class="mw-undelete-history">' );
1215 if ( $this->mAllowed ) {
1216 $out->addWikiMsg(
'undeletehistory' );
1217 $out->addWikiMsg(
'undeleterevdel' );
1219 $out->addWikiMsg(
'undeletehistorynoadmin' );
1221 $out->addHTML(
'</div>' );
1223 # List all stored revisions
1224 $revisions = $archive->listRevisions();
1225 $files = $archive->listFiles();
1227 $haveRevisions = $revisions && $revisions->numRows() > 0;
1230 # Batch existence check on user and talk pages
1231 if ( $haveRevisions ) {
1233 foreach ( $revisions
as $row ) {
1238 $revisions->seek( 0 );
1250 if ( $this->mAllowed ) {
1252 # Start the form here
1255 array(
'method' =>
'post',
'action' => $action,
'id' =>
'undelete' )
1257 $out->addHTML( $top );
1260 # Show relevant lines from the deletion log:
1261 $deleteLogPage =
new LogPage(
'delete' );
1262 $out->addHTML(
Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) .
"\n" );
1264 # Show relevant lines from the suppression log:
1265 $suppressLogPage =
new LogPage(
'suppress' );
1266 if ( $this->
getUser()->isAllowed(
'suppressionlog' ) ) {
1267 $out->addHTML(
Xml::element(
'h2',
null, $suppressLogPage->getName()->text() ) .
"\n" );
1271 if ( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
1272 # Format the user-visible controls (comment field, submission button)
1273 # in a nice little table
1274 if ( $this->
getUser()->isAllowed(
'suppressrevision' ) ) {
1278 <td class='mw-input'>" .
1280 'wpUnsuppress',
'mw-undelete-unsuppress', $this->mUnsuppress ) .
1284 $unsuppressBox =
'';
1290 <td colspan='2' class='mw-undelete-extrahelp'>" .
1291 $this->
msg(
'undeleteextrahelp' )->parseAsBlock() .
1295 <td class='mw-label'>" .
1298 <td class='mw-input'>" .
1303 array(
'id' =>
'wpComment',
'autofocus' =>
true )
1309 <td class='mw-submit'>" .
1311 $this->
msg(
'undeletebtn' )->
text(),
1312 array(
'name' =>
'restore',
'id' =>
'mw-undelete-submit' )
1315 $this->
msg(
'undeleteinvert' )->
text(),
1316 array(
'name' =>
'invert',
'id' =>
'mw-undelete-invert' )
1324 $out->addHTML( $table );
1329 if ( $haveRevisions ) {
1330 # The page's stored (deleted) history:
1331 $out->addHTML(
'<ul>' );
1332 $remaining = $revisions->numRows();
1333 $earliestLiveTime = $this->mTargetObj->getEarliestRevTime();
1335 foreach ( $revisions
as $row ) {
1340 $out->addHTML(
'</ul>' );
1342 $out->addWikiMsg(
'nohistory' );
1347 $out->addHTML(
'<ul>' );
1352 $out->addHTML(
'</ul>' );
1355 if ( $this->mAllowed ) {
1356 # Slip in the hidden controls here
1360 $out->addHTML( $misc );
1369 'title' => $this->mTargetObj
1375 if ( $this->mAllowed ) {
1376 if ( $this->mInvert ) {
1377 if ( in_array( $ts, $this->mTargetTimestamp ) ) {
1391 if ( $this->mCanView ) {
1395 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts,
$user ) );
1396 $last = $this->
msg(
'diff' )->escaped();
1397 } elseif ( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
1401 $this->
msg(
'diff' )->escaped(),
1404 'target' => $this->mTargetObj->getPrefixedText(),
1411 $last = $this->
msg(
'diff' )->escaped();
1414 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts,
$user ) );
1415 $last = $this->
msg(
'diff' )->escaped();
1425 $size = $row->ar_len;
1426 if ( !is_null(
$size ) ) {
1437 $attribs[
'class'] = implode(
' ', $classes );
1443 $revisionRow = $this->
msg(
'undelete-revision-row' )
1465 if ( $this->mAllowed && $row->fa_storage_key ) {
1466 $checkBox =
Xml::check(
'fileid' . $row->fa_id );
1467 $key = urlencode( $row->fa_storage_key );
1474 $data = $this->
msg(
'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text();
1475 $bytes = $this->
msg(
'parentheses' )
1476 ->rawParams( $this->
msg(
'nbytes' )->numParams( $row->fa_size )->text() )
1478 $data = htmlspecialchars( $data .
' ' . $bytes );
1482 $canHide =
$user->isAllowed(
'deleterevision' );
1483 if ( $canHide || (
$file->getVisibility() &&
$user->isAllowed(
'deletedhistory' ) ) ) {
1489 'type' =>
'filearchive',
1490 'target' => $this->mTargetObj->getPrefixedDBkey(),
1491 'ids' => $row->fa_id
1500 return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
1516 return '<span class="history-deleted">' .
$time .
'</span>';
1521 htmlspecialchars(
$time ),
1524 'target' => $this->mTargetObj->getPrefixedText(),
1530 $link =
'<span class="history-deleted">' .
$link .
'</span>';
1551 return '<span class="history-deleted">' .
$time .
'</span>';
1556 htmlspecialchars(
$time ),
1559 'target' => $this->mTargetObj->getPrefixedText(),
1561 'token' =>
$user->getEditToken( $key )
1566 $link =
'<span class="history-deleted">' .
$link .
'</span>';
1580 return '<span class="history-deleted">' .
1581 $this->
msg(
'rev-deleted-user' )->escaped() .
1589 $link =
'<span class="history-deleted">' .
$link .
'</span>';
1603 return '<span class="history-deleted"><span class="comment">' .
1604 $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span></span>';
1610 $link =
'<span class="history-deleted">' .
$link .
'</span>';
1617 global $wgUploadMaintenance;
1619 if ( $wgUploadMaintenance && $this->mTargetObj->getNamespace() ==
NS_FILE ) {
1620 throw new ErrorPageError(
'undelete-error',
'filedelete-maintenance' );
1629 wfRunHooks(
'UndeleteForm::undelete',
array( &$archive, $this->mTargetObj ) );
1630 $ok = $archive->undelete(
1631 $this->mTargetTimestamp,
1633 $this->mFileVersions,
1638 if ( is_array(
$ok ) ) {
1641 $this->mTargetObj, $this->mFileVersions,
1642 $this->
getUser(), $this->mComment ) );
1646 $out->addHTML( $this->
msg(
'undeletedpage' )->rawParams(
$link )->parse() );
1648 $out->setPageTitle( $this->
msg(
'undelete-error' ) );
1652 $status = $archive->getRevisionStatus();
1653 if ( $status && !$status->isGood() ) {
1654 $out->addWikiText(
'<div class="error">' .
1655 $status->getWikiText(
1663 $status = $archive->getFileStatus();
1664 if ( $status && !$status->isGood() ) {
1665 $out->addWikiText(
'<div class="error">' .
1666 $status->getWikiText(
1667 'undelete-error-short',
1668 'undelete-error-long'
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
getPageTitle( $subpage=false)
Get a self-referential title object.
formatRevisionRow( $row, $earliestLiveTime, $remaining)
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
see documentation in includes Linker php for Linker::makeImageLink & $time
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
diffHeader( $rev, $prefix)
static commentBlock( $comment, $title=null, $local=false)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
showDiff( $previousRev, $currentRev)
Build a diff display between this and the previous either deleted or non-deleted edit.
static singleton()
Get a RepoGroup instance.
static revDeleteLink( $query=array(), $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
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.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
Used to show archived pages and eventually restore them.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
getOutput()
Get the OutputPage being used for this instance.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
undelete( $timestamps, $comment='', $fileVersions=array(), $unsuppress=false, User $user=null)
Restore the given (or all) text and file revisions for the page.
Special page allowing users with the appropriate permissions to view and restore deleted content.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
static listPages( $dbr, $condition)
getPageLink( $rev, $titleObj, $ts)
Fetch revision text link if it's available to all users.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
showRevision( $timestamp)
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 & $ret
showList( $result)
Generic list of deleted pages.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static newGood( $value=null)
Factory function for good results.
static listPagesByPrefix( $prefix)
List deleted pages recorded in the archive table matching the given title prefix.
wfReadOnly()
Check whether the wiki is in read-only mode.
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row $row is usually an object from wfFetchRow(),...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
listFiles()
List the deleted file revisions for this page, if it's a file page.
getSkin()
Shortcut to get the skin being used for this instance.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
Show an error when a user tries to do something they do not have the necessary permissions for.
getLanguage()
Shortcut to get user's language.
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
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
getFileUser( $file)
Fetch file's user id if it's available to this user.
static openElement( $element, $attribs=null)
This opens an XML element.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
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 true
isDeleted()
Quick check if any archived revisions are present for the page.
static flag( $flag)
Provide the "<abbr>" element appropriate to a given abbreviated flag, namely the flag indicating a ne...
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
getDBkey()
Get the main part with underscores.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
static listAllPages()
List all deleted pages recorded in the archive table.
getNamespace()
Get the namespace index, i.e.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
undeleteRevisions( $timestamps, $unsuppress=false, $comment='')
This is the meaty bit – restores archived revisions of the given page to the cur/old tables.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
listRevisions()
List the revisions of the given page.
Class to simplify the use of log pages.
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 "<
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
when a variable name is used in a it is silently declared as a new masking the global
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
processing should stop and the error should be shown to the user * false
getContext()
Gets the context this SpecialPage is executed in.
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 & $options
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Class to invalidate the HTML cache of all the pages linking to a given title.
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
getRevision( $timestamp)
Return a Revision object containing data for the deleted revision.
if(!defined( 'MEDIAWIKI')) if(!isset( $wgVersion)) $matches
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
msg()
Wrapper around wfMessage that sets the current context.
static check( $name, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox.
Class representing a row of the 'filearchive' table.
Parent class for all special pages.
static getRevDeleteLink(User $user, Revision $rev, Title $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
getRequest()
Get the WebRequest being used for this instance.
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
static newFromArchiveRow( $row, $overrides=array())
Make a fake revision object from an archive table row.
static formatRevisionSize( $size)
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getFileComment( $file)
Fetch file upload comment if it's available to this user.
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
Content object implementation for representing flat text.
if(PHP_SAPI !='cli') $file
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
getFileLink( $file, $titleObj, $ts, $key)
Fetch image view link if it's available to all users.
Represents a title within MediaWiki.
static closeElement( $element)
Shortcut to close an XML element.
getLastRevisionText()
Fetch (and decompress if necessary) the stored text of the most recently edited deleted revision of t...
showFile( $key)
Show a deleted file version requested by the visitor.
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
Class for creating log entries manually, for example to inject them into the database.
getTextFromRow( $row)
Get the text from an archive row containing ar_text, ar_flags and ar_text_id.
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
static selectFields()
Fields in the filearchive table.
static input( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
showFileConfirmationForm( $key)
Show a form confirming whether a tokenless user really wants to see a file.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
An error page which can definitely be safely rendered using the OutputPage.
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
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 & $attribs
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
wfLocalFile( $title)
Get an object referring to a locally registered file.
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
static newFromRow( $row)
Loads a file object from the filearchive table.
static showLogExtract(&$out, $types=array(), $page='', $user='', $param=array())
Show log extract.
static newFatal( $message)
Factory function for fatal errors.
getPreviousRevision( $timestamp)
Return the most-previous revision, either live or deleted, against the deleted revision given by time...