mirror of
https://github.com/grocy/grocy.git
synced 2025-08-21 04:43:32 +00:00
Clear /data/viewcache also when BASE_URL or BASE_PATH changed (references #2384)
This commit is contained in:
12
app.php
12
app.php
@@ -58,13 +58,15 @@ if (!file_exists($viewcachePath))
|
|||||||
mkdir($viewcachePath);
|
mkdir($viewcachePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty data/viewcache when the version changed (so when an update was done) and trigger database migrations
|
// Empty data/viewcache when and trigger database migrations when:
|
||||||
$releaseHash = hash_file('sha256', __DIR__ . '/version.json');
|
// The version changed (so when an update was done)
|
||||||
$releaseHashCacheFile = $viewcachePath . "/$releaseHash.txt";
|
// GROCY_BASE_URL OR GROCY_BASE_PATH changed
|
||||||
if (!file_exists($releaseHashCacheFile))
|
$hash = hash('sha256', file_get_contents(__DIR__ . '/version.json') . GROCY_BASE_URL . GROCY_BASE_PATH);
|
||||||
|
$hashCacheFile = $viewcachePath . "/$hash.txt";
|
||||||
|
if (!file_exists($hashCacheFile))
|
||||||
{
|
{
|
||||||
EmptyFolder($viewcachePath);
|
EmptyFolder($viewcachePath);
|
||||||
touch($releaseHashCacheFile);
|
touch($hashCacheFile);
|
||||||
|
|
||||||
if (function_exists('opcache_reset'))
|
if (function_exists('opcache_reset'))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user