Update manager. Issues fixed

Open:
 TGZ files extraction failed with PHP <5.5.0, added a switch to use system
 call to extract the file if PHP <5.5.0 (Linux)
 If in a Windows Server with PHP <5.5.0, the installation will fail.
 Removed double call to update_manager_starting_update

(cherry picked from commit 9e264c156c)
This commit is contained in:
fbsanchez 2016-10-26 16:34:51 +02:00
parent 287c2a7477
commit 5391c90922
2 changed files with 531 additions and 509 deletions

File diff suppressed because it is too large Load Diff

View File

@ -610,14 +610,38 @@ function update_manager_starting_update() {
$full_path = $config['attachment_store'] . "/downloads/pandora_console";
$phar = new PharData($path_package);
ob_start();
try {
$result = $phar->extractTo($config['attachment_store'] . "/downloads/");
if (!defined('PHP_VERSION_ID')) {
$version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
catch (Exception $e) {
echo ' There\'s a problem ... -> ' . $e->getMessage();
$extracted = false;
// Phar and exception working fine in 5.5.0 or higher
if (PHP_VERSION_ID >= 50505) {
$phar = new PharData($path_package);
try {
$result = $phar->extractTo($config['attachment_store'] . "/downloads/",null, true);
$extracted = true;
}
catch (Exception $e) {
echo ' There\'s a problem ... -> ' . $e->getMessage();
$extracted = false;
}
}
if($extracted === false) {
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
// unsupported OS
echo "This OS [" . PHP_OS . "] does not support direct extraction of tgz files. Upgrade PHP version to be > 5.5.0";
}
else {
system('tar xzf "' . $path_package . '" -C ' . $config['attachment_store'] . "/downloads/");
}
}
ob_end_clean();
rrmdir($path_package);