-
Notifications
You must be signed in to change notification settings - Fork 977
/
deleteCC.php
34 lines (33 loc) · 1.05 KB
/
deleteCC.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
$checkIfIsCorrupted = intval(@$argv[1]);
echo "checkIfIsCorrupted = $checkIfIsCorrupted".PHP_EOL;
$users_ids = [];
$sql = "SELECT * FROM videos ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
$total = count($fullData);
sqlDAL::close($res);
$rows = [];
if ($res != false) {
$count = 0;
foreach ($fullData as $key => $row) {
$count++;
$filename = $row['filename'];
$vtt = "{$global['systemRootPath']}videos/$filename/$filename.vtt";
if (file_exists($vtt)) {
unlink($vtt);
echo "{$total}/{$count} deleted from {$row['title']}".PHP_EOL;
} else {
echo "{$total}/{$count} NOT deleted from {$row['title']} [$vtt]".PHP_EOL;
}
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}