Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Add a check if he user try to compress an empty folder to avoid some …
Browse files Browse the repository at this point in the history
…problems...
  • Loading branch information
isma91 committed Oct 16, 2015
1 parent 7d82c50 commit d13c601
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -73,8 +73,8 @@ public function receiveAction($action, $httpVars, $fileVars)
throw new AJXP_Exception($messages["compression.16"]);
}
$typeArchive = $httpVars["type_archive"];
//if we can run in background we do it ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()
if (1 == 2) {
//if we can run in background we do it
if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
$archivePath = $currentDirPath.$archiveName;
file_put_contents($progressCompressionFileName, $messages["compression.5"]);
AJXP_Controller::applyActionInBackground($repository->getId(), "compression", $httpVars);
Expand Down Expand Up @@ -113,6 +113,10 @@ public function receiveAction($action, $httpVars, $fileVars)
array_push($tabFilesNames, substr($file->getPathname(), $currentDirUrlLength));
}
}
//WE STOP IF IT'S JUST AN EMPTY FOLDER OR NO FILES
if (empty($tabFilesNames)) {
throw new AJXP_Exception($messages["compression.17"]);
}
try {
$tmpArchiveName = tempnam(AJXP_Utils::getAjxpTmpDir(), "tar-compression") . ".tar";
$archive = new PharData($tmpArchiveName);
Expand Down

0 comments on commit d13c601

Please sign in to comment.