aboutsummaryrefslogtreecommitdiffstats
path: root/include/poller.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/poller.php')
-rw-r--r--include/poller.php50
1 files changed, 29 insertions, 21 deletions
diff --git a/include/poller.php b/include/poller.php
index bc48c3f00..031fb4533 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -59,10 +59,9 @@ function poller_run($argv, $argc){
// expire any expired items
$r = q("select id from item where expires != '%s' and expires < %s
- and ( item_restrict & %d ) = 0 ",
+ and item_deleted = 0 ",
dbesc(NULL_DATE),
- db_utcnow(),
- intval(ITEM_DELETED)
+ db_utcnow()
);
if($r) {
require_once('include/items.php');
@@ -91,15 +90,13 @@ function poller_run($argv, $argc){
// (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_restrict & %d ) > 0 and created <= %s and created > '%s' ",
- intval(ITEM_DELAYED_PUBLISH),
+ $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_restrict = ( item_restrict & ~%d ) where id = %d",
- intval(ITEM_DELAYED_PUBLISH),
+ $x = q("update item set item_delayed = 0 where id = %d",
intval($rr['id'])
);
if($x) {
@@ -178,6 +175,12 @@ function poller_run($argv, $argc){
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
+ proc_run('php', 'include/checksites.php');
+
+ // update searchable doc indexes
+ proc_run('php', 'include/importdoc.php');
+
/**
* End Cron Weekly
*/
@@ -198,6 +201,17 @@ function poller_run($argv, $argc){
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 = 30;
+
+ q("delete from dreport where dreport_time < %s - INTERVAL %s",
+ db_utcnow(),
+ db_quoteinterval($keep_reports . ' DAY')
+ );
+
// expire any expired accounts
downgrade_accounts();
@@ -235,7 +249,7 @@ function poller_run($argv, $argc){
if($r) {
require_once('include/photo/photo_driver.php');
foreach($r as $rr) {
- $photos = import_profile_photo($rr['xchan_photo_l'],$rr['xchan_hash']);
+ $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]),
@@ -296,13 +310,11 @@ function poller_run($argv, $argc){
$randfunc = db_getfunc('RAND');
- $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_xchan, abook_channel, xchan_network
- FROM abook LEFT JOIN xchan on abook_xchan = xchan_hash LEFT JOIN account on abook_account = account_id
+ $contacts = q("SELECT * FROM abook LEFT JOIN xchan on abook_xchan = xchan_hash
+ LEFT JOIN account on abook_account = account_id
+ where abook_self = 0
$sql_extra
- AND (( abook_flags & %d ) > 0 OR ( abook_flags = %d ))
AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY $randfunc",
- intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED|ABOOK_FLAG_FEED),
- intval(0),
intval(ACCOUNT_OK),
intval(ACCOUNT_UNVERIFIED) // FIXME
@@ -312,15 +324,12 @@ function poller_run($argv, $argc){
foreach($contacts as $contact) {
- if($contact['abook_flags'] & ABOOK_FLAG_SELF)
- continue;
-
$update = false;
$t = $contact['abook_updated'];
$c = $contact['abook_connected'];
- if($contact['abook_flags'] & ABOOK_FLAG_FEED) {
+ if(intval($contact['abook_feed'])) {
$min = service_class_fetch($contact['abook_channel'],'minimum_feedcheck_minutes');
if(! $min)
$min = intval(get_config('system','minimum_feedcheck_minutes'));
@@ -359,15 +368,14 @@ function poller_run($argv, $argc){
// He's dead, Jim
if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 30 day")) > 0) {
- $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d",
- intval(ABOOK_FLAG_ARCHIVED),
+ $r = q("update abook set abook_archived = 1 where abook_id = %d",
intval($contact['abook_id'])
);
$update = false;
continue;
}
- if($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) {
+ if(intval($contact['abook_archived'])) {
$update = false;
continue;
}
@@ -388,7 +396,7 @@ function poller_run($argv, $argc){
}
- if($contact['abook_flags'] & (ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED|ABOOK_FLAG_IGNORED))
+ if(intval($contact['abook_pending']) || intval($contact['abook_archived']) || intval($contact['abook_ignored']) || intval($contact['abook_blocked']))
continue;
if((! $update) && (! $force))