mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Refactor.
This commit is contained in:
parent
343eb5e2cc
commit
27a7925b98
316 changed files with 54291 additions and 53534 deletions
|
@ -1,78 +1,76 @@
|
|||
<?php
|
||||
|
||||
//streamer config
|
||||
require_once '../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/playlist.php';
|
||||
|
||||
if (!isCommandLineInterface()) {
|
||||
return die('Command Line only');
|
||||
}
|
||||
|
||||
$users_ids = array();
|
||||
$sql = "SELECT distinct(users_id) as users_id FROM playlists ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$rows = array();
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $key => $row) {
|
||||
$users_ids[] = $row['users_id'];
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
|
||||
|
||||
foreach ($users_ids as $user_id) {
|
||||
echo "Process user_id = {$user_id} favorite\n";
|
||||
ob_flush();
|
||||
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'favorite' ORDER BY created ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$rows = array();
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $key => $row) {
|
||||
if ($key === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!empty(PlayList::getVideosIDFromPlaylistLight($row['id']))){
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM playlists ";
|
||||
$sql .= " WHERE id = ?";
|
||||
|
||||
echo $sql." = {$row['id']}\n";
|
||||
ob_flush();
|
||||
sqlDAL::writeSql($sql, "i", array($row['id']));
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
|
||||
|
||||
echo "Process user_id = {$user_id} watch_later\n";
|
||||
ob_flush();
|
||||
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'watch_later' ORDER BY created ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$rows = array();
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $key => $row) {
|
||||
if ($key === 0) {
|
||||
continue;
|
||||
}
|
||||
$sql = "DELETE FROM playlists ";
|
||||
$sql .= " WHERE id = ?";
|
||||
echo $sql." = {$row['id']}\n";
|
||||
ob_flush();
|
||||
sqlDAL::writeSql($sql, "i", array($row['id']));
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
//streamer config
|
||||
require_once '../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/playlist.php';
|
||||
|
||||
if (!isCommandLineInterface()) {
|
||||
return die('Command Line only');
|
||||
}
|
||||
|
||||
$users_ids = [];
|
||||
$sql = "SELECT distinct(users_id) as users_id FROM playlists ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$rows = [];
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $key => $row) {
|
||||
$users_ids[] = $row['users_id'];
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
|
||||
|
||||
foreach ($users_ids as $user_id) {
|
||||
echo "Process user_id = {$user_id} favorite\n";
|
||||
ob_flush();
|
||||
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'favorite' ORDER BY created ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$rows = [];
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $key => $row) {
|
||||
if ($key === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty(PlayList::getVideosIDFromPlaylistLight($row['id']))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM playlists ";
|
||||
$sql .= " WHERE id = ?";
|
||||
|
||||
echo $sql." = {$row['id']}\n";
|
||||
ob_flush();
|
||||
sqlDAL::writeSql($sql, "i", [$row['id']]);
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
|
||||
|
||||
echo "Process user_id = {$user_id} watch_later\n";
|
||||
ob_flush();
|
||||
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'watch_later' ORDER BY created ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$rows = [];
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $key => $row) {
|
||||
if ($key === 0) {
|
||||
continue;
|
||||
}
|
||||
$sql = "DELETE FROM playlists ";
|
||||
$sql .= " WHERE id = ?";
|
||||
echo $sql." = {$row['id']}\n";
|
||||
ob_flush();
|
||||
sqlDAL::writeSql($sql, "i", [$row['id']]);
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue