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

Commit

Permalink
Cleaned up variable names and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
snw35 committed Jul 20, 2016
1 parent 6df570b commit f9dd3d8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions core/src/plugins/action.compression/class.PluginCompression.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function receiveAction($action, $httpVars, $fileVars)
$currentDirPath = rtrim($currentDirPath, "/") . "/";
$currentDirUrl = $userSelection->currentBaseUrl().$currentDirPath;

# Multi-platform function taken from stackoverflow
# http://stackoverflow.com/questions/12424787/how-to-check-if-a-shell-command-exists-from-php
# Check that a command exists on the system for use with shell_exec
// Multi-platform function taken from stackoverflow
// http://stackoverflow.com/questions/12424787/how-to-check-if-a-shell-command-exists-from-php
// Check that a command exists on the system for use with shell_exec
function command_exists ($command) {
$whereIsCommand = (PHP_OS == 'WINNT') ? 'where' : 'which';
$process = proc_open(
Expand Down Expand Up @@ -161,27 +161,27 @@ function command_exists ($command) {
}
if ($archiveFormat == ".tar.gz") {
if (command_exists("pigz")) {
$tarcommand = "tar -I pigz -cf ";
$tarCommand = "tar -I pigz -cf ";
} else {
$tarcommand = "tar -czf ";
$tarCommand = "tar -czf ";
}
} elseif ($archiveFormat == ".tar.bz2") {
if (command_exists("lbzip2")) {
$tarcommand = "tar -I lbzip2 -cf ";
$tarCommand = "tar -I lbzip2 -cf ";
} elseif (command_exists("pbzip2")) {
$tarcommand = "tar -I pbzip2 -cf ";
$tarCommand = "tar -I pbzip2 -cf ";
} else {
$tarcommand = "tar -cjf ";
$tarCommand = "tar -cjf ";
}
} elseif ($archiveFormat == ".tar") {
$tarcommand = "tar -cf ";
$tarCommand = "tar -cf ";
} else {
file_put_contents($progressExtractFileName, "Error : " . $messages["compression.15"]);
throw new AJXP_Exception($messages["compression.15"]);
}
$changedircommand = "cd " . AJXP_MetaStreamWrapper::getRealFSReference($currentDirUrl) . " && ";
$finalcommand = $changedircommand . $tarcommand . escapeshellarg($archiveName) . " " . implode(" ", $FolderNames) . " " . implode(" ", $FileNames);
shell_exec($finalcommand);
$changeDirCommand = "cd " . AJXP_MetaStreamWrapper::getRealFSReference($currentDirUrl) . " && ";
$compressCommand = $changeDirCommand . $tarCommand . escapeshellarg($archiveName) . " " . implode(" ", $FolderNames) . " " . implode(" ", $FileNames);
shell_exec($compressCommand);
} else {
// If tar command is not found, compress with PHP Phar instead
try {
Expand Down Expand Up @@ -315,25 +315,25 @@ function command_exists ($command) {
if (command_exists("tar")) {
if ($pathInfoCurrentAllPydioPath == "gz") {
if (command_exists("pigz")) {
$tarcommand = "tar -I pigz -xf ";
$tarCommand = "tar -I pigz -xf ";
} else {
$tarcommand = "tar -xzf ";
$tarCommand = "tar -xzf ";
}
} elseif ($pathInfoCurrentAllPydioPath == "bz2") {
if (command_exists("lbzip2")) {
$tarcommand = "tar -I lbzip2 -xf ";
$tarCommand = "tar -I lbzip2 -xf ";
} elseif (command_exists("pbzip2")) {
$tarcommand = "tar -I pbzip2 -xf ";
$tarCommand = "tar -I pbzip2 -xf ";
} else {
$tarcommand = "tar -xjf ";
$tarCommand = "tar -xjf ";
}
} elseif ($pathInfoCurrentAllPydioPath == "tar") {
$tarcommand = "tar -xf ";
$tarCommand = "tar -xf ";
} else {
file_put_contents($progressExtractFileName, "Error : " . $messages["compression.15"]);
throw new AJXP_Exception($messages["compression.15"]);
}
$extractCommand = $tarcommand . escapeshellarg(AJXP_MetaStreamWrapper::getRealFSReference($currentDirUrl . $fileArchive)) . " -C " . escapeshellarg(AJXP_MetaStreamWrapper::getRealFSReference($currentDirUrl . $onlyFileName));
$extractCommand = $tarCommand . escapeshellarg(AJXP_MetaStreamWrapper::getRealFSReference($currentDirUrl . $fileArchive)) . " -C " . escapeshellarg(AJXP_MetaStreamWrapper::getRealFSReference($currentDirUrl . $onlyFileName));
shell_exec($extractCommand);
} else {
// If tar command is not found, extract using PHP Phar instead
Expand Down

0 comments on commit f9dd3d8

Please sign in to comment.