Bug 6031 (feature request for __NOGALLERY__ on category pages) fixed
[lhc/web/wiklou.git] / includes / QueryPage.php
index 600c129..515e458 100644 (file)
@@ -4,11 +4,6 @@
  * @package MediaWiki
  */
 
-/**
- *
- */
-require_once 'Feed.php';
-
 /**
  * List of query page classes and their associated special pages, for periodic update purposes
  */
@@ -40,6 +35,7 @@ $wgQueryPages = array(
        array( 'WantedCategoriesPage',          'Wantedcategories'              ),
        array( 'WantedPagesPage',               'Wantedpages'                   ),
        array( 'UnwatchedPagesPage',            'Unwatchedpages'                ),
+       array( 'UnusedtemplatesPage', 'Unusedtemplates' ),
 );
 wfRunHooks( 'wgQueryPages', array( &$wgQueryPages ) );
 
@@ -62,6 +58,14 @@ class QueryPage {
         * @var bool
         */
        var $listoutput = false;
+       
+       /**
+        * The offset and limit in use, as passed to the query() function
+        *
+        * @var integer
+        */
+       var $offset = 0;
+       var $limit = 0;
 
        /**
         * A mutator for $this->listoutput;
@@ -81,6 +85,15 @@ class QueryPage {
                return '';
        }
 
+       /**
+        * Return title object representing this page
+        *
+        * @return Title
+        */
+       function getTitle() {
+               return Title::makeTitle( NS_SPECIAL, $this->getName() );
+       }
+
        /**
         * Subclasses return an SQL query here.
         *
@@ -263,6 +276,9 @@ class QueryPage {
        function doQuery( $offset, $limit, $shownavigation=true ) {
                global $wgUser, $wgOut, $wgLang, $wgContLang;
 
+               $this->offset = $offset;
+               $this->limit = $limit;
+
                $sname = $this->getName();
                $fname = get_class($this) . '::doQuery';
                $sql = $this->getSQL();
@@ -277,14 +293,23 @@ class QueryPage {
                                "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value
                                 FROM $querycache WHERE qc_type='$type'";
 
-                       # Fetch the timestamp of this update
-                       $tRes = $dbr->select( 'querycache_info', array( 'qci_timestamp' ), array( 'qci_type' => $type ), $fname );
-                       $tRow = $dbr->fetchObject( $tRes );
-                       $updated = $tRow->qci_timestamp;
-                       $updatedTs = $wgLang->timeAndDate( $updated, true, true );
-
-                       if ( ! $this->listoutput )
-                               $wgOut->addWikiText( wfMsg( 'perfcached', $updatedTs ) );
+                       if( !$this->listoutput ) {
+
+                               # Fetch the timestamp of this update
+                               $tRes = $dbr->select( 'querycache_info', array( 'qci_timestamp' ), array( 'qci_type' => $type ), $fname );
+                               $tRow = $dbr->fetchObject( $tRes );
+                               
+                               if( $tRow ) {
+                                       $updated = $wgLang->timeAndDate( $tRow->qci_timestamp, true, true );
+                                       $cacheNotice = wfMsg( 'perfcachedts', $updated );
+                                       $wgOut->addMeta( 'Data-Cache-Time', $tRow->qci_timestamp );
+                                       $wgOut->addScript( '<script language="JavaScript">var dataCacheTime = \'' . $tRow->qci_timestamp . '\';</script>' );
+                               } else {
+                                       $cacheNotice = wfMsg( 'perfcached' );
+                               }
+       
+                               $wgOut->addWikiText( $cacheNotice );
+                       }
 
                }