Snarf the deletion log entries on the undelete page. Make the log items
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 29 Aug 2004 21:26:00 +0000 (21:26 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 29 Aug 2004 21:26:00 +0000 (21:26 +0000)
and the archived history quite distinct by adding headings.

includes/SpecialLog.php
includes/SpecialUndelete.php

index 66677dc..51b512e 100644 (file)
@@ -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 )
index 8da3764..c1f67aa 100644 (file)
@@ -133,15 +133,20 @@ class UndeleteForm {
        <input type=submit name=\"restore\" value=\"".wfMsg("undeletebtn")."\">
        </form>");
 
-               $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( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\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( "<h2>" . htmlspecialchars( wfMsg( "history" ) ) . "</h2>\n" );
                $wgOut->addHTML("<ul>");
                while( $row = $dbr->fetchObject( $ret ) ) {
                        $wgOut->addHTML( "<li>" .