fix expire so it actually should expire stuff; and mostly the correct stuff - though it DOESN'T currently send out notifications to connections
This commit is contained in:
parent
6da4e41031
commit
f287ff596c
@ -3144,21 +3144,28 @@ function item_expire($uid,$days) {
|
||||
// and just expire conversations started by others
|
||||
|
||||
$expire_network_only = get_pconfig($uid,'expire','network_only');
|
||||
$sql_extra = ((intval($expire_network_only)) ? " AND wall = 0 " : "");
|
||||
$sql_extra = ((intval($expire_network_only)) ? " AND not (item_flags & " . intval(ITEM_WALL) . ") " : "");
|
||||
|
||||
$r = q("SELECT * FROM `item`
|
||||
WHERE `uid` = %d
|
||||
AND `created` < UTC_TIMESTAMP() - INTERVAL %d DAY
|
||||
AND `id` = `parent`
|
||||
$sql_extra
|
||||
AND `deleted` = 0",
|
||||
AND NOT (item_restrict & %d )
|
||||
AND NOT (item_restrict & %d )
|
||||
AND NOT (item_restrict & %d ) ",
|
||||
intval($uid),
|
||||
intval($days)
|
||||
intval($days),
|
||||
intval(ITEM_DELETED),
|
||||
intval(ITEM_WEBPAGE),
|
||||
intval(ITEM_BUILDBLOCK)
|
||||
);
|
||||
|
||||
if(! count($r))
|
||||
if(! $r)
|
||||
return;
|
||||
|
||||
$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
|
||||
|
||||
@ -3175,20 +3182,19 @@ function item_expire($uid,$days) {
|
||||
|
||||
foreach($r as $item) {
|
||||
|
||||
|
||||
|
||||
// don't expire filed items
|
||||
|
||||
if(strpos($item['file'],'[') !== false)
|
||||
$terms = get_terms_oftype($item['term'],TERM_FILE);
|
||||
if($terms)
|
||||
continue;
|
||||
|
||||
// Only expire posts, not photos and photo comments
|
||||
|
||||
if($expire_photos==0 && strlen($item['resource_id']))
|
||||
if($expire_photos==0 && $item['resource_type'] === 'photo'))
|
||||
continue;
|
||||
if($expire_starred==0 && intval($item['starred']))
|
||||
continue;
|
||||
if($expire_notes==0 && $item['type']=='note')
|
||||
continue;
|
||||
if($expire_items==0 && $item['type']!='note')
|
||||
if($expire_starred==0 && ($item['item_flags'] & ITEM_STARRED))
|
||||
continue;
|
||||
|
||||
drop_item($item['id'],false);
|
||||
|
@ -330,7 +330,6 @@ function settings_post(&$a) {
|
||||
|
||||
|
||||
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
|
||||
$expire_notes = ((x($_POST,'expire_notes')) ? intval($_POST['expire_notes']) : 0);
|
||||
$expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0);
|
||||
$expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0);
|
||||
$expire_network_only = ((x($_POST,'expire_network_only'))? intval($_POST['expire_network_only']) : 0);
|
||||
|
Reference in New Issue
Block a user