Files
oc-server3/htdocs/util2/cron/modules/publish_caches.class.php
following 61f58adf3c 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")
2013-06-10 17:16:29 +02:00

34 lines
951 B
PHP

<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
*
* Publish new geocaches that are marked for timed publish
***************************************************************************/
checkJob(new publish_caches());
class publish_caches
{
var $name = 'publish_caches';
var $interval = 60;
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))
{
$userid = $rPublish['user_id'];
$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);
}
}
?>