Skip to content
Permalink
Browse files

exclude seasonal caches from 6-month auto-archiving; updates #808

  • Loading branch information...
following5 committed Jan 22, 2016
1 parent e861177 commit c408c024f4e03c7d86275c00249bd959cc2d5714
Showing with 7 additions and 4 deletions.
  1. +7 −4 htdocs/util2/cron/modules/autoarchive_caches.class.php
@@ -45,7 +45,7 @@ function archive_disabled_caches()
// This statement may be optimized. It typically runs for ~15 seconds at OC.de.
$rs = sql("
SELECT `cache_id`,
SELECT `caches`.`cache_id`,
`caches`.`user_id`,
DATEDIFF(NOW(), `listing_last_modified`) AS `listing_age`,
(SELECT MAX(`date_modified`) FROM `cache_status_modified` `csm`
@@ -54,9 +54,11 @@ function archive_disabled_caches()
(SELECT MAX(`user_id`) FROM `cache_status_modified` `csm`
WHERE `csm`.`cache_id`=`cache_id` AND `csm`.`date_modified`=`disable_date`)
`disabled_by`,
IFNULL(DATEDIFF(NOW(), `user`.`last_login`), 150) `login_lag`
IFNULL(DATEDIFF(NOW(), `user`.`last_login`), 150) `login_lag`,
`ca`.`attrib_id` IS NOT NULL `seasonal_cache`
FROM `caches`
LEFT JOIN `user` ON `user`.`user_id`=`caches`.`user_id`
LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=60
WHERE `status`=2 AND DATEDIFF(NOW(), `listing_last_modified`) > 184
ORDER BY `listing_last_modified`");
@@ -66,10 +68,11 @@ function archive_disabled_caches()
if ($rCache['listing_age'] > 366 ||
($rCache['listing_age'] > 184 &&
(sql_value("SELECT DATEDIFF(NOW(),'&1')", 0, $rCache['disable_date']) > 366 ||
((($rCache['disabled_by'] != 0 && $rCache['disabled_by'] != $rCache['user_id'] && $rCache['login_lag'] > 45)
(!$rCache['seasonal_cache'] &&
(($rCache['disabled_by'] != 0 && $rCache['disabled_by'] != $rCache['user_id'] && $rCache['login_lag'] > 45)
||
($rCache['disabled_by'] == $rCache['user_id'] && $rCache['login_lag'] >= $rCache['listing_age']))
&&
&&
sql_value("SELECT MAX(`date`) FROM `cache_logs` WHERE `cache_logs`.`cache_id`='&1'", "", $rCache['cache_id']) < $rCache['disable_date']
)
)

0 comments on commit c408c02

Please sign in to comment.
You can’t perform that action at this time.