diff options
author | redmatrix <git@macgirvin.com> | 2016-06-19 19:12:33 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-06-19 19:12:33 -0700 |
commit | fb61c4fb3497d3751bb43f12cadee9e9c7776be9 (patch) | |
tree | 604989e10424456783fccff1fccc5b14da26db7f /Zotlabs/Daemon/Cron_daily.php | |
parent | bfaabfb7b5ff639992a01b0e1fc374cd43d536e9 (diff) | |
parent | 4578649f758e65f1d87ebb98da7cd891d0b90d0d (diff) | |
download | volse-hubzilla-fb61c4fb3497d3751bb43f12cadee9e9c7776be9.tar.gz volse-hubzilla-fb61c4fb3497d3751bb43f12cadee9e9c7776be9.tar.bz2 volse-hubzilla-fb61c4fb3497d3751bb43f12cadee9e9c7776be9.zip |
Merge branch '1.8RC'
Diffstat (limited to 'Zotlabs/Daemon/Cron_daily.php')
-rw-r--r-- | Zotlabs/Daemon/Cron_daily.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php new file mode 100644 index 000000000..a16d49853 --- /dev/null +++ b/Zotlabs/Daemon/Cron_daily.php @@ -0,0 +1,90 @@ +<?php /** @file */ + +namespace Zotlabs\Daemon; + +class Cron_daily { + + static public function run($argc,$argv) { + + logger('cron_daily: start'); + + /** + * Cron Daily + * + */ + + + require_once('include/dir_fns.php'); + check_upstream_directory(); + + + // Fire off the Cron_weekly process if it's the correct day. + + $d3 = intval(datetime_convert('UTC','UTC','now','N')); + if($d3 == 7) { + Master::Summon(array('Cron_weekly')); + } + + // once daily run birthday_updates and then expire in background + + // FIXME: add birthday updates, both locally and for xprof for use + // by directory servers + + update_birthdays(); + + // expire any read notifications over a month old + + q("delete from notify where seen = 1 and created < %s - INTERVAL %s", + db_utcnow(), db_quoteinterval('30 DAY') + ); + + //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 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? + + $dirmode = get_config('system','directory_mode'); + + if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { + require_once('include/dir_fns.php'); + sync_directories($dirmode); + } + + + Master::Summon(array('Expire')); + Master::Summon(array('Cli_suggest')); + + require_once('include/hubloc.php'); + remove_obsolete_hublocs(); + + call_hooks('cron_daily',datetime_convert()); + + set_config('system','last_expire_day',$d2); + + /** + * End Cron Daily + */ + } +} |