Index: trunk/phase3/maintenance/archives/patch-tc-timestamp.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +ALTER TABLE /*_*/transcache MODIFY tc_time varchar(14); |
| 3 | +UPDATE /*_*/transcache SET tc_time = DATE_FORMAT(FROM_UNIXTIME(tc_time), "%Y%c%d%H%i%s"); |
| 4 | + |
| 5 | +INSERT INTO /*_*/updatelog VALUES ('convert transcache field'); |
Property changes on: trunk/phase3/maintenance/archives/patch-tc-timestamp.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 6 | + native |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -192,7 +192,8 @@ |
193 | 193 | array( 'add_index', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ), |
194 | 194 | array( 'add_index', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ), |
195 | 195 | array( 'add_field', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ), |
196 | | - |
| 196 | + array( 'do_update_transcache_field' ), |
| 197 | + |
197 | 198 | // version-independent searchindex setup, added in 1.16 |
198 | 199 | array( 'sqlite_setup_searchindex' ), |
199 | 200 | ), |
— | — | @@ -1342,6 +1343,18 @@ |
1343 | 1344 | wfOut( "ok\n" ); |
1344 | 1345 | } |
1345 | 1346 | |
| 1347 | +function do_update_transcache_field() { |
| 1348 | + global $wgDatabase; |
| 1349 | + if( update_row_exists( 'convert transcache field' ) ) { |
| 1350 | + wfOut( "...transcache tc_time already converted.\n" ); |
| 1351 | + return; |
| 1352 | + } else { |
| 1353 | + wfOut( "Converting tc_time from int(11) to varchar(13)... " ); |
| 1354 | + $wgDatabase->sourceFile( archive( 'patch-tc-timestamp.sql' ) ); |
| 1355 | + wfOut( "ok\n" ); |
| 1356 | + } |
| 1357 | +} |
| 1358 | + |
1346 | 1359 | /*********************************************************************** |
1347 | 1360 | * Start PG stuff |
1348 | 1361 | * TODO: merge with above |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3172,14 +3172,11 @@ |
3173 | 3173 | function fetchScaryTemplateMaybeFromCache($url) { |
3174 | 3174 | global $wgTranscludeCacheExpiry; |
3175 | 3175 | $dbr = wfGetDB(DB_SLAVE); |
| 3176 | + $tsCond = $dbr->timestamp( time() - $wgTranscludeCacheExpiry ); |
3176 | 3177 | $obj = $dbr->selectRow('transcache', array('tc_time', 'tc_contents'), |
3177 | | - array('tc_url' => $url)); |
| 3178 | + array('tc_url' => $url, "tc_time >= " . $dbr->addQuotes( $tsCond ) ) ); |
3178 | 3179 | if ($obj) { |
3179 | | - $time = $obj->tc_time; |
3180 | | - $text = $obj->tc_contents; |
3181 | | - if ($time && time() < $time + $wgTranscludeCacheExpiry ) { |
3182 | | - return $text; |
3183 | | - } |
| 3180 | + return $obj->tc_contents; |
3184 | 3181 | } |
3185 | 3182 | |
3186 | 3183 | $text = Http::get($url); |