4
// $res = exec('ps xa | grep "downloads_check.php" | grep -v grep | wc -l');
7
if (preg_match("/(.*)downloads_check.php$/", $_SERVER['SCRIPT_FILENAME'], $m)) @chdir($m[1]);
8
require("../adei.php");
10
$lock = new LOCK("downloads_check");
11
$lock->Lock(LOCK::BLOCK);
15
$ADEI->RequireClass("download");
17
$cache = new CACHEDB();
18
$dm = new DOWNLOADMANAGER();
19
$res = $cache->GetDownloads("","ASC");
21
while($row = mysql_fetch_array($res)) {
22
$status = $row['status'];
23
$name = $dm->Getfilename($download);
24
$file = $ADEI_ROOTDIR."tmp/downloads/".$name;
25
$fsize = filesize($file);
26
$lastmodified = time() - filemtime($file);
27
if($fsize > 1 && $lastmodified > 1) $this->ChangeStatus($row['dl_id'], 'Ready');
28
if($status == "Preparing" || $status == "Finalizing") {
31
if($nextdownload == "" && $status == "Queue"){
32
$nextdownload = $row['dl_id'];
37
if($nextdownload != "" && $busy != 1) {
39
$opts = $dm->CreateDataRequestOpts($nextdownload);
40
$dm->DataRequest($opts);
41
} catch(ADEIException $ex) {
42
//$dm->Logit($ex->getMessage());
43
$dm->ChangeStatus($nextdownload, "ERROR");
44
$dm->SetError($nextdownload, $ex->getMessage());
b'\\ No newline at end of file'