From dae16f72c9551584ccccce2e058f179f62b6ed09 Mon Sep 17 00:00:00 2001 From: JustAMacUser Date: Tue, 26 Jul 2016 03:51:22 -0400 Subject: Only strings need 4-byte filtering. --- include/rssfuncs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 include/rssfuncs.php (limited to 'include/rssfuncs.php') diff --git a/include/rssfuncs.php b/include/rssfuncs.php old mode 100755 new mode 100644 index c01e703d1..21ffcbb76 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -778,7 +778,7 @@ foreach ($article as $k => $v) { // i guess we'll have to take the risk of 4byte unicode labels & tags here - if (!is_array($article[$k])) { + if (is_string($article[$k])) { $article[$k] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $v); } } -- cgit v1.2.3-54-g00ecf From babfadbfd245ae8752ba379d594e5c158762a606 Mon Sep 17 00:00:00 2001 From: JustAMacUser Date: Sat, 6 Aug 2016 14:16:39 -0400 Subject: Pass the value of cache_images to plugins in HOOK_ARTICLE_FILTER. --- include/rssfuncs.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/rssfuncs.php') diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 21ffcbb76..522e4bf22 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -726,7 +726,8 @@ "language" => $entry_language, "feed" => array("id" => $feed, "fetch_url" => $fetch_url, - "site_url" => $site_url) + "site_url" => $site_url, + "cache_images" => $cache_images) ); $entry_plugin_data = ""; -- cgit v1.2.3-54-g00ecf From 5cbd1fe8e4d9a67b002a681ab6bc2bc3ab60c628 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Aug 2016 15:01:01 +0300 Subject: perform housekeeping tasks for plugins loaded in user-context only --- include/functions.php | 9 ++++++--- include/rssfuncs.php | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'include/rssfuncs.php') diff --git a/include/functions.php b/include/functions.php index 3ccc09d75..3902ac45a 100755 --- a/include/functions.php +++ b/include/functions.php @@ -833,14 +833,17 @@ return $csrf_token == $_SESSION['csrf_token']; } - function load_user_plugins($owner_uid) { + function load_user_plugins($owner_uid, $pluginhost = false) { + + if (!$pluginhost) $pluginhost = PluginHost::getInstance(); + if ($owner_uid && SCHEMA_VERSION >= 100) { $plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); - PluginHost::getInstance()->load($plugins, PluginHost::KIND_USER, $owner_uid); + $pluginhost->load($plugins, PluginHost::KIND_USER, $owner_uid); if (get_schema_version() > 100) { - PluginHost::getInstance()->load_data(); + $pluginhost->load_data(); } } } diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 522e4bf22..cbd011e5c 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -179,6 +179,8 @@ $nf = 0; $bstarted = microtime(true); + $batch_owners = array(); + // For each feed, we call the feed update function. foreach ($feeds_to_update as $feed) { if($debug) _debug("Base feed: $feed"); @@ -204,6 +206,9 @@ while ($tline = db_fetch_assoc($tmp_result)) { if($debug) _debug(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]); + if (array_search($tline["owner_uid"], $batch_owners) === FALSE) + array_push($batch_owners, $tline["owner_uid"]); + $fstarted = microtime(true); $rss = update_rss_feed($tline["id"], true, false); _debug_suppress(false); @@ -220,6 +225,12 @@ microtime(true) - $bstarted, (microtime(true) - $bstarted) / $nf)); } + foreach ($batch_owners as $owner_uid) { + _debug("Running housekeeping tasks for user $owner_uid..."); + + housekeeping_user($owner_uid); + } + require_once "digest.php"; // Send feed digests by email if needed. @@ -1502,6 +1513,14 @@ _debug("Removed $frows (feeds) $crows (cats) orphaned counter cache entries."); } + function housekeeping_user($owner_uid) { + $tmph = new PluginHost(); + + load_user_plugins($owner_uid, $tmph); + + $tmph->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", ""); + } + function housekeeping_common($debug) { expire_cached_files($debug); expire_lock_files($debug); @@ -1517,6 +1536,5 @@ //_debug("Cleaned $rc cached tags."); PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", ""); - } ?> -- cgit v1.2.3-54-g00ecf