diff --git a/application/Espo/Core/Application.php b/application/Espo/Core/Application.php index ba9cd0c657..b2c90048da 100644 --- a/application/Espo/Core/Application.php +++ b/application/Espo/Core/Application.php @@ -80,16 +80,16 @@ class Application $this->initRoutes(); $this->getSlim()->run(); } - + public function runClient() { $config = $this->getContainer()->get('config'); - + $html = file_get_contents('main.html'); $html = str_replace('{{cacheTimestamp}}', $config->get('cacheTimestamp', 0), $html); $html = str_replace('{{useCache}}', $config->get('useCache') ? 'true' : 'false' , $html); echo $html; - exit; + exit; } public function runEntryPoint($entryPoint) @@ -129,21 +129,15 @@ class Application $cronManager->run(); } - public function isInstalled($useRedirect = true) + public function isInstalled() { $config = $this->getContainer()->get('config'); - $result = false; if (file_exists($config->get('configPath')) && $config->get('isInstalled')) { - $result = true; + return true; } - if ($useRedirect && !$result) { - header("Location: install/"); - exit; - } - - return $result; + return false; } protected function routeHooks() diff --git a/index.php b/index.php index a0f3613583..6fe44b51c3 100644 --- a/index.php +++ b/index.php @@ -18,17 +18,20 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ + ************************************************************************/ include "bootstrap.php"; - + $app = new \Espo\Core\Application(); -$app->isInstalled(); +if (!$app->isInstalled()) { + header("Location: install/"); + exit; +} if (!empty($_GET['entryPoint'])) { $app->runEntryPoint($_GET['entryPoint']); - exit; + exit; } $app->runClient(); diff --git a/install/core/Installer.php b/install/core/Installer.php index bb8282c709..66e2190776 100644 --- a/install/core/Installer.php +++ b/install/core/Installer.php @@ -105,7 +105,7 @@ class Installer public function isInstalled() { - return $this->app->isInstalled(false); + return $this->app->isInstalled(); }