From df114fc180dee83cec76bcf8b18ac808a6d0f603 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Sun, 27 Oct 2013 11:50:54 -0500 Subject: [PATCH] fix to installer --- install/ApplicationInstaller/Installer.php | 76 ++++++++++------------ 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/install/ApplicationInstaller/Installer.php b/install/ApplicationInstaller/Installer.php index b571106..e2bb9eb 100755 --- a/install/ApplicationInstaller/Installer.php +++ b/install/ApplicationInstaller/Installer.php @@ -17,50 +17,44 @@ class Installer extends Base { $this->loadConfig(); - if ($this->request()->path() == '/') { - if (!$this->validateSafeIps()) { - # Client not allowed - if ($this->dataDirExists()) { - # Updating message - $this->renderMessage(self::$PLEASE_WAIT_MESSAGE); - } else { - # Installing message - $this->renderMessage(sprintf(self::$ACCESS_DENIED_MESSAGE, $_SERVER['REMOTE_ADDR'])); - } + if (!$this->validateSafeIps()) { + # Client not allowed + if ($this->dataDirExists()) { + # Updating message + $this->renderMessage(self::$PLEASE_WAIT_MESSAGE); } else { - # Client allowed; serve forms/commit actions - try { - # To make things nice, check write permissions - # on some paths. - $this->checkWriteablePaths(); - - if ($this->request()->isGet()) { - # Serve forms - if ($this->dataDirExists()) { - # Update form - $this->renderUpdateForm(); - } else { - # Install form - $this->renderInstallForm(); - } - } else { - # Commit actions - if ($this->dataDirExists()) { - # Update - $this->commitUpdate(); - } else { - # Install - $this->commitInstall(); - } - } - } catch (Exception\ExceptionInterface $e) { - $this->renderMessage($e->getMessage()); - } + # Installing message + $this->renderMessage(sprintf(self::$ACCESS_DENIED_MESSAGE, $_SERVER['REMOTE_ADDR'])); } } else { - # Load application and let it serve the request. - $appClass = get_class(Rails::application()); - $appClass::dispatchRequest(); + # Client allowed; serve forms/commit actions + try { + # To make things nice, check write permissions + # on some paths. + $this->checkWriteablePaths(); + + if ($this->request()->isGet()) { + # Serve forms + if ($this->dataDirExists()) { + # Update form + $this->renderUpdateForm(); + } else { + # Install form + $this->renderInstallForm(); + } + } else { + # Commit actions + if ($this->dataDirExists()) { + # Update + $this->commitUpdate(); + } else { + # Install + $this->commitInstall(); + } + } + } catch (Exception\ExceptionInterface $e) { + $this->renderMessage($e->getMessage()); + } } }