1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
Daniel Neto 2024-09-20 10:57:34 -03:00
parent cc0d505e16
commit 06888c5ffc
3 changed files with 3 additions and 2 deletions

View file

@ -4,5 +4,5 @@ require_once __DIR__.'/../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$global['printLogs'] = 1;
cleanupDownloadsDirectory();

View file

@ -118,6 +118,7 @@ function cleanupDownloadsDirectory($resolution = 720)
// Check if it's a file and does not match the resolution pattern (e.g., '480_.mp4')
if (is_file($filePath) && (preg_match('/' . $resolution . '_\.mp4$/', $entry) || empty(filesize($filePath)))) {
// Attempt to delete the file
if (unlink($filePath)) {
_error_log("cleanupDownloadsDirectory: Deleted file: {$filePath}");
} else {

View file

@ -89,7 +89,7 @@ function _error_log($message, $type = 0, $doNotRepeat = false)
if (!is_string($message)) {
$message = json_encode($message);
}
if (isSchedulerRun()) {
if (isSchedulerRun() || !empty($global['printLogs'])) {
echo $message . PHP_EOL;
return false;
}