-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworker.php
46 lines (32 loc) · 974 Bytes
/
worker.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
<?php
// this script is supposed to be run as root
// testing checkout under gnatko
$emps_start_time = microtime(true);
set_time_limit(0);
ini_set('display_errors', false);
ini_set('memory_limit', -1);
error_reporting(E_ERROR);
$emps_worker_mode = true;
require_once "htdocs/local/local.php"; // local settings for configuration
require_once "EMPS/4.5/emps_worker_bootstrap.php"; // The bootstrap script for worker daemons
require_once $emps->page_file_name('_factory,factory.class', 'controller');
require_once $emps->page_file_name('_factory,factory_worker.class', 'controller');
$ef = new EMPS_Factory;
$efw = new EMPS_FactoryWorker;
$off_time = time() + 2*60*60;
$ef->load_defaults();
$emps->select_website();
unlink(EMPS_SCRIPT_PATH."/restart");
while(true){
$efw->cycle();
if(time() > $off_time){
break;
}
if($GLOBALS['die_now']){
break;
}
if (file_exists(EMPS_SCRIPT_PATH."/restart")) {
break;
}
sleep(round(rand(1, 5)));
}