Skip to content

Commit

Permalink
fix: installer
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyves committed Oct 16, 2018
1 parent 3c02da7 commit 6368609
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ private function _checkDependenciesModule($package, $package_type = "module")

# Then check the module deps itself
$_module = new Installer_Model_Installer_Module();
$_module->prepare($name);

dbg('--module--');
dbg($_module);
$_module->prepare($package->getName());

switch ($package_type) {
case 'layout':
Expand All @@ -193,7 +190,7 @@ private function _checkDependenciesModule($package, $package_type = "module")
break;
}

if ($_module->isInstalled() && version_compare($version, $_module->getVersion(), "<=")) {
if ($_module->isInstalled() && version_compare($package->getVersion(), $_module->getVersion(), "<=")) {
throw new Exception(__("#19-016: You already have installed this %s or a newer version.", $package_type));
} else {
# Set the module as in Local, which could be uninstalled.
Expand All @@ -218,7 +215,7 @@ private function _checkDependenciesFallback($package)
case "system":

if (strtolower($dependency["type"]) != strtolower(Siberian_Version::TYPE)) {
throw new Exception($this->_("#19-003: This update is designed for the %s, you can't install it in your %s.", $package->getName(), Siberian_Version::NAME));
throw new Exception(__("#19-003: This update is designed for the %s, you can't install it in your %s.", $package->getName(), Siberian_Version::NAME));
}

# Remove all beta-parts from beta if in stable for requirements
Expand Down Expand Up @@ -277,14 +274,14 @@ public function getPackageDetails()
$this->_package_details = new Core_Model_Default();
$package_file = "{$this->_tmp_directory}/package.json";
if (!file_exists($package_file)) {
throw new Exception($this->_("#19-010: The package you have uploaded is invalid."));
throw new Exception(__("#19-010: The package you have uploaded is invalid."));
}

try {
$content = Zend_Json::decode(file_get_contents($package_file));
} catch (Zend_Json_Exception $e) {
Zend_Registry::get("logger")->sendException(print_r($e, true), "siberian_update_", false);
throw new Exception($this->_("#19-011: The package you have uploaded is invalid."));
throw new Exception(__("#19-011: The package you have uploaded is invalid."));
}

$this->_package_details->setData($content);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function uploadAction() {
}

if (empty($_FILES) || empty($_FILES['file']['name'])) {
throw new Siberian_Exception(__("No file has been sent"));
throw new \Siberian\Exception(__("No file has been sent"));
}

$adapter = new Zend_File_Transfer_Adapter_Http();
Expand All @@ -214,7 +214,7 @@ public function uploadAction() {
$message = __("An error occurred during the process. Please try again later.");
}

throw new Siberian_Exception($message);
throw new \Siberian\Exception($message);
}
} catch (Exception $e) {
$payload = [
Expand All @@ -236,7 +236,7 @@ public function checkpermissionsAction() {
$file = Core_Model_Directory::getTmpDirectory(true)."/$filename";

if (!file_exists($file)) {
throw new Siberian_Exception(__("The file %s does not exist", $filename));
throw new \Siberian\Exception(__("The file %s does not exist", $filename));
}

$parser = new Installer_Model_Installer_Module_Parser();
Expand All @@ -250,7 +250,7 @@ public function checkpermissionsAction() {
$ftp_path = System_Model_Config::getValueFor("ftp_path");
$ftp = new Siberian_Ftp($ftp_host, $ftp_user, $ftp_password, $ftp_port, $ftp_path);

if ($ftp->checkConnection() AND $ftp->isSiberianDirectory()) {
if ($ftp->checkConnection() && $ftp->isSiberianDirectory()) {
$is_ok = true;
}
}
Expand All @@ -263,7 +263,7 @@ public function checkpermissionsAction() {

$messages = $parser->getErrors();
$message = implode("\n", $messages);
throw new Siberian_Exception(__($message));
throw new \Siberian\Exception(__($message));
}

} catch (Exception $e) {
Expand Down Expand Up @@ -300,10 +300,10 @@ public function saveftpAction() {
$ftp = new Siberian_Ftp($ftp_host, $ftp_user, $ftp_password, $ftp_port, $ftp_path);
if(!$ftp->checkConnection()) {
$error_code = 1;
throw new Siberian_Exception(__("Unable to connect to your FTP. Please check the connection information."));
throw new \Siberian\Exception(__("Unable to connect to your FTP. Please check the connection information."));
} else if(!$ftp->isSiberianDirectory()) {
$error_code = 2;
throw new Siberian_Exception(__("Unable to detect your site. Please make sure the entered path is correct."));
throw new \Siberian\Exception(__("Unable to detect your site. Please make sure the entered path is correct."));
}

$fields = array(
Expand Down Expand Up @@ -343,7 +343,7 @@ public function saveftpAction() {
);
}

$this->_sendHtml($data);
$this->_sendJson($data);
}
}

Expand Down Expand Up @@ -380,7 +380,7 @@ public function copyAction() {
);
}

$this->_sendHtml($data);
$this->_sendJson($data);
}

}
Expand Down

0 comments on commit 6368609

Please sign in to comment.