r13685 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13684‎ | r13685 | r13686 >
Date:04:48, 17 April 2006
Author:robchurch
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/languages/Messages.php (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-querycacheinfo.sql (modified) (history)
  • /trunk/phase3/maintenance/mysql5/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/patch-querycacheinfo.sql
@@ -2,7 +2,7 @@
33
44 -- Special page name
55 -- Corresponds to a qc_type value
6 - qci_type varchar(255) NOT NULL default '',
 6+ qci_type varchar(32) NOT NULL default '',
77
88 -- Timestamp of last update
99 qci_timestamp char(14) NOT NULL default '19700101000000',
Index: trunk/phase3/maintenance/mysql5/tables.sql
@@ -960,7 +960,7 @@
961961
962962 -- Special page name
963963 -- Corresponds to a qc_type value
964 - qci_type varchar(255) NOT NULL default '',
 964+ qci_type varchar(32) NOT NULL default '',
965965
966966 -- Timestamp of last update
967967 qci_timestamp char(14) NOT NULL default '19700101000000',
Index: trunk/phase3/maintenance/tables.sql
@@ -950,7 +950,7 @@
951951
952952 -- Special page name
953953 -- Corresponds to a qc_type value
954 - qci_type varchar(255) NOT NULL default '',
 954+ qci_type varchar(32) NOT NULL default '',
955955
956956 -- Timestamp of last update
957957 qci_timestamp char(14) NOT NULL default '19700101000000',
Index: trunk/phase3/includes/QueryPage.php
@@ -277,14 +277,21 @@
278278 "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value
279279 FROM $querycache WHERE qc_type='$type'";
280280
281 - # Fetch the timestamp of this update
282 - $tRes = $dbr->select( 'querycache_info', array( 'qci_timestamp' ), array( 'qci_type' => $type ), $fname );
283 - $tRow = $dbr->fetchObject( $tRes );
284 - $updated = $tRow->qci_timestamp;
285 - $updatedTs = $wgLang->timeAndDate( $updated, true, true );
 281+ if( !$this->listoutput ) {
286282
287 - if ( ! $this->listoutput )
288 - $wgOut->addWikiText( wfMsg( 'perfcached', $updatedTs ) );
 283+ # Fetch the timestamp of this update
 284+ $tRes = $dbr->select( 'querycache_info', array( 'qci_timestamp' ), array( 'qci_type' => $type ), $fname );
 285+ $tRow = $dbr->fetchObject( $tRes );
 286+
 287+ if( $tRow ) {
 288+ $updated = $wgLang->timeAndDate( $tRow->qci_timestamp, true, true );
 289+ $cacheNotice = wfMsg( 'perfcachedts', $updated );
 290+ } else {
 291+ $cacheNotice = wfMsg( 'perfcached' );
 292+ }
 293+
 294+ $wgOut->addWikiText( $cacheNotice );
 295+ }
289296
290297 }
291298
Index: trunk/phase3/languages/Messages.php
@@ -327,7 +327,8 @@
328328 '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.',
329329 'perfdisabled' => 'Sorry! This feature has been temporarily disabled because it slows the database down to the point that no one can use the wiki.',
330330 'perfdisabledsub' => 'Here is a saved copy from $1:', # obsolete?
331 -'perfcached' => 'The following data is cached, and was last updated $1.',
 331+'perfcached' => 'The following data is cached and may not be up to date.',
 332+'perfcachedts' => 'The following data is cached, and was last updated $1.',
332333 'wrong_wfQuery_params' => 'Incorrect parameters to wfQuery()<br />
333334 Function: $1<br />
334335 Query: $2',

Status & tagging log