Removed dead code path since r27312: $revision cannot be null if $restored is non...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 12 May 2011 18:06:57 +0000 (18:06 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 12 May 2011 18:06:57 +0000 (18:06 +0000)
includes/specials/SpecialUndelete.php

index dd66ddc..2ed6495 100644 (file)
@@ -515,33 +515,28 @@ class PageArchive {
                        __METHOD__ );
 
                // Was anything restored at all?
-               if( $restored == 0 )
+               if ( $restored == 0 ) {
                        return 0;
+               }
 
-               if( $revision ) {
-                       // 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( $newid ) {
-                               wfRunHooks( 'ArticleUndelete', array( &$this->title, true, $comment ) );
-                               Article::onArticleCreate( $this->title );
-                       } else {
-                               wfRunHooks( 'ArticleUndelete', array( &$this->title, false, $comment ) );
-                               Article::onArticleEdit( $this->title );
-                       }
+               // 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->title->getNamespace() == NS_FILE ) {
-                               $update = new HTMLCacheUpdate( $this->title, 'imagelinks' );
-                               $update->doUpdate();
-                       }
+               if( $newid ) {
+                       wfRunHooks( 'ArticleUndelete', array( &$this->title, true, $comment ) );
+                       Article::onArticleCreate( $this->title );
                } else {
-                       // Revision couldn't be created. This is very weird
-                       wfDebug( "Undelete: unknown error...\n" );
-                       return false;
+                       wfRunHooks( 'ArticleUndelete', array( &$this->title, false, $comment ) );
+                       Article::onArticleEdit( $this->title );
+               }
+
+               if( $this->title->getNamespace() == NS_FILE ) {
+                       $update = new HTMLCacheUpdate( $this->title, 'imagelinks' );
+                       $update->doUpdate();
                }
 
                return $restored;