From 23e213d22657d10dae09ea9842b1c2f9a5974238 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Sun, 27 Oct 2013 15:19:10 -0500 Subject: [PATCH] more fixes --- install/ApplicationInstaller/Installer.php | 77 ++++++++++++---------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/install/ApplicationInstaller/Installer.php b/install/ApplicationInstaller/Installer.php index e2bb9eb..be32815 100755 --- a/install/ApplicationInstaller/Installer.php +++ b/install/ApplicationInstaller/Installer.php @@ -17,51 +17,56 @@ class Installer extends Base { $this->loadConfig(); - if (!$this->validateSafeIps()) { - # Client not allowed - if ($this->dataDirExists()) { - # Updating message - $this->renderMessage(self::$PLEASE_WAIT_MESSAGE); + 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'])); + } } else { - # Installing message - $this->renderMessage(sprintf(self::$ACCESS_DENIED_MESSAGE, $_SERVER['REMOTE_ADDR'])); + # 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()); + } } } 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()); - } + # Load application and let it serve the request. + $appClass = get_class(Rails::application()); + $appClass::dispatchRequest(); } } protected function checkWriteablePaths() { $paths = [ - '/install', '/log', '/tmp', '/public'