* @file
* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
/**
* Used to show archived pages and eventually restore them.
$this->title = $title;
if ( $config === null ) {
wfDebug( __METHOD__ . ' did not have a Config object passed to it' );
- $config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
+ $config = MediaWikiServices::getInstance()->getMainConfig();
}
$this->config = $config;
}
* @return ResultWrapper
*/
public static function listAllPages() {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
return self::listPages( $dbr, '' );
}
* @return ResultWrapper
*/
public static function listPagesByPrefix( $prefix ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$title = Title::newFromText( $prefix );
if ( $title ) {
* @return ResultWrapper
*/
function listRevisions() {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$tables = [ 'archive' ];
return null;
}
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
return $dbr->select(
'filearchive',
ArchivedFile::selectFields(),
* @return Revision|null
*/
function getRevision( $timestamp ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$fields = [
'ar_rev_id',
* @return Revision|null Null when there is no previous revision
*/
function getPreviousRevision( $timestamp ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
// Check the previous deleted revision...
$row = $dbr->selectRow( 'archive',
}
// New-style: keyed to the text storage backend.
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$text = $dbr->selectRow( 'text',
[ 'old_text', 'old_flags' ],
[ 'old_id' => $row->ar_text_id ],
* @return string|null
*/
function getLastRevisionText() {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$row = $dbr->selectRow( 'archive',
[ 'ar_text', 'ar_flags', 'ar_text_id' ],
[ 'ar_namespace' => $this->title->getNamespace(),
* @return bool
*/
function isDeleted() {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
[ 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey() ],
$out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) );
+ $linkRenderer = $this->getLinkRenderer();
$undelete = $this->getPageTitle();
$out->addHTML( "<ul>\n" );
foreach ( $result as $row ) {
$title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
if ( $title !== null ) {
- $item = Linker::linkKnown(
+ $item = $linkRenderer->makeKnownLink(
$undelete,
- htmlspecialchars( $title->getPrefixedText() ),
+ $title->getPrefixedText(),
[],
[ 'target' => $title->getPrefixedText() ]
);
}
}
- $link = Linker::linkKnown(
+ $link = $this->getLinkRenderer()->makeKnownLink(
$this->getPageTitle( $this->mTargetObj->getPrefixedDBkey() ),
- htmlspecialchars( $this->mTargetObj->getPrefixedText() )
+ $this->mTargetObj->getPrefixedText()
);
$lang = $this->getLanguage();
$minor = $rev->isMinor() ? ChangesList::flag( 'minor' ) : '';
- $tags = wfGetDB( DB_SLAVE )->selectField(
+ $tags = wfGetDB( DB_REPLICA )->selectField(
'tag_summary',
'ts_tags',
[ 'ts_rev_id' => $rev->getId() ],
// FIXME This is reimplementing DifferenceEngine#getRevisionHeader
// and partially #showDiffPage, but worse
return '<div id="mw-diff-' . $prefix . 'title1"><strong>' .
- Linker::link(
+ $this->getLinkRenderer()->makeLink(
$targetPage,
$this->msg(
'revisionasof',
$lang->userTimeAndDate( $rev->getTimestamp(), $user ),
$lang->userDate( $rev->getTimestamp(), $user ),
$lang->userTime( $rev->getTimestamp(), $user )
- )->escaped(),
+ )->text(),
[],
$targetQuery
) .
$last = $this->msg( 'diff' )->escaped();
} elseif ( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
$pageLink = $this->getPageLink( $rev, $titleObj, $ts );
- $last = Linker::linkKnown(
+ $last = $this->getLinkRenderer()->makeKnownLink(
$titleObj,
- $this->msg( 'diff' )->escaped(),
+ $this->msg( 'diff' )->text(),
[],
[
'target' => $this->mTargetObj->getPrefixedText(),
return '<span class="history-deleted">' . $time . '</span>';
}
- $link = Linker::linkKnown(
+ $link = $this->getLinkRenderer()->makeKnownLink(
$titleObj,
- htmlspecialchars( $time ),
+ $time,
[],
[
'target' => $this->mTargetObj->getPrefixedText(),
return '<span class="history-deleted">' . $time . '</span>';
}
- $link = Linker::linkKnown(
+ $link = $this->getLinkRenderer()->makeKnownLink(
$titleObj,
- htmlspecialchars( $time ),
+ $time,
[],
[
'target' => $this->mTargetObj->getPrefixedText(),
$this->getUser(), $this->mComment ] );
}
- $link = Linker::linkKnown( $this->mTargetObj );
+ $link = $this->getLinkRenderer()->makeKnownLink( $this->mTargetObj );
$out->addHTML( $this->msg( 'undeletedpage' )->rawParams( $link )->parse() );
} else {
$out->setPageTitle( $this->msg( 'undelete-error' ) );