PeerTube non configuré.

'; exit; } $thesisId = isset($_GET['thesis_id']) ? (int)$_GET['thesis_id'] : 0; // ── Collect already-linked UUIDs for the current thesis (to exclude them) ─ $pdo = $db->getConnection(); $stmt = $pdo->prepare( "SELECT file_path FROM thesis_files WHERE thesis_id = ? AND file_path LIKE 'peertube_ids:%'" ); $stmt->execute([$thesisId]); $linkedToThis = []; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $linkedToThis[] = substr($row['file_path'], strlen('peertube_ids:')); } // ── Collect all DB-linked UUIDs (any thesis that isn't soft-deleted) ───── $stmt = $pdo->query( "SELECT tf.file_path, t.identifier FROM thesis_files tf JOIN theses t ON t.id = tf.thesis_id WHERE tf.file_path LIKE 'peertube_ids:%' AND t.deleted_at IS NULL" ); $dbLinked = []; // uuid → identifier while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $uuid = substr($row['file_path'], strlen('peertube_ids:')); $dbLinked[$uuid] = $row['identifier']; } // ── List channel videos ───────────────────────────────────────────────── try { $channelVideos = PeerTubeService::listChannelVideos($db); } catch (\Throwable $e) { echo '

Erreur : ' . htmlspecialchars($e->getMessage()) . '

'; exit; } // ── Build orphan list ──────────────────────────────────────────────────── $orphans = []; foreach ($channelVideos as $v) { $uuid = $v['shortUUID'] ?: $v['uuid']; if ($uuid === '') { continue; } // Skip if already linked to THIS thesis if (in_array($uuid, $linkedToThis, true)) { continue; } // Mark as linked-to-other if already in DB (different thesis) $linkedTo = $dbLinked[$uuid] ?? null; $orphans[] = [ 'uuid' => $uuid, 'name' => $v['name'], 'createdAt' => $v['createdAt'], 'linkedTo' => $linkedTo, ]; } if (empty($orphans)) { echo '

Aucune vidéo orpheline trouvée. Toutes les vidéos de la chaîne sont déjà liées.

'; exit; } ?>

vidéo(s) orpheline(s) sur la chaîne. Cliquez pour relier à ce TFE.