aboutsummaryrefslogtreecommitdiffstats
path: root/include/poller.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/poller.php')
-rw-r--r--include/poller.php35
1 files changed, 32 insertions, 3 deletions
diff --git a/include/poller.php b/include/poller.php
index 94ca99e54..3c4e6402c 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -21,6 +21,11 @@ function poller_run($argv, $argc){
}
}
+ $interval = intval(get_config('system','poll_interval'));
+ if(! $interval)
+ $interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval')));
+
+
logger('poller: start');
// run queue delivery process in the background
@@ -37,7 +42,34 @@ function poller_run($argv, $argc){
intval(ACCOUNT_EXPIRED),
intval(ACCOUNT_EXPIRED)
);
+
+ // expire any expired mail
+
+ q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() ");
+
+ $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP()
+ and not ( item_restrict & %d ) ",
+ intval(ITEM_DELETED)
+ );
+ if($r) {
+ require_once('include/items.php');
+ foreach($r as $rr)
+ drop_item($rr['id'],false);
+ }
+ // Ensure that every channel pings a directory server once a month. This way we can discover
+ // channels and sites that quietly vanished and prevent the directory from accumulating stale
+ // or dead entries.
+
+ $r = q("select channel_id from channel where channel_dirdate < UTC_TIMESTAMP() - INTERVAL 30 DAY");
+ if($r) {
+ foreach($r as $rr) {
+ proc_run('php','include/directory.php',$rr['channel_id']);
+ if($interval)
+ @time_sleep_until(microtime(true) + (float) $interval);
+ }
+ }
+
// publish any applicable items that were set to be published in the future
// (time travel posts)
@@ -134,9 +166,6 @@ function poller_run($argv, $argc){
$force = true;
}
- $interval = intval(get_config('system','poll_interval'));
- if(! $interval)
- $interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval')));
$sql_extra = (($manual_id) ? " AND abook_id = $manual_id " : "");