1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-16 16:41:29 +00:00

implement basic auto-reload on some dependent file timestamp changing

This commit is contained in:
Andrew Dolgov
2013-03-21 18:01:42 +04:00
parent 2ccc7b8e07
commit 16314ddafe
2 changed files with 20 additions and 0 deletions

View File

@@ -2034,6 +2034,8 @@
$data['last_article_id'] = getLastArticleId($link);
$data['cdm_expanded'] = get_pref($link, 'CDM_EXPANDED');
$data['dep_ts'] = calculate_dep_timestamp();
if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) {
$data['daemon_is_running'] = (int) file_is_locked("update_daemon.lock");
@@ -4103,4 +4105,16 @@
echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n";
}
function calculate_dep_timestamp() {
$files = array_merge(glob("js/*.js"), glob("*.css"));
$max_ts = -1;
foreach ($files as $file) {
if (filemtime($file) > $max_ts) $max_ts = filemtime($file);
}
return $max_ts;
}
?>