Complain if use asks for page that's not archived
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 6 Dec 2003 04:27:16 +0000 (04:27 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 6 Dec 2003 04:27:16 +0000 (04:27 +0000)
includes/SpecialUndelete.php

index 3fda4d3..bfd0e54 100644 (file)
@@ -64,6 +64,17 @@ function wfSpecialUndelete( $par )
     
     $sk = $wgUser->getSkin();
     $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
+
+    $sql = "SELECT ar_minor_edit,ar_timestamp,ar_user,ar_user_text,ar_comment
+      FROM archive WHERE ar_namespace={$namespace} AND ar_title=\"{$title}\"
+      ORDER BY ar_timestamp DESC";
+    $ret = wfQuery( $sql, DB_READ );
+
+       if( wfNumRows( $ret ) == 0 ) {
+               $wgOut->addWikiText( wfMsg( "nohistory" ) );
+               return 0;
+       }
+       
     $wgOut->addWikiText( wfMsg( "undeletehistory" ) . "\n<hr>\n" . $row->ar_text );
 
        $action = wfLocalUrlE( $wgLang->specialPage( "Undelete" ), "action=submit" );
@@ -80,11 +91,6 @@ function wfSpecialUndelete( $par )
        $wgOut->addWikiText( $m[1] );
     }
     
-    $sql = "SELECT ar_minor_edit,ar_timestamp,ar_user,ar_user_text,ar_comment
-      FROM archive WHERE ar_namespace={$namespace} AND ar_title=\"{$title}\"
-      ORDER BY ar_timestamp DESC";
-    $ret = wfQuery( $sql, DB_READ );
-    
     $special = $wgLang->getNsText( Namespace::getSpecial() );
     $wgOut->addHTML("<ul>");
     while( $row = wfFetchObject( $ret ) ) {