Fix issues noted by Brion; proper handing of a missing record, and correct the schema...
authorRob Church <robchurch@users.mediawiki.org>
Mon, 17 Apr 2006 04:48:12 +0000 (04:48 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 17 Apr 2006 04:48:12 +0000 (04:48 +0000)
includes/QueryPage.php
languages/Messages.php
maintenance/archives/patch-querycacheinfo.sql
maintenance/mysql5/tables.sql
maintenance/tables.sql

index 600c129..77bcce0 100644 (file)
@@ -277,14 +277,21 @@ 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 );
+                               } else {
+                                       $cacheNotice = wfMsg( 'perfcached' );
+                               }
+       
+                               $wgOut->addWikiText( $cacheNotice );
+                       }
 
                }
 
index ea10f17..e1bde11 100644 (file)
@@ -327,7 +327,8 @@ Please report this to an administrator, making note of the URL.',
 'badtitletext' => 'The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one more characters which cannot be used in titles.',
 'perfdisabled' => 'Sorry! This feature has been temporarily disabled because it slows the database down to the point that no one can use the wiki.',
 'perfdisabledsub' => 'Here is a saved copy from $1:', # obsolete?
-'perfcached' => 'The following data is cached, and was last updated $1.',
+'perfcached' => 'The following data is cached and may not be up to date.',
+'perfcachedts' => 'The following data is cached, and was last updated $1.',
 'wrong_wfQuery_params' => 'Incorrect parameters to wfQuery()<br />
 Function: $1<br />
 Query: $2',
index 0f807d8..eb5d774 100644 (file)
@@ -2,7 +2,7 @@ CREATE TABLE /*$wgDBprefix*/querycache_info (
 \r
        -- Special page name\r
        -- Corresponds to a qc_type value\r
-       qci_type varchar(255) NOT NULL default '',\r
+       qci_type varchar(32) NOT NULL default '',\r
 \r
        -- Timestamp of last update\r
        qci_timestamp char(14) NOT NULL default '19700101000000',\r
index 95c3ddc..2402e3a 100644 (file)
@@ -960,7 +960,7 @@ CREATE TABLE /*$wgDBprefix*/querycache_info (
 
        -- Special page name
        -- Corresponds to a qc_type value
-       qci_type varchar(255) NOT NULL default '',
+       qci_type varchar(32) NOT NULL default '',
 
        -- Timestamp of last update
        qci_timestamp char(14) NOT NULL default '19700101000000',
index 5b23f35..d0b4b0d 100644 (file)
@@ -950,7 +950,7 @@ CREATE TABLE /*$wgDBprefix*/querycache_info (
 
        -- Special page name
        -- Corresponds to a qc_type value
-       qci_type varchar(255) NOT NULL default '',
+       qci_type varchar(32) NOT NULL default '',
 
        -- Timestamp of last update
        qci_timestamp char(14) NOT NULL default '19700101000000',