From a63d48e48b9e9d1255f9bbdc64bf6527fff2b507 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 29 Aug 2004 21:26:00 +0000 Subject: [PATCH] Snarf the deletion log entries on the undelete page. Make the log items and the archived history quite distinct by adding headings. --- includes/SpecialLog.php | 12 ++++++++---- includes/SpecialUndelete.php | 19 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index 66677dc237..51b512eca4 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -153,13 +153,17 @@ class LogViewer { $this->showHeader( $wgOut ); $this->showOptions( $wgOut ); $this->showPrevNext( $wgOut ); - $out = ""; + $this->showList( $wgOut ); + $this->showPrevNext( $wgOut ); + } + + function showList( &$out ) { + $html = ""; $this->reader->initQuery(); while( $s = $this->reader->fetchObject() ) { - $out .= $this->logLine( $s ); + $html .= $this->logLine( $s ); } - $wgOut->addHTML( $out ); - $this->showPrevNext( $wgOut ); + $out->addHTML( $html ); } # wfMsg( unprotectedarticle, $text ) diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 8da376478c..c1f67aa306 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -133,15 +133,20 @@ class UndeleteForm { "); - $log = $dbr->selectField( "cur", "cur_text", - array( 'cur_namespace' => NS_PROJECT, 'cur_title' => wfMsg("dellogpage") ) ); - if(preg_match("/^(.*". - preg_quote( ($namespace ? ($wgLang->getNsText($namespace) . ":") : "") - . str_replace("_", " ", $title), "/" ).".*)$/m", $log, $m)) { - $wgOut->addWikiText( $m[1] ); - } + # Show relevant lines from the deletion log: + $wgOut->addHTML( "

" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

\n" ); + require_once( 'SpecialLog.php' ); + $t = Title::MakeTitle( $namespace, $title ); + # TODO: make a pure, faux request for this. + global $wgRequest; + $logReader = new LogReader( $wgRequest ); + $logReader->limitTitle( $t->getPrefixedText() ); + $logViewer =& new LogViewer( $logReader ); + $logViewer->showList( $wgOut ); + # The page's stored (deleted) history: $special = $wgLang->getNsText( Namespace::getSpecial() ); + $wgOut->addHTML( "

" . htmlspecialchars( wfMsg( "history" ) ) . "

\n" ); $wgOut->addHTML("