From 43363f3e709cf72b77d5edf56e6fe371003409c9 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Mon, 17 Apr 2006 04:48:12 +0000 Subject: [PATCH] Fix issues noted by Brion; proper handing of a missing record, and correct the schema alterations (type is only 32 chars, so don't waste 255 on it). Also, skip the whole read chunk if we're never going to output the data. --- includes/QueryPage.php | 23 ++++++++++++------- languages/Messages.php | 3 ++- maintenance/archives/patch-querycacheinfo.sql | 2 +- maintenance/mysql5/tables.sql | 2 +- maintenance/tables.sql | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 600c12908e..77bcce0f78 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -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 ); + } } diff --git a/languages/Messages.php b/languages/Messages.php index ea10f171a0..e1bde11296 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -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()
Function: $1
Query: $2', diff --git a/maintenance/archives/patch-querycacheinfo.sql b/maintenance/archives/patch-querycacheinfo.sql index 0f807d81e9..eb5d7744e3 100644 --- a/maintenance/archives/patch-querycacheinfo.sql +++ b/maintenance/archives/patch-querycacheinfo.sql @@ -2,7 +2,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', diff --git a/maintenance/mysql5/tables.sql b/maintenance/mysql5/tables.sql index 95c3ddc1d1..2402e3a0a6 100644 --- a/maintenance/mysql5/tables.sql +++ b/maintenance/mysql5/tables.sql @@ -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', diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 5b23f3576e..d0b4b0d8ee 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -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', -- 2.20.1