diff options
author | friendica <info@friendica.com> | 2014-03-03 19:15:11 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-03-03 19:15:11 -0800 |
commit | bfd9f5ec87ed0b21e278ea5c94016623c9985850 (patch) | |
tree | c8763214bcb9952080afeb6568ad5680eb4f56b8 | |
parent | 12480a13cd46b5aa747dc72b42b0d78b8852d2bb (diff) | |
download | volse-hubzilla-bfd9f5ec87ed0b21e278ea5c94016623c9985850.tar.gz volse-hubzilla-bfd9f5ec87ed0b21e278ea5c94016623c9985850.tar.bz2 volse-hubzilla-bfd9f5ec87ed0b21e278ea5c94016623c9985850.zip |
enable network/matrix expiration, this should be functional but the options have been reduced/restricted so we're only looking at network posts and ignore anything that is filed, starred, or is resource_type 'photo' (which should not be possible in non-wall posts, but we just want to be sure). Will require the adventurous tester(s) to set 'channel_expire_days' in their channel record.
-rwxr-xr-x | boot.php | 2 | ||||
-rwxr-xr-x | include/items.php | 50 | ||||
-rw-r--r-- | include/poller.php | 9 |
3 files changed, 32 insertions, 29 deletions
@@ -528,6 +528,8 @@ define ( 'ITEM_MENTIONSME', 0x0400); define ( 'ITEM_NOCOMMENT', 0x0800); // commenting/followups are disabled define ( 'ITEM_OBSCURED', 0x1000); // bit-mangled to protect from casual browsing by site admin define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was successful +define ( 'ITEM_RETAINED', 0x4000); // We looked at this item once to decide whether or not to expire it, and decided not to. + // Don't make us evaluate this same item again. /** * * Reverse the effect of magic_quotes_gpc if it is enabled. diff --git a/include/items.php b/include/items.php index d380a7939..6ff984370 100755 --- a/include/items.php +++ b/include/items.php @@ -3409,8 +3409,11 @@ function item_expire($uid,$days) { // $expire_network_only = save your own wall posts // and just expire conversations started by others + // do not enable this until we can pass bulk delete messages through zot + // $expire_network_only = get_pconfig($uid,'expire','network_only'); + + $expire_network_only = 1; - $expire_network_only = get_pconfig($uid,'expire','network_only'); $sql_extra = ((intval($expire_network_only)) ? " AND not (item_flags & " . intval(ITEM_WALL) . ") " : ""); $r = q("SELECT * FROM `item` @@ -3418,14 +3421,11 @@ function item_expire($uid,$days) { AND `created` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `id` = `parent` $sql_extra - AND NOT (item_restrict & %d ) - AND NOT (item_restrict & %d ) - AND NOT (item_restrict & %d ) ", + AND NOT ( item_flags & %d ) + AND (item_restrict = 0 ) ", intval($uid), intval($days), - intval(ITEM_DELETED), - intval(ITEM_WEBPAGE), - intval(ITEM_BUILDBLOCK) + intval(ITEM_RETAINED) ); if(! $r) @@ -3433,44 +3433,40 @@ function item_expire($uid,$days) { $r = fetch_post_tags($r,true); - $expire_items = get_pconfig($uid, 'expire','items'); - $expire_items = (($expire_items===false)?1:intval($expire_items)); // default if not set: 1 - - $expire_notes = get_pconfig($uid, 'expire','notes'); - $expire_notes = (($expire_notes===false)?1:intval($expire_notes)); // default if not set: 1 - - $expire_starred = get_pconfig($uid, 'expire','starred'); - $expire_starred = (($expire_starred===false)?1:intval($expire_starred)); // default if not set: 1 - - $expire_photos = get_pconfig($uid, 'expire','photos'); - $expire_photos = (($expire_photos===false)?0:intval($expire_photos)); // default if not set: 0 - - logger('expire: # items=' . count($r). "; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos"); - foreach($r as $item) { - - // don't expire filed items $terms = get_terms_oftype($item['term'],TERM_FILE); - if($terms) + if($terms) { + retain_item($item['id']); continue; + } // Only expire posts, not photos and photo comments - if($expire_photos==0 && ($item['resource_type'] === 'photo')) + if($item['resource_type'] === 'photo') { + retain_item($item['id']); continue; - if($expire_starred==0 && ($item['item_flags'] & ITEM_STARRED)) + } + if($item['item_flags'] & ITEM_STARRED) { + retain_item($item['id']); continue; + } drop_item($item['id'],false); } - proc_run('php',"include/notifier.php","expire","$uid"); +// proc_run('php',"include/notifier.php","expire","$uid"); } +function retain_item($id) { + $r = q("update item set item_flags = (item_flags | %d ) where id = %d limit 1", + intval(ITEM_RETAINED), + intval($id) + ); +} function drop_items($items) { $uid = 0; diff --git a/include/poller.php b/include/poller.php index 77452cafa..649da30f6 100644 --- a/include/poller.php +++ b/include/poller.php @@ -96,9 +96,13 @@ function poller_run($argv, $argc){ $dirmode = get_config('system','directory_mode'); + /** + * Cron Daily + * + * Actions in the following block are executed once per day, not on every poller run + * + */ - // Actions in the following block are executed once per day, not on every poller run - if($d2 != intval($d1)) { // expire any read notifications over a month old @@ -121,6 +125,7 @@ function poller_run($argv, $argc){ set_config('system','last_expire_day',$d2); + proc_run('php','include/expire.php'); proc_run('php','include/cli_suggest.php'); } |