forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort the channels by channels view on the last 30 days
- Loading branch information
daniel
authored and
daniel
committed
Jun 6, 2020
1 parent
b9455a6
commit 8da9ba4
Showing
12 changed files
with
165 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
//streamer config | ||
require_once '../videos/configuration.php'; | ||
require_once $global['systemRootPath'] . 'objects/playlist.php'; | ||
|
||
if (!isCommandLineInterface()) { | ||
return die('Command Line only'); | ||
} | ||
|
||
echo "Start fixing statistics" . PHP_EOL; | ||
|
||
$session_id = array(); | ||
$sql = "SELECT distinct(session_id) as session_id FROM videos_statistics "; | ||
$res = sqlDAL::readSql($sql); | ||
$fullData = sqlDAL::fetchAllAssoc($res); | ||
sqlDAL::close($res); | ||
$rows = array(); | ||
if ($res != false) { | ||
foreach ($fullData as $key => $row) { | ||
$session_id[] = $row['session_id']; | ||
} | ||
} else { | ||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); | ||
} | ||
|
||
|
||
foreach ($session_id as $id) { | ||
echo "Process session_id = {$id}\n"; | ||
ob_flush(); | ||
$sql = "SELECT distinct(videos_id) as videos_id FROM videos_statistics WHERE session_id = '{$id}'"; | ||
echo $sql . PHP_EOL; | ||
$res = sqlDAL::readSql($sql); | ||
$fullData = sqlDAL::fetchAllAssoc($res); | ||
sqlDAL::close($res); | ||
$rows = array(); | ||
if ($res != false) { | ||
foreach ($fullData as $row) { | ||
$sql2 = "SELECT id FROM videos_statistics WHERE videos_id = {$row['videos_id']} AND session_id = '{$id}' ORDER BY `when` DESC LIMIT 1"; | ||
echo $sql . PHP_EOL; | ||
$res2 = sqlDAL::readSql($sql2); | ||
$fullData2 = sqlDAL::fetchAllAssoc($res2); | ||
sqlDAL::close($res2); | ||
if ($res != false) { | ||
foreach ($fullData2 as $key2 => $row2) { | ||
$sql = "DELETE FROM videos_statistics "; | ||
$sql .= " WHERE videos_id = {$row['videos_id']} AND session_id = '{$id}' AND id != {$row2['id']} "; | ||
|
||
echo $sql . PHP_EOL; | ||
ob_flush(); | ||
sqlDAL::writeSql($sql); | ||
} | ||
} else { | ||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); | ||
} | ||
} | ||
} else { | ||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); | ||
} | ||
} | ||
|
||
echo "Finish fixing statistics" . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters