aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Poller.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-19 21:22:04 -0700
committerredmatrix <git@macgirvin.com>2016-05-19 21:22:04 -0700
commit39bc0664a773a97ccce276161739f217e3ba7449 (patch)
tree726fff23174f4972337ad8aae6b8ff6544264a8b /Zotlabs/Daemon/Poller.php
parent853322e7d2734ad459a4e5740f3f1806ed55532e (diff)
downloadvolse-hubzilla-39bc0664a773a97ccce276161739f217e3ba7449.tar.gz
volse-hubzilla-39bc0664a773a97ccce276161739f217e3ba7449.tar.bz2
volse-hubzilla-39bc0664a773a97ccce276161739f217e3ba7449.zip
Separate cron into periodic components and use that as the main interface for scheduled tasks instead of the quaint 'poller'.
Diffstat (limited to 'Zotlabs/Daemon/Poller.php')
-rw-r--r--Zotlabs/Daemon/Poller.php230
1 files changed, 0 insertions, 230 deletions
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index 1473b5ec6..278faf3ee 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -34,236 +34,6 @@ class Poller {
logger('poller: start');
- // run queue delivery process in the background
-
- Master::Summon(array('Queue'));
-
-
- // maintenance for mod sharedwithme - check for updated items and remove them
-
- require_once('include/sharedwithme.php');
- apply_updates();
-
-
- // expire any expired mail
-
- q("delete from mail where expires != '%s' and expires < %s ",
- dbesc(NULL_DATE),
- db_utcnow()
- );
-
- // expire any expired items
-
- $r = q("select id from item where expires != '%s' and expires < %s
- and item_deleted = 0 ",
- dbesc(NULL_DATE),
- db_utcnow()
- );
- 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 < %s - INTERVAL %s",
- db_utcnow(),
- db_quoteinterval('30 DAY')
- );
- if($r) {
- foreach($r as $rr) {
- Master::Summon(array('Directory',$rr['channel_id'],'force'));
- 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). Restrict to items that have come of age in the last
- // couple of days to limit the query to something reasonable.
-
- $r = q("select id from item where item_delayed = 1 and created <= %s and created > '%s' ",
- db_utcnow(),
- dbesc(datetime_convert('UTC','UTC','now - 2 days'))
- );
- if($r) {
- foreach($r as $rr) {
- $x = q("update item set item_delayed = 0 where id = %d",
- intval($rr['id'])
- );
- if($x) {
- Master::Summon(array('Notifier','wall-new',$rr['id']));
- }
- }
- }
-
- $abandon_days = intval(get_config('system','account_abandon_days'));
- if($abandon_days < 1)
- $abandon_days = 0;
-
-
- // once daily run birthday_updates and then expire in background
-
- // FIXME: add birthday updates, both locally and for xprof for use
- // by directory servers
-
- $d1 = intval(get_config('system','last_expire_day'));
- $d2 = intval(datetime_convert('UTC','UTC','now','d'));
-
- // Allow somebody to staggger daily activities if they have more than one site on their server,
- // or if it happens at an inconvenient (busy) hour.
-
- $h1 = intval(get_config('system','cron_hour'));
- $h2 = intval(datetime_convert('UTC','UTC','now','G'));
-
- $dirmode = get_config('system','directory_mode');
-
- /**
- * Cron Daily
- *
- * Actions in the following block are executed once per day, not on every poller run
- *
- */
-
- if(($d2 != $d1) && ($h1 == $h2)) {
-
- require_once('include/dir_fns.php');
- check_upstream_directory();
-
- call_hooks('cron_daily',datetime_convert());
-
-
- $d3 = intval(datetime_convert('UTC','UTC','now','N'));
- if($d3 == 7) {
-
- /**
- * Cron Weekly
- *
- * Actions in the following block are executed once per day only on Sunday (once per week).
- *
- */
-
-
- call_hooks('cron_weekly',datetime_convert());
-
-
- z_check_cert();
-
- require_once('include/hubloc.php');
- prune_hub_reinstalls();
-
- require_once('include/Contact.php');
- mark_orphan_hubsxchans();
-
-
- // get rid of really old poco records
-
- q("delete from xlink where xlink_updated < %s - INTERVAL %s and xlink_static = 0 ",
- db_utcnow(), db_quoteinterval('14 DAY')
- );
-
- $dirmode = intval(get_config('system','directory_mode'));
- if($dirmode === DIRECTORY_MODE_SECONDARY || $dirmode === DIRECTORY_MODE_PRIMARY) {
- logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())),true));
- }
-
- // Check for dead sites
- Master::Summon(array('Checksites'));
-
- // update searchable doc indexes
- Master::Summon(array('Importdoc'));
-
- /**
- * End Cron Weekly
- */
- }
-
- update_birthdays();
-
- //update statistics in config
- require_once('include/statistics_fns.php');
- update_channels_total_stat();
- update_channels_active_halfyear_stat();
- update_channels_active_monthly_stat();
- update_local_posts_stat();
-
- // expire any read notifications over a month old
-
- q("delete from notify where seen = 1 and date < %s - INTERVAL %s",
- db_utcnow(), db_quoteinterval('30 DAY')
- );
-
- // expire old delivery reports
-
- $keep_reports = intval(get_config('system','expire_delivery_reports'));
- if($keep_reports === 0)
- $keep_reports = 10;
-
- q("delete from dreport where dreport_time < %s - INTERVAL %s",
- db_utcnow(),
- db_quoteinterval($keep_reports . ' DAY')
- );
-
- // expire any expired accounts
- downgrade_accounts();
-
- // If this is a directory server, request a sync with an upstream
- // directory at least once a day, up to once every poll interval.
- // Pull remote changes and push local changes.
- // potential issue: how do we keep from creating an endless update loop?
-
- if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
- require_once('include/dir_fns.php');
- sync_directories($dirmode);
- }
-
- set_config('system','last_expire_day',$d2);
-
- Master::Summon(array('Expire'));
- Master::Summon(array('Cli_suggest'));
-
- require_once('include/hubloc.php');
- remove_obsolete_hublocs();
-
- /**
- * End Cron Daily
- */
- }
-
- // update any photos which didn't get imported properly
- // This should be rare
-
- $r = q("select xchan_photo_l, xchan_hash from xchan where xchan_photo_l != '' and xchan_photo_m = ''
- and xchan_photo_date < %s - INTERVAL %s",
- db_utcnow(),
- db_quoteinterval('1 DAY')
- );
- if($r) {
- require_once('include/photo/photo_driver.php');
- foreach($r as $rr) {
- $photos = import_xchan_photo($rr['xchan_photo_l'],$rr['xchan_hash']);
- $x = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
- where xchan_hash = '%s'",
- dbesc($photos[0]),
- dbesc($photos[1]),
- dbesc($photos[2]),
- dbesc($photos[3]),
- dbesc($rr['xchan_hash'])
- );
- }
- }
-
-
- // pull in some public posts
-
- if(! get_config('system','disable_discover_tab'))
- Master::Summon(array('Externals'));
-
-
$manual_id = 0;
$generation = 0;