fixed isInstalled()

This commit is contained in:
Taras Machyshyn
2014-04-16 16:41:11 +03:00
parent 702b5bb83c
commit 645d7353d6
3 changed files with 14 additions and 17 deletions
+6 -12
View File
@@ -80,16 +80,16 @@ class Application
$this->initRoutes(); $this->initRoutes();
$this->getSlim()->run(); $this->getSlim()->run();
} }
public function runClient() public function runClient()
{ {
$config = $this->getContainer()->get('config'); $config = $this->getContainer()->get('config');
$html = file_get_contents('main.html'); $html = file_get_contents('main.html');
$html = str_replace('{{cacheTimestamp}}', $config->get('cacheTimestamp', 0), $html); $html = str_replace('{{cacheTimestamp}}', $config->get('cacheTimestamp', 0), $html);
$html = str_replace('{{useCache}}', $config->get('useCache') ? 'true' : 'false' , $html); $html = str_replace('{{useCache}}', $config->get('useCache') ? 'true' : 'false' , $html);
echo $html; echo $html;
exit; exit;
} }
public function runEntryPoint($entryPoint) public function runEntryPoint($entryPoint)
@@ -129,21 +129,15 @@ class Application
$cronManager->run(); $cronManager->run();
} }
public function isInstalled($useRedirect = true) public function isInstalled()
{ {
$config = $this->getContainer()->get('config'); $config = $this->getContainer()->get('config');
$result = false;
if (file_exists($config->get('configPath')) && $config->get('isInstalled')) { if (file_exists($config->get('configPath')) && $config->get('isInstalled')) {
$result = true; return true;
} }
if ($useRedirect && !$result) { return false;
header("Location: install/");
exit;
}
return $result;
} }
protected function routeHooks() protected function routeHooks()
+7 -4
View File
@@ -18,17 +18,20 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/. * along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/ ************************************************************************/
include "bootstrap.php"; include "bootstrap.php";
$app = new \Espo\Core\Application(); $app = new \Espo\Core\Application();
$app->isInstalled(); if (!$app->isInstalled()) {
header("Location: install/");
exit;
}
if (!empty($_GET['entryPoint'])) { if (!empty($_GET['entryPoint'])) {
$app->runEntryPoint($_GET['entryPoint']); $app->runEntryPoint($_GET['entryPoint']);
exit; exit;
} }
$app->runClient(); $app->runClient();
+1 -1
View File
@@ -105,7 +105,7 @@ class Installer
public function isInstalled() public function isInstalled()
{ {
return $this->app->isInstalled(false); return $this->app->isInstalled();
} }