summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-21 18:01:42 +0400
committerAndrew Dolgov <[email protected]>2013-03-21 18:01:42 +0400
commit16314ddafe88b6c214892799a5da354e2188524c (patch)
treeb6e2ddcbbc0d53b1201f5e60d143d4f434037d3b /include
parent2ccc7b8e07d584f85e4f5d4477d554de31a15272 (diff)
implement basic auto-reload on some dependent file timestamp changing
Diffstat (limited to 'include')
-rw-r--r--include/functions.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/functions.php b/include/functions.php
index 3d6b7c89a..aa5575548 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -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;
+ }
+
?>