diff options
author | friendica <info@friendica.com> | 2014-04-02 15:13:50 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-04-02 15:13:50 -0700 |
commit | 27fec9cb6460a897098bde11b15a9543d09562db (patch) | |
tree | 3031c6c19d90df6bb6f8c4f3efd1c1421a94635b /include | |
parent | 0a097b833750ad8941dba03e6821c13facebd597 (diff) | |
download | volse-hubzilla-27fec9cb6460a897098bde11b15a9543d09562db.tar.gz volse-hubzilla-27fec9cb6460a897098bde11b15a9543d09562db.tar.bz2 volse-hubzilla-27fec9cb6460a897098bde11b15a9543d09562db.zip |
more efficient public feed fetching
Diffstat (limited to 'include')
-rw-r--r-- | include/externals.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/include/externals.php b/include/externals.php index 2ae78c11a..95ced24bf 100644 --- a/include/externals.php +++ b/include/externals.php @@ -25,7 +25,7 @@ function externals_run($argv, $argc){ $url = $arr['url']; } else { - $r = q("select site_url from site where site_url != '%s' and site_flags != %d order by rand() limit 1", + $r = q("select site_url, site_pull from site where site_url != '%s' and site_flags != %d order by rand() limit 1", dbesc(z_root()), intval(DIRECTORY_MODE_STANDALONE) ); @@ -36,16 +36,27 @@ function externals_run($argv, $argc){ $attempts ++; if($url) { - $days = get_config('externals','since_days'); - if($days === false) - $days = 15; + if($r[0]['site_pull'] !== '0000-00-00 00:00:00') + $mindate = urlencode($r[0]['site_pull']); + else { + $days = get_config('externals','since_days'); + if($days === false) + $days = 15; + $mindate = urlencode(datetime_convert('','','now - ' . intval($days) . ' days')); + } - $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - ' . intval($days) . ' days')); + $feedurl = $url . '/zotfeed?f=&mindate=' . $mindate; logger('externals: pulling public content from ' . $feedurl, LOGGER_DEBUG); - $x = z_fetch_url($feedurl); + $x = z_fetch_url($feedurl); if(($x) && ($x['success'])) { + + q("update site set site_pull = '%s' where site_url = '%s limit 1", + dbesc(datetime_convert()), + dbesc($url) + ); + $j = json_decode($x['body'],true); if($j['success'] && $j['messages']) { $sys = get_sys_channel(); |