aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-24 17:09:42 -0700
committerfriendica <info@friendica.com>2015-03-24 17:09:42 -0700
commit63b8020969434756a7b966ae615c28bf7680f2f8 (patch)
tree0999882404277cb496fa713fcc2481b26541759e /include
parent1f427e0e5b3a5526625e90d43746c89953ab493a (diff)
downloadvolse-hubzilla-63b8020969434756a7b966ae615c28bf7680f2f8.tar.gz
volse-hubzilla-63b8020969434756a7b966ae615c28bf7680f2f8.tar.bz2
volse-hubzilla-63b8020969434756a7b966ae615c28bf7680f2f8.zip
more work on expiration, make system limits useful - even in retrospect
Diffstat (limited to 'include')
-rw-r--r--include/expire.php34
-rwxr-xr-xinclude/items.php6
2 files changed, 30 insertions, 10 deletions
diff --git a/include/expire.php b/include/expire.php
index 9ef0f7b69..e414a6e7d 100644
--- a/include/expire.php
+++ b/include/expire.php
@@ -38,6 +38,9 @@ function expire_run($argv, $argc){
logger('expire: start', LOGGER_DEBUG);
$site_expire = get_config('system', 'default_expire_days');
+
+ logger('site_expire: ' . $site_expire);
+
if(intval($site_expire)) {
$r = q("SELECT channel_id, channel_address, channel_pageflags, channel_expire_days from channel where true");
}
@@ -52,15 +55,18 @@ function expire_run($argv, $argc){
if($rr['channel_pageflags'] & PAGE_SYSTEM)
continue;
+ if(intval($site_expire) && (intval($site_expire) < intval($rr['channel_expire_days'])) ||
+ intval($rr['channel_expire_days'] == 0)) {
+ $expire_days = $site_expire;
+ }
+ else {
+ $expire_days = $rr['channel_expire_days'];
+ }
+
+
// if the site expiration is non-zero and less than person expiration, use that
- logger('Expire: ' . $rr['channel_address'] . ' interval: ' . ((intval($site_expire) && intval($site_expire) < intval($rr['channel_expire_days']))
- ? $site_expire
- : $rr['channel_expire_days']), LOGGER_DEBUG);
- item_expire($rr['channel_id'],
- ((intval($site_expire) && intval($site_expire) < intval($rr['channel_expire_days']))
- ? $site_expire
- : $rr['channel_expire_days'])
- );
+ logger('Expire: ' . $rr['channel_address'] . ' interval: ' . $expire_days, LOGGER_DEBUG);
+ item_expire($rr['channel_id'], $expire_days);
}
}
@@ -74,8 +80,18 @@ function expire_run($argv, $argc){
$expire_days = get_config('system','sys_expire_days');
if($expire_days === false)
$expire_days = 30;
+
+ if(intval($site_expire) && (intval($site_expire) < intval($expire_days))) {
+ $expire_days = $site_expire;
+ }
+
+ logger('Expire: sys interval: ' . $expire_days, LOGGER_DEBUG);
+
if($expire_days)
- item_expire($x['channel_id'],(($site_expire && $site_expire < $expire_days) ? $site_expire : $expire_days));
+ item_expire($x['channel_id'],$expire_days);
+
+ logger('Expire: sys: done', LOGGER_DEBUG);
+
}
return;
diff --git a/include/items.php b/include/items.php
index a1515ad88..da0e50c4c 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3922,6 +3922,10 @@ function item_expire($uid,$days) {
$expire_network_only = 1;
+ $expire_limit = get_config('system','expire_limit');
+ if(! intval($expire_limit))
+ $expire_limit = 5000;
+
$sql_extra = ((intval($expire_network_only)) ? " AND not (item_flags & " . intval(ITEM_WALL) . ") > 0 " : "");
$r = q("SELECT * FROM `item`
@@ -3930,7 +3934,7 @@ function item_expire($uid,$days) {
AND `id` = `parent`
$sql_extra
AND NOT ( item_flags & %d )>0
- AND (item_restrict = 0 ) ",
+ AND (item_restrict = 0 ) LIMIT $expire_limit ",
intval($uid),
db_utcnow(), db_quoteinterval(intval($days).' DAY'),
intval(ITEM_RETAINED)