mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
parent
8f2c7cc93f
commit
54317fcfff
1 changed files with 35 additions and 1 deletions
|
@ -8,7 +8,6 @@ if (!isCommandLineInterface()) {
|
||||||
return die('Command Line only');
|
return die('Command Line only');
|
||||||
}
|
}
|
||||||
|
|
||||||
$users_ids = [];
|
|
||||||
$sql = " select count(*) as total, users_id from playlists where status = 'favorite' group by users_id";
|
$sql = " select count(*) as total, users_id from playlists where status = 'favorite' group by users_id";
|
||||||
$res = sqlDAL::readSql($sql);
|
$res = sqlDAL::readSql($sql);
|
||||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||||
|
@ -42,3 +41,38 @@ if ($res != false) {
|
||||||
} else {
|
} else {
|
||||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql = " select count(*) as total, users_id from playlists where status = 'watch_later' group by users_id";
|
||||||
|
$res = sqlDAL::readSql($sql);
|
||||||
|
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||||
|
sqlDAL::close($res);
|
||||||
|
$rows = [];
|
||||||
|
if ($res != false) {
|
||||||
|
foreach ($fullData as $key => $row) {
|
||||||
|
if ($row['total'] > 1) {
|
||||||
|
echo "Process user_id = {$row['users_id']} total={$row['total']} watch_later\n";
|
||||||
|
ob_flush();
|
||||||
|
$sql2 = "SELECT * FROM playlists WHERE users_id = {$row['users_id']} AND status = 'watch_later' ORDER BY modified ";
|
||||||
|
$res2 = sqlDAL::readSql($sql2);
|
||||||
|
$fullData2 = sqlDAL::fetchAllAssoc($res2);
|
||||||
|
sqlDAL::close($res2);
|
||||||
|
$rows2 = [];
|
||||||
|
if ($res2 != false) {
|
||||||
|
$totalRows = count($fullData2);
|
||||||
|
foreach ($fullData2 as $key2 => $row2) {
|
||||||
|
if ($key2 !== $totalRows-1) {
|
||||||
|
$sql3 = "DELETE FROM playlists ";
|
||||||
|
echo $sql3. " = {$row2['id']}; users_id = {{$row2['users_id']}}".PHP_EOL;
|
||||||
|
$sql3 .= " WHERE id = ?";
|
||||||
|
sqlDAL::writeSql($sql3, "i", [$row2['id']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue