This part of the API seems universally ignored. If anybody needs this, they're going...
[lhc/web/wiklou.git] / includes / QueryPage.php
index 7edc7db..e52669f 100644 (file)
@@ -381,9 +381,9 @@ abstract class QueryPage extends SpecialPage {
        }
 
        /**
-        * Parameters and order changed in 1.18
+        * Somewhat deprecated, you probably want to be using execute()
         */
-       function doQuery( $limit, $offset = false ) {
+       function doQuery( $offset = false, $limit = false ) {
                if ( $this->isCached() && $this->isCacheable() ) {
                        return $this->fetchFromCache( $limit, $offset );
                } else {
@@ -437,15 +437,16 @@ abstract class QueryPage extends SpecialPage {
         * real, honest-to-gosh query page.
         */
        function execute( $par ) {
-               global $wgUser, $wgOut, $wgLang;
+               global $wgUser, $wgOut, $wgLang, $wgRequest;
 
                if ( !$this->userCanExecute( $wgUser ) ) {
                        $this->displayRestrictionError();
                        return;
                }
 
-               if ( $this->limit == 0 && $this->offset == 0 )
-                       list( $this->limit, $this->offset ) = wfCheckLimits();
+               if ( $this->limit == 0 && $this->offset == 0 ) {
+                       list( $this->limit, $this->offset ) = $wgRequest->getLimitOffset();
+               }
                $dbr = wfGetDB( DB_SLAVE );
 
                $this->setHeaders();
@@ -552,8 +553,9 @@ abstract class QueryPage extends SpecialPage {
 
                if ( $num > 0 ) {
                        $html = array();
-                       if ( !$this->listoutput )
+                       if ( !$this->listoutput ) {
                                $html[] = $this->openList( $offset );
+                       }
 
                        # $res might contain the whole 1,000 rows, so we read up to
                        # $num [should update this to use a Pager]
@@ -583,8 +585,9 @@ abstract class QueryPage extends SpecialPage {
                                }
                        }
 
-                       if ( !$this->listoutput )
+                       if ( !$this->listoutput ) {
                                $html[] = $this->closeList();
+                       }
 
                        $html = $this->listoutput
                                ? $wgContLang->listToText( $html )
@@ -631,7 +634,6 @@ abstract class QueryPage extends SpecialPage {
                                $this->feedUrl() );
                        $feed->outHeader();
 
-                       $dbr = wfGetDB( DB_SLAVE );
                        $res = $this->reallyDoQuery( $limit, 0 );
                        foreach ( $res as $obj ) {
                                $item = $this->feedResult( $obj );
@@ -686,8 +688,7 @@ abstract class QueryPage extends SpecialPage {
 
        function feedTitle() {
                global $wgLanguageCode, $wgSitename;
-               $page = SpecialPage::getPage( $this->getName() );
-               $desc = $page->getDescription();
+               $desc = $this->getDescription();
                return "$wgSitename - $desc [$wgLanguageCode]";
        }
 
@@ -696,8 +697,7 @@ abstract class QueryPage extends SpecialPage {
        }
 
        function feedUrl() {
-               $title = SpecialPage::getTitleFor( $this->getName() );
-               return $title->getFullURL();
+               return $this->getTitle()->getFullURL();
        }
 }