@@ -45,9 +45,9 @@ public function receiveAction($action, $httpVars, $fileVars)
45
45
$ currentDirPath = rtrim ($ currentDirPath , "/ " ) . "/ " ;
46
46
$ currentDirUrl = $ userSelection ->currentBaseUrl ().$ currentDirPath ;
47
47
48
- # Multi-platform function taken from stackoverflow
49
- # http://stackoverflow.com/questions/12424787/how-to-check-if-a-shell-command-exists-from-php
50
- # Check that a command exists on the system for use with shell_exec
48
+ // Multi-platform function taken from stackoverflow
49
+ // http://stackoverflow.com/questions/12424787/how-to-check-if-a-shell-command-exists-from-php
50
+ // Check that a command exists on the system for use with shell_exec
51
51
function command_exists ($ command ) {
52
52
$ whereIsCommand = (PHP_OS == 'WINNT ' ) ? 'where ' : 'which ' ;
53
53
$ process = proc_open (
@@ -161,27 +161,27 @@ function command_exists ($command) {
161
161
}
162
162
if ($ archiveFormat == ".tar.gz " ) {
163
163
if (command_exists ("pigz " )) {
164
- $ tarcommand = "tar -I pigz -cf " ;
164
+ $ tarCommand = "tar -I pigz -cf " ;
165
165
} else {
166
- $ tarcommand = "tar -czf " ;
166
+ $ tarCommand = "tar -czf " ;
167
167
}
168
168
} elseif ($ archiveFormat == ".tar.bz2 " ) {
169
169
if (command_exists ("lbzip2 " )) {
170
- $ tarcommand = "tar -I lbzip2 -cf " ;
170
+ $ tarCommand = "tar -I lbzip2 -cf " ;
171
171
} elseif (command_exists ("pbzip2 " )) {
172
- $ tarcommand = "tar -I pbzip2 -cf " ;
172
+ $ tarCommand = "tar -I pbzip2 -cf " ;
173
173
} else {
174
- $ tarcommand = "tar -cjf " ;
174
+ $ tarCommand = "tar -cjf " ;
175
175
}
176
176
} elseif ($ archiveFormat == ".tar " ) {
177
- $ tarcommand = "tar -cf " ;
177
+ $ tarCommand = "tar -cf " ;
178
178
} else {
179
179
file_put_contents ($ progressExtractFileName , "Error : " . $ messages ["compression.15 " ]);
180
180
throw new AJXP_Exception ($ messages ["compression.15 " ]);
181
181
}
182
- $ changedircommand = "cd " . AJXP_MetaStreamWrapper::getRealFSReference ($ currentDirUrl ) . " && " ;
183
- $ finalcommand = $ changedircommand . $ tarcommand . escapeshellarg ($ archiveName ) . " " . implode (" " , $ FolderNames ) . " " . implode (" " , $ FileNames );
184
- shell_exec ($ finalcommand );
182
+ $ changeDirCommand = "cd " . AJXP_MetaStreamWrapper::getRealFSReference ($ currentDirUrl ) . " && " ;
183
+ $ compressCommand = $ changeDirCommand . $ tarCommand . escapeshellarg ($ archiveName ) . " " . implode (" " , $ FolderNames ) . " " . implode (" " , $ FileNames );
184
+ shell_exec ($ compressCommand );
185
185
} else {
186
186
// If tar command is not found, compress with PHP Phar instead
187
187
try {
@@ -315,25 +315,25 @@ function command_exists ($command) {
315
315
if (command_exists ("tar " )) {
316
316
if ($ pathInfoCurrentAllPydioPath == "gz " ) {
317
317
if (command_exists ("pigz " )) {
318
- $ tarcommand = "tar -I pigz -xf " ;
318
+ $ tarCommand = "tar -I pigz -xf " ;
319
319
} else {
320
- $ tarcommand = "tar -xzf " ;
320
+ $ tarCommand = "tar -xzf " ;
321
321
}
322
322
} elseif ($ pathInfoCurrentAllPydioPath == "bz2 " ) {
323
323
if (command_exists ("lbzip2 " )) {
324
- $ tarcommand = "tar -I lbzip2 -xf " ;
324
+ $ tarCommand = "tar -I lbzip2 -xf " ;
325
325
} elseif (command_exists ("pbzip2 " )) {
326
- $ tarcommand = "tar -I pbzip2 -xf " ;
326
+ $ tarCommand = "tar -I pbzip2 -xf " ;
327
327
} else {
328
- $ tarcommand = "tar -xjf " ;
328
+ $ tarCommand = "tar -xjf " ;
329
329
}
330
330
} elseif ($ pathInfoCurrentAllPydioPath == "tar " ) {
331
- $ tarcommand = "tar -xf " ;
331
+ $ tarCommand = "tar -xf " ;
332
332
} else {
333
333
file_put_contents ($ progressExtractFileName , "Error : " . $ messages ["compression.15 " ]);
334
334
throw new AJXP_Exception ($ messages ["compression.15 " ]);
335
335
}
336
- $ extractCommand = $ tarcommand . escapeshellarg (AJXP_MetaStreamWrapper::getRealFSReference ($ currentDirUrl . $ fileArchive )) . " -C " . escapeshellarg (AJXP_MetaStreamWrapper::getRealFSReference ($ currentDirUrl . $ onlyFileName ));
336
+ $ extractCommand = $ tarCommand . escapeshellarg (AJXP_MetaStreamWrapper::getRealFSReference ($ currentDirUrl . $ fileArchive )) . " -C " . escapeshellarg (AJXP_MetaStreamWrapper::getRealFSReference ($ currentDirUrl . $ onlyFileName ));
337
337
shell_exec ($ extractCommand );
338
338
} else {
339
339
// If tar command is not found, extract using PHP Phar instead
0 commit comments