Skip to content

Commit

Permalink
Merge pull request #6585 from Dillon-Brown/zip_error_hotfix
Browse files Browse the repository at this point in the history
remove php_zip_utils error
  • Loading branch information
samus-aran committed Dec 7, 2018
2 parents 4419694 + dd058f9 commit 350d025
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/database/DBManagerFactory.php
Expand Up @@ -50,7 +50,7 @@
* Contributor(s): ______________________________________..
********************************************************************************/

require_once('include/database/DBManager.php');
require_once dirname(__DIR__) . '/../include/database/DBManager.php';

/**
* Database driver factory
Expand Down
13 changes: 4 additions & 9 deletions include/utils/php_zip_utils.php
Expand Up @@ -52,23 +52,21 @@ function unzip($zip_archive, $zip_dir)
function unzip_file($zip_archive, $archive_file, $zip_dir)
{
if (!is_dir($zip_dir)) {
$GLOBALS['log']->fatal("Specified directory for zip file extraction does not exist.");
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
$GLOBALS['log']->fatal("Specified directory '$zip_dir' for zip file '$zip_archive' extraction does not exist.");
return false;
}
die("Specified directory '$zip_dir' for zip file '$zip_archive' extraction does not exist.");
}

$zip = new ZipArchive;

$res = $zip->open(UploadFile::realpath($zip_archive)); // we need realpath here for PHP streams support

if ($res !== true) {
$GLOBALS['log']->fatal(sprintf(sprintf("ZIP Error(%d): Status(%s)", $res, $zip->status)));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
$GLOBALS['log']->fatal(sprintf("ZIP Error(%d): Status(%s): Arhive(%s): Directory(%s)", $res, $zip->status, $zip_archive, $zip_dir));
return false;
}
die(sprintf("ZIP Error(%d): Status(%s): Arhive(%s): Directory(%s)", $res, $zip->status, $zip_archive, $zip_dir));
}

if ($archive_file !== null) {
Expand All @@ -78,21 +76,18 @@ function unzip_file($zip_archive, $archive_file, $zip_dir)
}

if ($res !== true) {
$GLOBALS['log']->fatal(sprintf(sprintf("ZIP Error(%d): Status(%s)", $res, $zip->status)));
if (defined('SUITE_PHPUNIT_RUNNER') || defined('SUGARCRM_INSTALL')) {
$GLOBALS['log']->fatal(sprintf("ZIP Error(%d): Status(%s): Arhive(%s): Directory(%s)", $res, $zip->status, $zip_archive, $zip_dir));
return false;
}
die(sprintf("ZIP Error(%d): Status(%s): Arhive(%s): Directory(%s)", $res, $zip->status, $zip_archive, $zip_dir));
}
return true;
}

function zip_dir($zip_dir, $zip_archive)
{
if (!is_dir($zip_dir)) {
if (!defined('SUITE_PHPUNIT_RUNNER')) {
die("Specified directory '$zip_dir' for zip file '$zip_archive' extraction does not exist.");
}
$GLOBALS['log']->fatal("Specified directory for zip file extraction does not exist.");
return false;
}
$zip = new ZipArchive();
Expand Down

0 comments on commit 350d025

Please sign in to comment.