mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
Update
This commit is contained in:
parent
95a37557c4
commit
1ccf684fbf
1 changed files with 16 additions and 1 deletions
|
@ -175,6 +175,18 @@ function unzipDirectory($filename, $destination)
|
|||
ini_set('memory_limit', '-1');
|
||||
set_time_limit(0);
|
||||
|
||||
// Ensure the destination directory exists
|
||||
if (!is_dir($destination)) {
|
||||
_error_log("unzipDirectory: Destination directory does not exist: {$destination}");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ensure the destination directory is writable
|
||||
if (!is_writable($destination)) {
|
||||
_error_log("unzipDirectory: Destination directory is not writable: {$destination}");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Escape the input parameters to prevent command injection attacks
|
||||
$filename = escapeshellarg($filename);
|
||||
$destination = escapeshellarg($destination);
|
||||
|
@ -192,7 +204,7 @@ function unzipDirectory($filename, $destination)
|
|||
// Log the output and return value
|
||||
_error_log("unzipDirectory: Command failed with return value {$return_val}");
|
||||
_error_log("unzipDirectory: Command output: " . implode("\n", $output));
|
||||
|
||||
|
||||
// Check if the file exists
|
||||
if (!file_exists($filename)) {
|
||||
_error_log("unzipDirectory: Error - file does not exist: {$filename}");
|
||||
|
@ -224,9 +236,12 @@ function unzipDirectory($filename, $destination)
|
|||
} else {
|
||||
_error_log("unzipDirectory: Error deleting the zip file: {$filename}");
|
||||
}
|
||||
|
||||
return $return_val === 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getPIDUsingPort($port)
|
||||
{
|
||||
$port = intval($port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue