diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/account.php | 5 | ||||
-rw-r--r-- | include/items.php | 55 |
2 files changed, 25 insertions, 35 deletions
diff --git a/include/account.php b/include/account.php index 98d7f00a8..a1fb0f159 100644 --- a/include/account.php +++ b/include/account.php @@ -1117,6 +1117,7 @@ function account_service_class_allows($aid, $property, $usage = false) { */ function service_class_fetch($uid, $property) { + $service_class = null; if($uid == local_channel()) { $service_class = App::$account['account_service_class']; @@ -1127,7 +1128,7 @@ function service_class_fetch($uid, $property) { where c.channel_account_id=a.account_id and c.channel_id= %d limit 1", intval($uid) ); - if($r !== false and count($r)) { + if($r) { $service_class = $r[0]['service_class']; } } @@ -1161,7 +1162,7 @@ function account_service_class_fetch($aid, $property) { $r = q("select account_service_class as service_class from account where account_id = %d limit 1", intval($aid) ); - if($r !== false && count($r)) { + if($r) { $service_class = $r[0]['service_class']; } diff --git a/include/items.php b/include/items.php index a9930470c..989edf683 100644 --- a/include/items.php +++ b/include/items.php @@ -3755,45 +3755,34 @@ function item_expire($uid,$days,$comment_days = 7) { $sql_extra = ((intval($expire_network_only)) ? " AND item_wall = 0 " : ""); - $expire_limit = get_config('system','expire_limit'); - if(! intval($expire_limit)) - $expire_limit = 5000; + $expire_limit = get_config('system','expire_limit', 1000); $item_normal = item_normal(); - $r = q("SELECT id FROM item - WHERE uid = %d - AND created < %s - INTERVAL %s - AND commented < %s - INTERVAL %s - AND item_retained = 0 - AND item_thread_top = 1 - AND resource_type = '' - AND item_starred = 0 - $sql_extra $item_normal LIMIT $expire_limit ", - intval($uid), - db_utcnow(), - db_quoteinterval(intval($days) . ' DAY'), - db_utcnow(), - db_quoteinterval(intval($comment_days) . ' DAY') - ); - - if(! $r) - return; - - $r = fetch_post_tags($r,true); - - foreach($r as $item) { - - // don't expire filed items + do { + $r = q("SELECT id FROM item + WHERE uid = %d + AND created < %s - INTERVAL %s + AND commented < %s - INTERVAL %s + AND item_retained = 0 + AND item_thread_top = 1 + AND resource_type = '' + AND item_starred = 0 + $sql_extra $item_normal LIMIT $expire_limit", + intval($uid), + db_utcnow(), + db_quoteinterval(intval($days) . ' DAY'), + db_utcnow(), + db_quoteinterval(intval($comment_days) . ' DAY') + ); - if (isset($item['term']) && get_terms_oftype($item['term'], TERM_FILE)) { - retain_item($item['id']); - continue; + if ($r) { + foreach ($r as $item) { + drop_item($item['id'], false); + } } - drop_item($item['id'],false); - } - + } while ($r); } function retain_item($id) { |