1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
Daniel Neto 2024-12-03 14:28:01 -03:00
parent c30c4b3963
commit d15a0ec71d

View file

@ -181,16 +181,6 @@
killProcessFromKeyword($keyword); killProcessFromKeyword($keyword);
} }
// Validate that ffmpegCommand is not empty after sanitization
if (empty($ffmpegCommand)) {
echo json_encode([
'error' => true,
'msg' => 'Invalid or empty ffmpeg command',
'codeToExec' => $codeToExec,
]);
exit;
}
// Get the system's temporary directory // Get the system's temporary directory
$tempDir = "{$global['systemRootPath']}videos/ffmpegLogs/"; $tempDir = "{$global['systemRootPath']}videos/ffmpegLogs/";
make_path($tempDir); make_path($tempDir);
@ -201,6 +191,33 @@ $tempDir = rtrim($tempDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
// Create a unique log file path // Create a unique log file path
$logFile = "{$tempDir}ffmpeg_{$keyword}.log"; $logFile = "{$tempDir}ffmpeg_{$keyword}.log";
$time = time();
$modified = @filemtime($logFile);
$secondsAgo = $time - $obj->modified;
$isActive = $secondsAgo < 10;
if (!empty($codeToExec->log)) {
echo json_encode([
'error' => file_exists($logFile),
'msg' => '',
'content' => @file_get_contents($logFile),
'time' =>$time,
'modified' =>$modified,
'secondsAgo' =>$secondsAgo,
'isActive' =>$isActive,
]);
exit;
}else
// Validate that ffmpegCommand is not empty after sanitization
if (empty($ffmpegCommand)) {
echo json_encode([
'error' => true,
'msg' => 'Invalid or empty ffmpeg command',
'codeToExec' => $codeToExec,
]);
exit;
}
// Redirect all output to the log file // Redirect all output to the log file
$ffmpegCommand .= " > {$logFile} 2>&1"; $ffmpegCommand .= " > {$logFile} 2>&1";