fix mail e converted video flag

This commit is contained in:
Francesco Picone
2025-12-09 17:15:54 +01:00
parent 59c9b1f5be
commit 91e4559bd2
6 changed files with 71 additions and 14 deletions

View File

@@ -104,6 +104,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
unlink($upload_path);
$file_name = pathinfo($file_name, PATHINFO_FILENAME) . '.mp4';
$upload_path = $converted_path;
$video_converted = true;
}
// Se la conversione fallisce, usa comunque il file originale
}
@@ -117,6 +118,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Imposta il nuovo percorso (senza slash iniziale)
$video_url = 'uploads/lessons/' . ($is_demo ? 'demo' : 'pay') . '/' . $file_name;
// Se è già MP4, considera già convertito
if ($file_extension === 'mp4') {
$video_converted = true;
}
// Estrai durata automaticamente se non specificata
if (empty($duration)) {
$duration = get_video_duration($upload_path);
@@ -152,6 +158,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
price = ?,
is_demo = ?,
is_active = ?,
video_converted = ?,
updated_at = NOW()
WHERE id = ?
");
@@ -171,6 +178,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$price,
$is_demo,
$is_active,
$video_converted ?? $lesson['video_converted'] ?? false,
$lesson_id
]);