mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 10:49:36 +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');
|
ini_set('memory_limit', '-1');
|
||||||
set_time_limit(0);
|
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
|
// Escape the input parameters to prevent command injection attacks
|
||||||
$filename = escapeshellarg($filename);
|
$filename = escapeshellarg($filename);
|
||||||
$destination = escapeshellarg($destination);
|
$destination = escapeshellarg($destination);
|
||||||
|
@ -192,7 +204,7 @@ function unzipDirectory($filename, $destination)
|
||||||
// Log the output and return value
|
// Log the output and return value
|
||||||
_error_log("unzipDirectory: Command failed with return value {$return_val}");
|
_error_log("unzipDirectory: Command failed with return value {$return_val}");
|
||||||
_error_log("unzipDirectory: Command output: " . implode("\n", $output));
|
_error_log("unzipDirectory: Command output: " . implode("\n", $output));
|
||||||
|
|
||||||
// Check if the file exists
|
// Check if the file exists
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
_error_log("unzipDirectory: Error - file does not exist: {$filename}");
|
_error_log("unzipDirectory: Error - file does not exist: {$filename}");
|
||||||
|
@ -224,9 +236,12 @@ function unzipDirectory($filename, $destination)
|
||||||
} else {
|
} else {
|
||||||
_error_log("unzipDirectory: Error deleting the zip file: {$filename}");
|
_error_log("unzipDirectory: Error deleting the zip file: {$filename}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $return_val === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getPIDUsingPort($port)
|
function getPIDUsingPort($port)
|
||||||
{
|
{
|
||||||
$port = intval($port);
|
$port = intval($port);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue