Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1098805
D355.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Aug 14, 5:52 AM
Size
2 KB
Mime Type
text/x-diff
Expires
Fri, Aug 15, 5:52 AM (4 h, 14 m)
Engine
blob
Format
Raw Data
Handle
711458
Attached To
D355: INP-1759 Use delayed cached Mod-Rewrite URL invalidation
D355.diff
View Options
Index: core/kernel/managers/cache_manager.php
===================================================================
--- core/kernel/managers/cache_manager.php
+++ core/kernel/managers/cache_manager.php
@@ -802,10 +802,11 @@
if (!defined('IS_INSTALL') || !IS_INSTALL) {
// delete cached mod-rewrite urls related to given prefix and id
$delete_clause = isset($id) ? $prefix . ':' . $id : $prefix;
-
- $sql = 'DELETE FROM ' . TABLE_PREFIX . 'CachedUrls
- WHERE Prefixes LIKE ' . $this->Conn->qstr('%|' . $delete_clause . '|%');
- $this->Conn->Query($sql);
+ $this->Conn->doUpdate(
+ array('Url' => '', 'Hash' => 0),
+ TABLE_PREFIX . 'CachedUrls',
+ 'Prefixes LIKE ' . $this->Conn->qstr('%|' . $delete_clause . '|%')
+ );
}
}
Index: core/units/admin/admin_config.php
===================================================================
--- core/units/admin/admin_config.php
+++ core/units/admin/admin_config.php
@@ -30,6 +30,7 @@
'ScheduledTasks' => Array (
'optimize_performance' => Array ('EventName' => 'OnOptimizePerformance', 'RunSchedule' => '0 0 * * *'),
+ 'delete_expired_cached_urls' => array('EventName' => 'OnDeleteExpiredCachedUrlsScheduledTask', 'RunSchedule' => '0 */12 * * *'),
),
'TitlePresets' => Array (
Index: core/units/admin/admin_events_handler.php
===================================================================
--- core/units/admin/admin_events_handler.php
+++ core/units/admin/admin_events_handler.php
@@ -1166,6 +1166,25 @@
}
/**
+ * Deletes CachedUrls that have Hash equals to 0
+ *
+ * @param kEvent $event Event.
+ *
+ * @return void
+ * @access protected
+ */
+ protected function OnDeleteExpiredCachedUrlsScheduledTask(kEvent $event)
+ {
+ $sql = 'DELETE FROM ' . TABLE_PREFIX . 'CachedUrls
+ WHERE Hash = 0
+ LIMIT 500';
+
+ do {
+ $this->Conn->Query($sql);
+ } while ( $this->Conn->getAffectedRows() == 500 );
+ }
+
+ /**
* Returns popup size (by template), if not cached, then parse template to get value
*
* @param kEvent $event
Event Timeline
Log In to Comment