1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-14 05:55:56 +00:00

perform housekeeping tasks for plugins loaded in user-context only

This commit is contained in:
Andrew Dolgov
2016-08-11 15:01:01 +03:00
parent d39a2f8005
commit 5cbd1fe8e4
2 changed files with 25 additions and 4 deletions

View File

@@ -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", "");
}
?>