geocache scheduled publishing and auto-archiving improvements
- set user ID for status-change logging when running cron/publish_caces - discarded obsolete lib1 cache publishing code - separate enable/disable settings for auto-archive cronjob - fixed auto-archive threshold for leap years (message is "was disabled > 1 year")
This commit is contained in:
+7
-5
@@ -16,16 +16,18 @@ checkJob(new autoarchive());
|
||||
class autoarchive
|
||||
{
|
||||
var $name = 'autoarchive';
|
||||
var $interval = 120; // provisonal minimum interval for initial archiving
|
||||
var $interval = 120; // provisional minimum interval for initial archiving
|
||||
|
||||
|
||||
function run()
|
||||
{
|
||||
global $opt, $login;
|
||||
|
||||
if ($login->system_login($opt['logic']['systemuser']['user']))
|
||||
if ($opt['cron']['autoarchive']['run'])
|
||||
{
|
||||
if ($login->hasAdminPriv(ADMIN_USER))
|
||||
if (!$login->logged_in())
|
||||
echo $this->name . ": not logged in / no system user configured\n";
|
||||
elseif ($login->hasAdminPriv(ADMIN_USER))
|
||||
{
|
||||
$this->archive_disabled_caches();
|
||||
$this->archive_events();
|
||||
@@ -43,7 +45,7 @@ class autoarchive
|
||||
$rs = sql("SELECT `caches`.`cache_id`
|
||||
FROM `caches`
|
||||
WHERE `caches`.`status`=2 AND `caches`.`type`<>6
|
||||
AND IFNULL((SELECT MAX(`date_modified`) FROM `cache_status_modified` `csm` WHERE `csm`.`cache_id`=`caches`.`cache_id`),`caches`.`listing_last_modified`) < NOW() - INTERVAL 365 DAY
|
||||
AND IFNULL((SELECT MAX(`date_modified`) FROM `cache_status_modified` `csm` WHERE `csm`.`cache_id`=`caches`.`cache_id`),`caches`.`listing_last_modified`) < NOW() - INTERVAL 366 DAY
|
||||
GROUP BY `caches`.`cache_id`
|
||||
ORDER BY `caches`.`listing_last_modified`
|
||||
LIMIT 1"); // provisional limit for initial archiving
|
||||
@@ -68,7 +70,7 @@ class autoarchive
|
||||
WHERE `caches`.`type`=6 AND `caches`.`status`=1
|
||||
AND GREATEST(`date_hidden`,`date_created`) < NOW() - INTERVAL 35 DAY
|
||||
ORDER BY `date_hidden`
|
||||
LIMIT 1"); // provisonal limit for initial archiving
|
||||
LIMIT 1"); // provisional limit for initial archiving
|
||||
while ($rCache = sql_fetch_assoc($rs))
|
||||
{
|
||||
$this->archive_cache(
|
||||
@@ -16,6 +16,8 @@ class publish_caches
|
||||
|
||||
function run()
|
||||
{
|
||||
global $login;
|
||||
|
||||
$rsPublish = sql("SELECT `cache_id`, `user_id` FROM `caches` WHERE `status`=5 AND NOT ISNULL(`date_activate`) AND `date_activate`<=NOW()");
|
||||
while($rPublish = sql_fetch_array($rsPublish))
|
||||
{
|
||||
@@ -23,6 +25,7 @@ class publish_caches
|
||||
$cacheid = $rPublish['cache_id'];
|
||||
|
||||
// update cache status to active
|
||||
sql("SET @STATUS_CHANGE_USER_ID='&1'", $login->userid);
|
||||
sql("UPDATE `caches` SET `status`=1, `date_activate`=NULL WHERE `cache_id`='&1'", $cacheid);
|
||||
}
|
||||
sql_free_result($rsPublish);
|
||||
|
||||
Reference in New Issue
Block a user