mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Update
This commit is contained in:
parent
cc0d505e16
commit
06888c5ffc
3 changed files with 3 additions and 2 deletions
|
@ -4,5 +4,5 @@ require_once __DIR__.'/../videos/configuration.php';
|
||||||
if (!isCommandLineInterface()) {
|
if (!isCommandLineInterface()) {
|
||||||
return die('Command Line only');
|
return die('Command Line only');
|
||||||
}
|
}
|
||||||
|
$global['printLogs'] = 1;
|
||||||
cleanupDownloadsDirectory();
|
cleanupDownloadsDirectory();
|
|
@ -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')
|
// 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)))) {
|
if (is_file($filePath) && (preg_match('/' . $resolution . '_\.mp4$/', $entry) || empty(filesize($filePath)))) {
|
||||||
// Attempt to delete the file
|
// Attempt to delete the file
|
||||||
|
|
||||||
if (unlink($filePath)) {
|
if (unlink($filePath)) {
|
||||||
_error_log("cleanupDownloadsDirectory: Deleted file: {$filePath}");
|
_error_log("cleanupDownloadsDirectory: Deleted file: {$filePath}");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -89,7 +89,7 @@ function _error_log($message, $type = 0, $doNotRepeat = false)
|
||||||
if (!is_string($message)) {
|
if (!is_string($message)) {
|
||||||
$message = json_encode($message);
|
$message = json_encode($message);
|
||||||
}
|
}
|
||||||
if (isSchedulerRun()) {
|
if (isSchedulerRun() || !empty($global['printLogs'])) {
|
||||||
echo $message . PHP_EOL;
|
echo $message . PHP_EOL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue