diff options
author | redmatrix <git@macgirvin.com> | 2016-01-26 15:12:34 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-01-26 15:12:34 -0800 |
commit | 3494fddd7c13637c8fb25104002b59448f182e79 (patch) | |
tree | 0565ce258ad40aab4ba3b82a1725fac872d3a886 | |
parent | 424af13891fb76889c134699d68b8be05f8514d0 (diff) | |
download | volse-hubzilla-3494fddd7c13637c8fb25104002b59448f182e79.tar.gz volse-hubzilla-3494fddd7c13637c8fb25104002b59448f182e79.tar.bz2 volse-hubzilla-3494fddd7c13637c8fb25104002b59448f182e79.zip |
change help text on other channel expiration setting to inform that there is a system limit. Ignore imported feed content that is older than expiration interval.
-rwxr-xr-x | include/items.php | 22 | ||||
-rw-r--r-- | mod/settings.php | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php index 6acf1c883..b00631e2b 100755 --- a/include/items.php +++ b/include/items.php @@ -3687,6 +3687,16 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { return; } + $sys_expire = intval(get_config('system','default_expire_days')); + $chn_expire = intval($importer['channel_expire_days']); + + $expire_days = $sys_expire; + + if(($chn_expire != 0) && ($chn_expire < $sys_expire)) + $expire_days = $chn_expire; + +logger('expire_days: ' . $expire_days); + $feed = new SimplePie(); $feed->set_raw_data($xml); $feed->init(); @@ -3790,6 +3800,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { intval($importer['channel_id']) ); + // Update content if 'updated' changes if($r) { @@ -3848,6 +3859,17 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { $datarray['owner_xchan'] = $contact['xchan_hash']; + if(array_key_exists('created',$datarray) && $datarray['created'] != NULL_DATE && $expire_days) { + $t1 = $datarray['created']; + $t2 = datetime_convert('UTC','UTC','now - ' . $expire_days . 'days'); + if($t1 < $t2) { + logger('feed content older than expiration. Ignoring.', LOGGER_DEBUG, LOG_INFO); + continue; + } + } + + + $r = q("SELECT edited FROM item WHERE mid = '%s' AND uid = %d LIMIT 1", dbesc($item_id), intval($importer['channel_id']) diff --git a/mod/settings.php b/mod/settings.php index d2ba590a2..cc75bbd56 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -917,6 +917,7 @@ function settings_content(&$a) { $maxreq = $channel['channel_max_friend_req']; $expire = $channel['channel_expire_days']; $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT); + $sys_expire = get_config('system','default_expire_days'); // $unkmail = $a->user['unkmail']; // $cntunkmail = $a->user['cntunkmail']; @@ -1050,7 +1051,7 @@ function settings_content(&$a) { '$lbl_p2macro' => t('Advanced Privacy Settings'), - '$expire' => array('expire',t('Expire other channel content after this many days'),$expire,t('0 or blank prevents expiration')), + '$expire' => array('expire',t('Expire other channel content after this many days'),$expire,sprintf( t('0 or blank to use the website limit. The website expires after %d days.'),intval($sys_expire))), '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')), '$permissions' => t('Default Post Permissions'), '$permdesc' => t("\x28click to open/close\x29"), |