diff --git a/application/Espo/Core/Utils/Config.php b/application/Espo/Core/Utils/Config.php index 4b944a3988..5185c5f3ee 100644 --- a/application/Espo/Core/Utils/Config.php +++ b/application/Espo/Core/Utils/Config.php @@ -62,15 +62,14 @@ class Config return $this->fileManager; } - - /** * Get an option from config * * @param string $name + * @param string $default * @return string | array */ - public function get($name) + public function get($name, $default = null) { $keys = explode('.', $name); @@ -79,7 +78,7 @@ class Config if (isset($lastBranch[$keyName]) && is_array($lastBranch)) { $lastBranch = $lastBranch[$keyName]; } else { - return null; + return $default; } } @@ -94,7 +93,7 @@ class Config * @param string $value * @return bool */ - public function set($name, $value='') + public function set($name, $value = '') { if (is_array($name)) { return $this->setArray($name); diff --git a/frontend/client/src/app.js b/frontend/client/src/app.js index 497deb934f..2708cad98d 100644 --- a/frontend/client/src/app.js +++ b/frontend/client/src/app.js @@ -30,8 +30,8 @@ Espo.App = function (options, callback) { if (this.useCache) { this.cache = new Espo.Cache(); - if (options.r) { - this.cache.handleActuality(options.r); + if (options.cacheTimestamp) { + this.cache.handleActuality(options.cacheTimestamp); } } diff --git a/frontend/client/src/cache.js b/frontend/client/src/cache.js index 6772b96fb7..84a00f15a4 100644 --- a/frontend/client/src/cache.js +++ b/frontend/client/src/cache.js @@ -26,15 +26,15 @@ Espo.Cache = Bull.Cacher.extend({ _prefix: 'espo-cache', - handleActuality: function (timestamp) { - var stored = this.get('app', 'timestamp'); + handleActuality: function (cacheTimestamp) { + var stored = parseInt(this.get('app', 'cacheTimestamp')); if (stored) { - if (stored != timestamp) { + if (stored !== cacheTimestamp) { this.clear(); } } else { this.clear(); - this.set('app', 'timestamp', timestamp); + this.set('app', 'cacheTimestamp', cacheTimestamp); } }, diff --git a/frontend/html/main.html b/frontend/html/main.html index 8ce10dc67a..356580c559 100644 --- a/frontend/html/main.html +++ b/frontend/html/main.html @@ -11,7 +11,7 @@ $(function () { var app = new Espo.App({ useCache: true, - r: '@@timestamp' + cacheTimestamp: {{cacheTimestamp}} }, function (app) { app.start(); }); diff --git a/index.php b/index.php index 714ec938d5..6b8e04fb99 100644 --- a/index.php +++ b/index.php @@ -27,7 +27,7 @@ $app = new \Espo\Core\Application(); $app->isInstalled(); if (empty($_GET['entryPoint'])) { - include "main.html"; + $app->runClient(); } else { $app->runEntryPoint($_GET['entryPoint']); }