Added a "Dead-end pages" query page, per RFE#577764.
authorEvan Prodromou <evanprodromou@users.mediawiki.org>
Mon, 1 Dec 2003 02:24:26 +0000 (02:24 +0000)
committerEvan Prodromou <evanprodromou@users.mediawiki.org>
Mon, 1 Dec 2003 02:24:26 +0000 (02:24 +0000)
includes/SpecialDeadendpages.php [new file with mode: 0644]
languages/Language.php

diff --git a/includes/SpecialDeadendpages.php b/includes/SpecialDeadendpages.php
new file mode 100644 (file)
index 0000000..aaec95a
--- /dev/null
@@ -0,0 +1,59 @@
+<?
+
+function wfSpecialDeadendpages()
+{
+    global $wgUser, $wgOut, $wgLang, $wgTitle;
+    $fname = "wfSpecialDeadendpages";
+    
+    # Cache
+    $vsp = $wgLang->getValidSpecialPages();
+    $log = new LogPage( $vsp["Deadendpages"] );
+    $log->mUpdateRecentChanges = false;
+    
+    global $wgMiserMode;
+    if ( $wgMiserMode ) {
+       $log->showAsDisabledPage();
+       return;
+    }
+    
+    list( $limit, $offset ) = wfCheckLimits();
+
+    # Note: title is only the same as l_from for main namespace, 
+    # but that's what we want, anyways
+
+    # XXX: Left joins are losey
+    
+    $sql = "SELECT cur_title " . 
+      "FROM cur LEFT JOIN links ON cur_title = l_from " .
+      "WHERE l_from IS NULL " .
+      "AND cur_namespace = 0 " .
+      "ORDER BY cur_title " . 
+      "LIMIT {$offset}, {$limit}";
+    
+    $res = wfQuery( $sql, DB_READ, $fname );
+    
+    $sk = $wgUser->getSkin();
+    
+    $top = wfShowingResults( $offset, $limit );
+    $wgOut->addHTML( "<p>{$top}\n" );
+    
+    $sl = wfViewPrevNext( $offset, $limit,
+                         $wgLang->specialPage( "Deadendpages" ) );
+    $wgOut->addHTML( "<br>{$sl}\n" );
+    
+    $s = "<ol start=" . ( $offset + 1 ) . ">";
+    while ( $obj = wfFetchObject( $res ) ) {
+       $link = $sk->makeKnownLink( $obj->cur_title, "" );
+       $s .= "<li>{$link}</li>\n";
+    }
+    wfFreeResult( $res );
+    $s .= "</ol>";
+    $wgOut->addHTML( $s );
+    $wgOut->addHTML( "<p>{$sl}\n" );
+    
+    # Saving cache
+    if ( $offset > 0 OR $limit < 50 ) return ; #Not suitable
+       $log->replaceContent( $s );
+}
+
+?>
index e46869f..4fa89a8 100644 (file)
@@ -320,6 +320,7 @@ this</a> (alternative: like this<a href=\"\" class=\"internal\">?</a>).",
        "Longpages"             => "Long articles",
        "Newpages"              => "Newly created articles",
        "Ancientpages"  => "Oldest articles",
+        "Deadendpages"  => "Dead-end pages",
 #      "Intl"                => "Interlanguage Links",
        "Allpages"              => "All pages by title",
 
@@ -960,6 +961,7 @@ That comes to <b>$5</b> average edits per page, and <b>$6</b> views per edit.",
 "randompage"   => "Random page",
 "shortpages"   => "Short pages",
 "longpages"            => "Long pages",
+"deadendpages"  => "Dead-end pages",                                  
 "listusers"            => "User list",
 "specialpages" => "Special pages",
 "spheading"            => "Special pages for all users",