X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSpecialUndelete.php;h=7a322dbd40ebd50c0443418772581c2d794da814;hb=eaaf62fbdc21c1b43440e18f3874f31bd7ab12d8;hp=36d36690afe9afecb9e6915877190782419954bf;hpb=5fef2333d43faed0571878e848d6c40ade2c9810;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 36d36690af..7a322dbd40 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -4,21 +4,21 @@ * Special page allowing users with the appropriate permissions to view * and restore deleted content * - * @addtogroup Special pages + * @addtogroup SpecialPage */ /** - * + * 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 { @@ -319,8 +319,6 @@ class PageArchive { * @return int number of revisions restored */ private function undeleteRevisions( $timestamps ) { - global $wgDBtype; - $restoreAll = empty( $timestamps ); $dbw = wfGetDB( DB_MASTER ); @@ -328,9 +326,7 @@ class PageArchive { # 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(), @@ -422,11 +418,10 @@ class PageArchive { } 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 ); } @@ -617,7 +612,7 @@ class UndeleteForm { if( $this->mPreview ) { $wgOut->addHtml( "
\n" ); - $wgOut->addWikiTextTitle( $rev->getText(), $this->mTargetObj, false ); + $wgOut->addWikiTextTitleTidy( $rev->getText(), $this->mTargetObj, false ); } $wgOut->addHtml(