http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65324

Revision: 65324
Author:   reedy
Date:     2010-04-20 14:26:29 +0000 (Tue, 20 Apr 2010)

Log Message:
-----------
querypage-work2: Merge r50476

Modified Paths:
--------------
    branches/querypage-work2/phase3/includes/QueryPage.php
    branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
    branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
    branches/querypage-work2/phase3/includes/specials/SpecialUnusedimages.php
    
branches/querypage-work2/phase3/includes/specials/SpecialWithoutinterwiki.php

Property Changed:
----------------
    branches/querypage-work2/
    branches/querypage-work2/phase3/
    branches/querypage-work2/phase3/includes/
    branches/querypage-work2/phase3/includes/ChangesList.php
    branches/querypage-work2/phase3/includes/ConfEditor.php
    branches/querypage-work2/phase3/includes/OutputPage.php
    branches/querypage-work2/phase3/includes/api/
    branches/querypage-work2/phase3/includes/specials/
    branches/querypage-work2/phase3/maintenance/cleanupTable.inc
    branches/querypage-work2/phase3/skins/common/jquery.js
    branches/querypage-work2/phase3/skins/common/jquery.min.js


Property changes on: branches/querypage-work2
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/branches/querypage-work:49084,49599,49631,49951,50105,50378,50436-50437,50460
   + 
/branches/querypage-work:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476


Property changes on: branches/querypage-work2/phase3
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49599,49631,49951,50105,50378,50436-50437,50460
/branches/sqlite:58211-58321
   + /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476
/branches/sqlite:58211-58321


Property changes on: branches/querypage-work2/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes:51646
/branches/querypage-work/phase3/includes:49084,49599,49631,49951,50105,50378,50436-50437,50460
/branches/sqlite/includes:58211-58321
/branches/wmf-deployment/includes:53381
   + /branches/REL1_15/phase3/includes:51646
/branches/querypage-work/phase3/includes:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476
/branches/sqlite/includes:58211-58321
/branches/wmf-deployment/includes:53381


Property changes on: branches/querypage-work2/phase3/includes/ChangesList.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/ChangesList.php:51646
/branches/querypage-work/phase3/includes/ChangesList.php:49084,49599,49631,49951,50105,50378,50436-50437,50460
/branches/wmf-deployment/includes/ChangesList.php:53381,57589
   + /branches/REL1_15/phase3/includes/ChangesList.php:51646
/branches/querypage-work/phase3/includes/ChangesList.php:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476
/branches/wmf-deployment/includes/ChangesList.php:53381,57589


Property changes on: branches/querypage-work2/phase3/includes/ConfEditor.php
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/branches/querypage-work/phase3/includes/ConfEditor.php:49084,49599,49631,49951,50105,50378,50436-50437,50460
   + 
/branches/querypage-work/phase3/includes/ConfEditor.php:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476


Property changes on: branches/querypage-work2/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/OutputPage.php:51646
/branches/querypage-work/phase3/includes/OutputPage.php:49084,49599,49631,49951,50105,50378,50436-50437,50460
/branches/wmf-deployment/includes/OutputPage.php:53381,57468
   + /branches/REL1_15/phase3/includes/OutputPage.php:51646
/branches/querypage-work/phase3/includes/OutputPage.php:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476
/branches/wmf-deployment/includes/OutputPage.php:53381,57468

Modified: branches/querypage-work2/phase3/includes/QueryPage.php
===================================================================
--- branches/querypage-work2/phase3/includes/QueryPage.php      2010-04-20 
14:25:45 UTC (rev 65323)
+++ branches/querypage-work2/phase3/includes/QueryPage.php      2010-04-20 
14:26:29 UTC (rev 65324)
@@ -60,7 +60,7 @@
  * subclasses derive from it.
  * @ingroup SpecialPage
  */
-abstract class QueryPage {
+abstract class QueryPage extends SpecialPage {
        /**
         * Whether or not we want plain listoutput rather than an ordered list
         *
@@ -77,6 +77,18 @@
        var $limit = 0;
 
        /**
+        * Wheter to show prev/next links
+        */
+       var $shownavigation = true;
+
+       /**
+        * Constructor
+        */
+       public function __construct() {
+               parent::__construct( $this->getName() );
+       }
+
+       /**
         * A mutator for $this->listoutput;
         *
         * @param $bool Boolean
@@ -92,8 +104,7 @@
         *
         * @return String
         */
-       function getName() {
-               return '';
+       abstract function getName();
        }
 
        /**
@@ -345,6 +356,13 @@
                );
                return $dbr->resultObject( $res );
        }
+
+       function doQuery( $limit, $offset = false ) {
+               if( $this->isCached() )
+                       return $this->fetchFromCache( $limit, $offset );
+               else
+                       return $this->reallyDoQuery( $limit, $offset );
+       }
        
        /**
         * Fetch the query results from the query cache
@@ -374,16 +392,11 @@
        /**
         * This is the actual workhorse. It does everything needed to make a
         * real, honest-to-gosh query page.
-        *
-        * @param $offset database query offset
-        * @param $limit database query limit
-        * @param $shownavigation show navigation like "next 200"?
         */
-       function doQuery( $offset, $limit, $shownavigation=true ) {
+       function execute( $par ) {
                global $wgUser, $wgOut, $wgLang, $wgContLang;
 
-               $this->offset = $offset;
-               $this->limit = $limit;
+               list( $this->offset, $this->limit ) = wfCheckLimits();
 
                $sname = $this->getName();
                $fname = get_class($this) . '::doQuery';
@@ -391,6 +404,7 @@
 
                $wgOut->setSyndicated( $this->isSyndicated() );
 
+               // TODO: Use doQuery()
                //$res = null;
                if ( !$this->isCached() ) {
                        $res = $this->reallyDoQuery( $limit, $offset );
@@ -432,7 +446,7 @@
                $wgOut->addHTML( XML::openElement( 'div', array('class' => 
'mw-spcontent') ) );
 
                # Top header and navigation
-               if( $shownavigation ) {
+               if( $this->shownavigation ) {
                        $wgOut->addHTML( $this->getPageHeader() );
                        if( $num > 0 ) {
                                $wgOut->addHTML( '<p>' . wfShowingResults( 
$offset, $num ) . '</p>' );


Property changes on: branches/querypage-work2/phase3/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636
/branches/querypage-work/phase3/includes/api:49084,49599,49631,49951,50105,50378,50436-50437,50460
/branches/sqlite/includes/api:58211-58321
/branches/wmf-deployment/includes/api:53381,59952
   + /branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636
/branches/querypage-work/phase3/includes/api:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476
/branches/sqlite/includes/api:58211-58321
/branches/wmf-deployment/includes/api:53381,59952


Property changes on: branches/querypage-work2/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/specials:51646
/branches/querypage-work/phase3/includes/specials:49084,49599,49631,49951,50105,50378,50436-50437,50460
/branches/sqlite/includes/specials:58211-58321
/branches/wmf-deployment/includes/specials:53381,56967
   + /branches/REL1_15/phase3/includes/specials:51646
/branches/querypage-work/phase3/includes/specials:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476
/branches/sqlite/includes/specials:58211-58321
/branches/wmf-deployment/includes/specials:53381,56967

Modified: 
branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php   
2010-04-20 14:25:45 UTC (rev 65323)
+++ branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php   
2010-04-20 14:26:29 UTC (rev 65324)
@@ -23,8 +23,7 @@
        function getQueryInfo() {
                return array (
                        'tables' => array( 'page' ),
-                       'fields' => array( "'{$this->getName()}' AS type",
-                                       'page_namespace AS namespace',
+                       'fields' => array( 'page_namespace AS namespace',
                                        'page_title AS title',
                                        'page_counter AS value'),
                        'conds' => array( 'page_is_redirect' => 0,

Modified: 
branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php     
2010-04-20 14:25:45 UTC (rev 65323)
+++ branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php     
2010-04-20 14:26:29 UTC (rev 65324)
@@ -39,6 +39,15 @@
                );
        }
 
+       function getOrderFields() {
+               // For some crazy reason ordering by a constant
+               // causes a filesort
+               if( count( MWNamespace::getContentNamespaces() ) > 1 )
+                       return array( 'page_namespace', 'page_title' );
+               else
+                       return array( 'page_title' );
+       }
+
        function preprocessResults( $db, $res ) {
                # There's no point doing a batch check if we aren't caching 
results;
                # the page must exist for it to have been pulled out of the 
table

Modified: 
branches/querypage-work2/phase3/includes/specials/SpecialUnusedimages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialUnusedimages.php   
2010-04-20 14:25:45 UTC (rev 65323)
+++ branches/querypage-work2/phase3/includes/specials/SpecialUnusedimages.php   
2010-04-20 14:26:29 UTC (rev 65324)
@@ -37,6 +37,7 @@
                );
                if ( $wgCountCategorizedImagesAsUsed ) {
                        // Order is significant
+                       // TODO: Revise query to LEFT JOIN page instead
                        $retval['tables'] = array ( 'page', 'categorylinks',
                                        'imagelinks', 'image' );
                        $retval['conds']['page_namespace'] = NS_FILE;

Modified: 
branches/querypage-work2/phase3/includes/specials/SpecialWithoutinterwiki.php
===================================================================
--- 
branches/querypage-work2/phase3/includes/specials/SpecialWithoutinterwiki.php   
    2010-04-20 14:25:45 UTC (rev 65323)
+++ 
branches/querypage-work2/phase3/includes/specials/SpecialWithoutinterwiki.php   
    2010-04-20 14:26:29 UTC (rev 65324)
@@ -66,6 +66,7 @@
                                        'LEFT JOIN', 'll_from = page_id' ) )
                );
                if ( $this->prefix ) {
+                       // TODO: Include namespace so this is indexed
                        $dbr = wfGetDb( DB_SLAVE );
                        $encPrefix = $dbr->escapeLike( $this->prefix );
                        $query['conds'][] = "page_title LIKE '{$encPrefix}%'";


Property changes on: 
branches/querypage-work2/phase3/maintenance/cleanupTable.inc
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/maintenance/cleanupTable.inc:51646
/branches/querypage-work/phase3/maintenance/cleanupTable.inc:49084,49599,49631,49951,50105,50378,50436-50437,50460
/branches/wmf-deployment/maintenance/cleanupTable.inc:56715
   + /branches/REL1_15/phase3/maintenance/cleanupTable.inc:51646
/branches/querypage-work/phase3/maintenance/cleanupTable.inc:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476
/branches/wmf-deployment/maintenance/cleanupTable.inc:56715


Property changes on: branches/querypage-work2/phase3/skins/common/jquery.js
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/branches/querypage-work/phase3/skins/common/jquery.js:49084,49599,49631,49951,50105,50378,50436-50437,50460
   + 
/branches/querypage-work/phase3/skins/common/jquery.js:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476


Property changes on: branches/querypage-work2/phase3/skins/common/jquery.min.js
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49599,49631,49951,50105,50378,50436-50437,50460
   + 
/branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49599,49631,49951,50105,50378,50436-50437,50460,50476



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to