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.
This commit is contained in:
parent
12480a13cd
commit
bfd9f5ec87
2
boot.php
2
boot.php
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user