Check general expiration time at item storing as well

This commit is contained in:
Michael 2017-07-23 05:51:55 +00:00
parent dd0a1cf586
commit 8d66909ba5

View file

@ -7,6 +7,7 @@
use Friendica\App; use Friendica\App;
use Friendica\ParseUrl; use Friendica\ParseUrl;
use Friendica\Util\Lock; use Friendica\Util\Lock;
use Friendica\Core\Config;
require_once 'include/bbcode.php'; require_once 'include/bbcode.php';
require_once 'include/oembed.php'; require_once 'include/oembed.php';
@ -564,11 +565,16 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
$arr['type'] = 'remote'; $arr['type'] = 'remote';
} }
// check for create date and expire time
$uid = intval($arr['uid']); $uid = intval($arr['uid']);
$r = q("SELECT expire FROM user WHERE uid = %d", intval($uid));
if (dbm::is_result($r)) { // check for create date and expire time
$expire_interval = $r[0]['expire']; $expire_interval = Config::get('system', 'dbclean-expire-days', 0);
$r = dba::select('user', array('expire'), array('uid' => $uid), array("limit" => 1));
if (dbm::is_result($r) && ($r['expire'] > 0) && ($r['expire'] < $expire_interval)) {
$expire_interval = $r['expire'];
}
if ($expire_interval > 0) { if ($expire_interval > 0) {
$expire_date = datetime_convert('UTC', 'UTC', '- '.$expire_interval.' days'); $expire_date = datetime_convert('UTC', 'UTC', '- '.$expire_interval.' days');
$created_date = datetime_convert('UTC', 'UTC', $arr['created']); $created_date = datetime_convert('UTC', 'UTC', $arr['created']);
@ -577,7 +583,6 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
return 0; return 0;
} }
} }
}
/* /*
* Do we already have this item? * Do we already have this item?