Skip to content

Commit 4178038

Browse files
committed
src: cache_safe() uses part of MD5 of modified time
Suggested by: @fabianfrz
1 parent b0d67d7 commit 4178038

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/opnsense/www/index.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ function view_file_exists($filename)
4040
*/
4141
function view_cache_safe($url)
4242
{
43-
$myview = \Phalcon\DI::getDefault()->get('view');
44-
45-
if (!empty($myview->product_hash)) {
46-
return "{$url}?v={$myview->product_hash}";
43+
$info = stat('/usr/local/opnsense/www/index.php');
44+
if (!empty($info['mtime'])) {
45+
return "{$url}?v=" . substr(md5($info['mtime']), 0, 16);
4746
}
4847

4948
return $url;

src/www/guiconfig.inc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ function html_safe($text)
6363

6464
function cache_safe($url)
6565
{
66-
global $g;
67-
68-
if (!empty($g['product_hash'])) {
69-
return "{$url}?v={$g['product_hash']}";
66+
$info = stat('/usr/local/opnsense/www/index.php');
67+
if (!empty($info['mtime'])) {
68+
return "{$url}?v=" . substr(md5($info['mtime']), 0, 16);
7069
}
7170

7271
return $url;

0 commit comments

Comments
 (0)