forked from keven1024/chevereto-free-multi-language
-
Notifications
You must be signed in to change notification settings - Fork 0
/
importing.php
50 lines (44 loc) · 1.28 KB
/
importing.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/* --------------------------------------------------------------------
This file is part of Chevereto Free.
https://chevereto.com/free
(c) Rodolfo Berrios <rodolfo@chevereto.com>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
--------------------------------------------------------------------- */
define('access', 'cli');
$isCron = getenv('IS_CRON');
if (!$isCron) {
header('HTTP/1.0 403 Forbidden');
die("403 Forbidden\n");
}
$threadID = getenv('THREAD_ID');
if (!$threadID) {
die("Missing thread id (int)\n");
}
if (!include_once('app/loader.php')) {
die("Can't find app/loader.php\n");
}
$loop = 1;
do {
try {
CHV\Import::refresh();
$jobs = CHV\Import::autoJobs();
if (!$jobs) {
echo "No jobs left.\n";
die(0);
}
$id = $jobs[0]['import_id'];
$import = new CHV\Import();
$import->id = $id;
$import->thread = (int) $threadID;
$import->process();
echo "Processed job id #$id\n";
$loop++;
} catch (Exception $e) {
echo $e->getMessage() . "\n";
die(255);
}
} while (CHV\isSafeToExecute());
echo "--\nLooped $loop times ~ /dashboard/bulk for stats \n";
die(0);