*/
/**
- *
+ * Constructor
*/
function wfSpecialUndelete( $par ) {
- global $wgRequest;
+ global $wgRequest;
$form = new UndeleteForm( $wgRequest, $par );
$form->execute();
}
/**
- * @todo document (just needs one-sentence top-level class description)
+ * Used to show archived pages and eventually restore them.
* @addtogroup SpecialPage
*/
class PageArchive {
$restoreFiles = $restoreAll || !empty( $fileVersions );
if( $restoreFiles && $this->title->getNamespace() == NS_IMAGE ) {
- $img = new Image( $this->title );
+ $img = wfLocalFile( $this->title );
$filesRestored = $img->restore( $fileVersions );
} else {
$filesRestored = 0;
* @return int number of revisions restored
*/
private function undeleteRevisions( $timestamps ) {
- global $wgDBtype;
-
$restoreAll = empty( $timestamps );
$dbw = wfGetDB( DB_MASTER );
# Does this page already exist? We'll have to update it...
$article = new Article( $this->title );
- $options = ( $wgDBtype == 'postgres' )
- ? '' // pg doesn't support this?
- : 'FOR UPDATE';
+ $options = 'FOR UPDATE';
$page = $dbw->selectRow( 'page',
array( 'page_id', 'page_latest' ),
array( 'page_namespace' => $this->title->getNamespace(),
}
if( $revision ) {
- # FIXME: Update latest if newer as well...
- if( $newid ) {
- // Attach the latest revision to the page...
- $article->updateRevisionOn( $dbw, $revision, $previousRevId );
-
+ // Attach the latest revision to the page...
+ $wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId );
+
+ if( $newid || $wasnew ) {
// Update site stats, link tables, etc
$article->createUpdates( $revision );
}
if( $this->mPreview ) {
$wgOut->addHtml( "<hr />\n" );
- $wgOut->addWikiTextTitle( $rev->getText(), $this->mTargetObj, false );
+ $wgOut->addWikiTextTitleTidy( $rev->getText(), $this->mTargetObj, false );
}
$wgOut->addHtml(
}
}
-?>
+