forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getAllVideosAsync.php
25 lines (25 loc) · 1.27 KB
/
getAllVideosAsync.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
<?php
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getAllVideosAsync($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
_session_write_close();
$status = $argv[1];
$showOnlyLoggedUserVideos = $argv[2];
$ignoreGroup = $argv[3];
$videosArrayId = $argv[4];
$getStatistcs = $argv[5];
$showUnlisted = $argv[6];
$activeUsersOnly = $argv[7];
$_GET = object_to_array(_json_decode($argv[8]));
$_POST = object_to_array(_json_decode($argv[9]));
$cacheFileName = $argv[10];
$lockFile = $cacheFileName.".lock";
if (file_exists($lockFile) && (time() - filemtime($lockFile) < 300)) { // 5 min limit
_error_log("getAllVideos: file locked ".$lockFile." filemtime(\$lockFile) = ".filemtime($lockFile)."| (time() - filemtime(\$lockFile))=".(time() - filemtime($lockFile)));
return false;
}
file_put_contents($lockFile, 1);
$total = Video::getAllVideos($status, $showOnlyLoggedUserVideos, $ignoreGroup, $videosArrayId, $getStatistcs, $showUnlisted, $activeUsersOnly);
file_put_contents($cacheFileName, json_encode($total));
//_error_log(__FILE__." ".$cacheFileName.": done");
unlink($lockFile);