Index: trunk/phase3/maintenance/archives/patch-querycacheinfo.sql |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +CREATE TABLE /*$wgDBprefix*/querycache_info (
|
| 3 | +
|
| 4 | + -- Special page name
|
| 5 | + -- Corresponds to a qc_type value
|
| 6 | + qci_type varchar(255) NOT NULL default '',
|
| 7 | +
|
| 8 | + -- Timestamp of last update
|
| 9 | + qci_timestamp char(14) NOT NULL default '19700101000000',
|
| 10 | +
|
| 11 | + UNIQUE KEY ( qci_type )
|
| 12 | +
|
| 13 | +) TYPE=InnoDB; |
\ No newline at end of file |
Index: trunk/phase3/maintenance/mysql5/tables.sql |
— | — | @@ -954,3 +954,17 @@ |
955 | 955 | PRIMARY KEY job_id (job_id), |
956 | 956 | KEY (job_cmd, job_namespace, job_title) |
957 | 957 | ) TYPE=InnoDB, DEFAULT CHARSET=utf8; |
| 958 | + |
| 959 | +-- Details of updates to cached special pages |
| 960 | +CREATE TABLE /*$wgDBprefix*/querycache_info ( |
| 961 | + |
| 962 | + -- Special page name |
| 963 | + -- Corresponds to a qc_type value |
| 964 | + qci_type varchar(255) NOT NULL default '', |
| 965 | + |
| 966 | + -- Timestamp of last update |
| 967 | + qci_timestamp char(14) NOT NULL default '19700101000000', |
| 968 | + |
| 969 | + UNIQUE KEY ( qci_type ) |
| 970 | + |
| 971 | +) TYPE=InnoDB; |
\ No newline at end of file |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | array( 'externallinks', 'patch-externallinks.sql' ), |
31 | 31 | array( 'job', 'patch-job.sql' ), |
32 | 32 | array( 'langlinks', 'patch-langlinks.sql' ), |
| 33 | + array( 'querycache_info', 'patch-querycacheinfo.sql' ), |
33 | 34 | ); |
34 | 35 | |
35 | 36 | $wgNewFields = array( |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -943,3 +943,18 @@ |
944 | 944 | PRIMARY KEY job_id (job_id), |
945 | 945 | KEY (job_cmd, job_namespace, job_title) |
946 | 946 | ) TYPE=InnoDB; |
| 947 | + |
| 948 | + |
| 949 | +-- Details of updates to cached special pages |
| 950 | +CREATE TABLE /*$wgDBprefix*/querycache_info ( |
| 951 | + |
| 952 | + -- Special page name |
| 953 | + -- Corresponds to a qc_type value |
| 954 | + qci_type varchar(255) NOT NULL default '', |
| 955 | + |
| 956 | + -- Timestamp of last update |
| 957 | + qci_timestamp char(14) NOT NULL default '19700101000000', |
| 958 | + |
| 959 | + UNIQUE KEY ( qci_type ) |
| 960 | + |
| 961 | +) TYPE=InnoDB; |
\ No newline at end of file |
Index: trunk/phase3/includes/QueryPage.php |
— | — | @@ -243,6 +243,11 @@ |
244 | 244 | $dbw->ignoreErrors( $ignoreW ); |
245 | 245 | $dbr->ignoreErrors( $ignoreR ); |
246 | 246 | } |
| 247 | + |
| 248 | + # Update the querycache_info record for the page |
| 249 | + $dbw->delete( 'querycache_info', array( 'qci_type' => $this->getName() ), $fname ); |
| 250 | + $dbw->insert( 'querycache_info', array( 'qci_type' => $this->getName(), 'qci_timestamp' => $dbw->timestamp() ), $fname ); |
| 251 | + |
247 | 252 | } |
248 | 253 | return $num; |
249 | 254 | } |
— | — | @@ -256,7 +261,7 @@ |
257 | 262 | * @param $shownavigation show navigation like "next 200"? |
258 | 263 | */ |
259 | 264 | function doQuery( $offset, $limit, $shownavigation=true ) { |
260 | | - global $wgUser, $wgOut, $wgContLang; |
| 265 | + global $wgUser, $wgOut, $wgLang, $wgContLang; |
261 | 266 | |
262 | 267 | $sname = $this->getName(); |
263 | 268 | $fname = get_class($this) . '::doQuery'; |
— | — | @@ -271,8 +276,16 @@ |
272 | 277 | $sql = |
273 | 278 | "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value |
274 | 279 | FROM $querycache WHERE qc_type='$type'"; |
| 280 | + |
| 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 ); |
| 286 | + |
275 | 287 | if ( ! $this->listoutput ) |
276 | | - $wgOut->addWikiText( wfMsg( 'perfcached' ) ); |
| 288 | + $wgOut->addWikiText( wfMsg( 'perfcached', $updatedTs ) ); |
| 289 | + |
277 | 290 | } |
278 | 291 | |
279 | 292 | $sql .= $this->getOrder(); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -81,6 +81,7 @@ |
82 | 82 | * (bug 5570) Problems using <special page>/parameter link form for long titles |
83 | 83 | * (bug 3884) Add $user parameter to AddNewUser hook, call it for by-email |
84 | 84 | registrations as well as self-registrations. |
| 85 | +* (bug 4327) Report age of cached data sets in query pages |
85 | 86 | |
86 | 87 | |
87 | 88 | == Compatibility == |