2016-05-20 04:22:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Daemon;
|
|
|
|
|
|
|
|
class Cron_weekly {
|
|
|
|
|
|
|
|
static public function run($argc,$argv) {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
|
|
|
|
prune_hub_reinstalls();
|
|
|
|
|
|
|
|
mark_orphan_hubsxchans();
|
|
|
|
|
2017-11-13 05:36:25 +00:00
|
|
|
// Find channels that were removed in the last three weeks, but
|
|
|
|
// haven't been finally cleaned up. These should be older than 10
|
|
|
|
// days to ensure that "purgeall" messages have gone out or bounced
|
|
|
|
// or timed out.
|
|
|
|
|
|
|
|
$r = q("select channel_id from channel where channel_removed = 1 and
|
|
|
|
channel_deleted > %s - INTERVAL %s and channel_deleted < %s - INTERVAL %s",
|
|
|
|
db_utcnow(), db_quoteinterval('21 DAY'),
|
|
|
|
db_utcnow(), db_quoteinterval('10 DAY')
|
|
|
|
);
|
|
|
|
if($r) {
|
|
|
|
foreach($r as $rv) {
|
|
|
|
channel_remove_final($rv['channel_id']);
|
|
|
|
}
|
|
|
|
}
|
2016-05-20 04:22:04 +00:00
|
|
|
|
|
|
|
// 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')
|
|
|
|
);
|
|
|
|
|
|
|
|
// Check for dead sites
|
2020-06-15 07:29:56 +00:00
|
|
|
Run::Summon(array('Checksites'));
|
2020-03-05 04:07:26 +00:00
|
|
|
|
|
|
|
|
2020-08-17 04:55:59 +00:00
|
|
|
// clean up image cache - use site expiration or 60 days if not set or zero
|
2020-03-05 04:07:26 +00:00
|
|
|
|
|
|
|
$files = glob('cache/img/*/*');
|
2020-08-17 04:55:59 +00:00
|
|
|
$expire_days = intval(get_config('system','default_expire_days'));
|
|
|
|
if ($expire_days <= 0) {
|
|
|
|
$expire_days = 60;
|
|
|
|
}
|
2020-03-05 04:07:26 +00:00
|
|
|
$now = time();
|
2020-08-17 04:55:59 +00:00
|
|
|
$maxage = 86400 * $expire_days;
|
2020-03-05 04:07:26 +00:00
|
|
|
if ($files) {
|
|
|
|
foreach ($files as $file) {
|
|
|
|
if (is_file($file)) {
|
2020-08-17 04:55:59 +00:00
|
|
|
if ($now - filemtime($file) >= $maxage) {
|
2020-03-05 04:07:26 +00:00
|
|
|
unlink($file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-20 04:22:04 +00:00
|
|
|
// update searchable doc indexes
|
2021-03-01 23:59:57 +00:00
|
|
|
|
|
|
|
Run::Summon(array('Importdoc'));
|
2016-05-20 04:22:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* End Cron Weekly
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|