-<?
-
-function wfSpecialLonelypages()
-{
- global $wgUser, $wgOut, $wgLang, $wgTitle;
- $fname = "wfSpecialLonelypages";
-
- # Cache
- $vsp = $wgLang->getValidSpecialPages();
- $log = new LogPage( $vsp["Lonelypages"] );
- $log->mUpdateRecentChanges = false;
-
- global $wgMiserMode;
- if ( $wgMiserMode ) {
- $log->showAsDisabledPage();
- return;
+<?php
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
+
+/**
+ *
+ */
+require_once( "QueryPage.php" );
+
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
+class LonelyPagesPage extends PageQueryPage {
+
+ function getName() {
+ return "Lonelypages";
}
- list( $limit, $offset ) = wfCheckLimits();
+ function sortDescending() {
+ return false;
+ }
- $sql = "SELECT cur_title FROM cur LEFT JOIN links ON " .
- "cur_id=l_to WHERE l_to IS NULL AND cur_namespace=0 AND " .
- "cur_is_redirect=0 ORDER BY cur_title LIMIT {$offset}, {$limit}";
- $res = wfQuery( $sql, $fname );
+ function isExpensive() {
+ return true;
+ }
+ function isSyndicated() { return false; }
+
+ function getSQL() {
+ $dbr =& wfGetDB( DB_SLAVE );
+ extract( $dbr->tableNames( 'page', 'pagelinks' ) );
+
+ return
+ "SELECT 'Lonelypages' AS type,
+ page_namespace AS namespace,
+ page_title AS title,
+ page_title AS value
+ FROM $page
+ LEFT JOIN $pagelinks
+ ON page_namespace=pl_namespace AND page_title=pl_title
+ WHERE pl_namespace IS NULL
+ AND page_namespace=".NS_MAIN."
+ AND page_is_redirect=0";
- $sk = $wgUser->getSkin();
+ }
+}
- $top = wfShowingResults( $offset, $limit );
- $wgOut->addHTML( "<p>{$top}\n" );
+/**
+ * Constructor
+ */
+function wfSpecialLonelypages() {
+ list( $limit, $offset ) = wfCheckLimits();
- $sl = wfViewPrevNext( $offset, $limit,
- $wgLang->specialPage( "Lonelypages" ) );
- $wgOut->addHTML( "<br>{$sl}\n" );
+ $lpp = new LonelyPagesPage();
- $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 );
+ return $lpp->doQuery( $offset, $limit );
}
?>