Add notice for pages with deletion history & easy undelete link.
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 31 Aug 2003 22:21:50 +0000 (22:21 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 31 Aug 2003 22:21:50 +0000 (22:21 +0000)
includes/Skin.php
includes/SpecialUndelete.php
includes/Title.php
languages/Language.php

index 2f758e4..b4fa661 100644 (file)
@@ -367,6 +367,13 @@ class Skin {
                                $s.=" | <strong>". str_replace( "$1", $tl, wfMsg("newmessages") ) . "</strong>";
                        }
                }
+               if( $wgUser->isSysop() &&
+                       ($n = $wgTitle->isDeleted() ) ) {
+                               $s .= " | <strong>" . wfMsg( "thisisdeleted",
+                                       $this->makeKnownLink(
+                                       $wgLang->SpecialPage( "Undelete/" . $wgTitle->getText() ),
+                                       wfMsg( "restorelink", $n ) ) ) . "</strong>";
+               }
                return $s;
        }
 
index b4d66ea..5ac5005 100644 (file)
@@ -1,9 +1,10 @@
 <?
 
-function wfSpecialUndelete( )
+function wfSpecialUndelete( $par )
 {
     global $wgLang, $wgUser, $wgOut, $action, $target, $timestamp, $restore;
     
+       if( $par != "" ) $target = $par;
     if( isset($target ) ) {
        $t = Title::newFromURL( $target );
        $title = $t->mDbkeyform;
index a342a31..16e9237 100644 (file)
@@ -28,6 +28,8 @@ class Title {
 
        function newFromText( $text )
        {
+               wfProfileIn( "Title::newFromText" );
+               
                # Note - mixing latin1 named entities and unicode numbered
                # ones will result in a bad link.
                $trans = get_html_translation_table( HTML_ENTITIES );
@@ -41,6 +43,8 @@ class Title {
                $t = new Title();
                $t->mDbkeyform = str_replace( " ", "_", $text );
                $t->secureAndSplit();
+               
+               wfProfileOut();
                return $t;
        }
 
@@ -266,6 +270,17 @@ class Title {
                }
                return $this->mRestrictions;
        }
+       
+       function isDeleted() {
+               $ns = $this->getNamespace();
+               $t = wfStrencode( $this->getDBkey() );
+               $sql = "SELECT COUNT(*) AS n FROM archive WHERE ar_namespace=$ns AND ar_title='$t'";
+               if( $res = wfQuery( $sql ) ) {
+                       $s = wfFetchObject( $res );
+                       return $s->n;
+               }
+               return 0;
+       }
 
        function getArticleID()
        {
@@ -313,7 +328,8 @@ class Title {
        /* private */ function secureAndSplit()
        {
                global $wgLang, $wgLocalInterwiki;
-
+               wfProfileIn( "Title::secureAndSplit" );
+               
                $validNamespaces = $wgLang->getNamespaces();
                unset( $validNamespaces[0] );
 
@@ -380,6 +396,8 @@ class Title {
                $this->mDbkeyform = $t;
                $this->mUrlform = wfUrlencode( $t );
                $this->mTextform = str_replace( "_", " ", $t );
+               
+               wfProfileOut();
        }
 }
 ?>
index e6fc108..1ce22c1 100644 (file)
@@ -422,6 +422,8 @@ See $1.",
 "toc" => "Table of contents",
 "showtoc" => "show",
 "hidetoc" => "hide",
+"thisisdeleted" => "View or restore $1?",
+"restorelink" => "$1 deleted edits",
 
 # Main script and global functions
 #