fix to installer

This commit is contained in:
Parziphal 2013-10-27 11:50:54 -05:00
parent 738cf7d4c4
commit df114fc180

View File

@ -17,50 +17,44 @@ class Installer extends Base
{ {
$this->loadConfig(); $this->loadConfig();
if ($this->request()->path() == '/') { if (!$this->validateSafeIps()) {
if (!$this->validateSafeIps()) { # Client not allowed
# Client not allowed if ($this->dataDirExists()) {
if ($this->dataDirExists()) { # Updating message
# Updating message $this->renderMessage(self::$PLEASE_WAIT_MESSAGE);
$this->renderMessage(self::$PLEASE_WAIT_MESSAGE);
} else {
# Installing message
$this->renderMessage(sprintf(self::$ACCESS_DENIED_MESSAGE, $_SERVER['REMOTE_ADDR']));
}
} else { } else {
# Client allowed; serve forms/commit actions # Installing message
try { $this->renderMessage(sprintf(self::$ACCESS_DENIED_MESSAGE, $_SERVER['REMOTE_ADDR']));
# 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 { } else {
# Load application and let it serve the request. # Client allowed; serve forms/commit actions
$appClass = get_class(Rails::application()); try {
$appClass::dispatchRequest(); # 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());
}
} }
} }