<?php
/**
+ * Implements Special:Undelete
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
*/
/**
* Used to show archived pages and eventually restore them.
+ *
* @ingroup SpecialPage
*/
class PageArchive {
$revision = null;
$restored = 0;
- while( $row = $ret->fetchObject() ) {
+ foreach ( $ret as $row ) {
// Check for key dupes due to shitty archive integrity.
if( $row->ar_rev_id ) {
$exists = $dbw->selectField( 'revision', '1', array('rev_id' => $row->ar_rev_id), __METHOD__ );
}
} else {
// Revision couldn't be created. This is very weird
- return self::UNDELETE_UNKNOWNERR;
+ wfDebug( "Undelete: unknown error...\n" );
+ return false;
}
return $restored;
*
* @ingroup SpecialPage
*/
-class UndeleteForm extends SpecialPage {
+class SpecialUndelete extends SpecialPage {
var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mTargetObj;
var $mTargetTimestamp, $mAllowed, $mCanView, $mComment, $mToken, $mRequest;
}
if ( $this->mTarget !== '' ) {
$this->mTargetObj = Title::newFromURL( $this->mTarget );
+ $wgUser->getSkin()->setRelevantTitle( $this->mTargetObj );
} else {
$this->mTargetObj = null;
}
'method' => 'get',
'action' => $wgScript ) ) .
Xml::fieldset( wfMsg( 'undelete-search-box' ) ) .
- Xml::hidden( 'title',
+ Html::hidden( 'title',
$this->getTitle()->getPrefixedDbKey() ) .
Xml::inputLabel( wfMsg( 'undelete-search-prefix' ),
'prefix', 'prefix', 20,
// Generic list of deleted pages
private function showList( $result ) {
- global $wgLang, $wgContLang, $wgUser, $wgOut;
+ global $wgLang, $wgUser, $wgOut;
if( $result->numRows() == 0 ) {
$wgOut->addWikiMsg( 'undelete-no-results' );
$sk = $wgUser->getSkin();
$undelete = $this->getTitle();
$wgOut->addHTML( "<ul>\n" );
- while( $row = $result->fetchObject() ) {
+ foreach ( $result as $row ) {
$title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
$link = $sk->linkKnown(
$undelete,
}
private function showHistory( ) {
- global $wgLang, $wgUser, $wgOut;
+ global $wgUser, $wgOut;
$sk = $wgUser->getSkin();
if( $this->mAllowed ) {
# Batch existence check on user and talk pages
if( $haveRevisions ) {
$batch = new LinkBatch();
- while( $row = $revisions->fetchObject() ) {
+ foreach ( $revisions as $row ) {
$batch->addObj( Title::makeTitleSafe( NS_USER, $row->ar_user_text ) );
$batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->ar_user_text ) );
}
}
if( $haveFiles ) {
$batch = new LinkBatch();
- while( $row = $files->fetchObject() ) {
+ foreach ( $files as $row ) {
$batch->addObj( Title::makeTitleSafe( NS_USER, $row->fa_user_text ) );
$batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->fa_user_text ) );
}
if( $haveRevisions ) {
# The page's stored (deleted) history:
$wgOut->addHTML("<ul>");
- $target = urlencode( $this->mTarget );
$remaining = $revisions->numRows();
$earliestLiveTime = $this->mTargetObj->getEarliestRevTime();
- while( $row = $revisions->fetchObject() ) {
+ foreach ( $revisions as $row ) {
$remaining--;
$wgOut->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining, $sk ) );
}
if( $haveFiles ) {
$wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'filehist' ) ) . "\n" );
$wgOut->addHTML( "<ul>" );
- while( $row = $files->fetchObject() ) {
+ foreach ( $files as $row ) {
$wgOut->addHTML( $this->formatFileRow( $row, $sk ) );
}
$files->free();
if ( $this->mAllowed ) {
# Slip in the hidden controls here
- $misc = Xml::hidden( 'target', $this->mTarget );
- $misc .= Xml::hidden( 'wpEditToken', $wgUser->editToken() );
+ $misc = Html::hidden( 'target', $this->mTarget );
+ $misc .= Html::hidden( 'wpEditToken', $wgUser->editToken() );
$misc .= Xml::closeElement( 'form' );
$wgOut->addHTML( $misc );
}
if( $this->mAllowed && $row->fa_storage_key ) {
$checkBox = Xml::check( "fileid" . $row->fa_id );
$key = urlencode( $row->fa_storage_key );
- $target = urlencode( $this->mTarget );
$pageLink = $this->getFileLink( $file, $this->getTitle(), $ts, $key, $sk );
} else {
$checkBox = '';