Index: branches/5.2.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r16657 -r16664 --- branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 16657) +++ branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 16664) @@ -1,6 +1,6 @@ Conn->Query($sql); } + /** + * Populates URL unit cache + * + * @param kEvent $event Event. + * + * @return void + */ + protected function OnPopulateUrlUnitCacheScheduledTask(kEvent $event) + { + $sql = 'SELECT DISTINCT Prefixes + FROM ' . TABLE_PREFIX . 'CachedUrls'; + $urls = $this->Conn->GetColIterator($sql); + $prefixes = array(); + + foreach ( $urls as $url_prefixes ) { + $url_prefixes = explode('|', trim($url_prefixes, '|')); + + foreach ( $url_prefixes as $url_prefix ) { + $url_prefix = explode(':', $url_prefix); + $prefixes[$url_prefix[0]] = 1; + } + } + + if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) { + $this->Application->setCache('cached_urls_unit_prefixes', array_keys($prefixes), 3600); + } + else { + $this->Application->setDBCache('cached_urls_unit_prefixes', serialize(array_keys($prefixes)), 3600); + } + } + }