From: Brion Vibber Date: Sun, 31 Aug 2003 22:21:50 +0000 (+0000) Subject: Add notice for pages with deletion history & easy undelete link. X-Git-Tag: 1.1.0~301 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=5c8988dfba13b7ededefb0c693062cd2e4b6d392;p=lhc%2Fweb%2Fwiklou.git Add notice for pages with deletion history & easy undelete link. --- diff --git a/includes/Skin.php b/includes/Skin.php index 2f758e42b1..b4fa66112c 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -367,6 +367,13 @@ class Skin { $s.=" | ". str_replace( "$1", $tl, wfMsg("newmessages") ) . ""; } } + if( $wgUser->isSysop() && + ($n = $wgTitle->isDeleted() ) ) { + $s .= " | " . wfMsg( "thisisdeleted", + $this->makeKnownLink( + $wgLang->SpecialPage( "Undelete/" . $wgTitle->getText() ), + wfMsg( "restorelink", $n ) ) ) . ""; + } return $s; } diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index b4d66ea8c1..5ac500540e 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -1,9 +1,10 @@ mDbkeyform; diff --git a/includes/Title.php b/includes/Title.php index a342a31a4f..16e9237415 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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(); } } ?> diff --git a/languages/Language.php b/languages/Language.php index e6fc10845b..1ce22c1270 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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 #