From f7bda8ce36dc2ac361eafa27369c44329b30b978 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 12 May 2011 18:06:57 +0000 Subject: [PATCH] Removed dead code path since r27312: $revision cannot be null if $restored is non-zero --- includes/specials/SpecialUndelete.php | 41 ++++++++++++--------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index dd66ddc871..2ed649505b 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -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; -- 2.20.1