forked from Xtraball/Siberian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron.php
65 lines (55 loc) · 1.52 KB
/
cron.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* SiberianCMS
*
* @version 4.1.0
* @author Xtraball SAS <dev@xtraball.com>
*
* @note preparation for the incoming cron scheduler.
*
*/
if(version_compare(PHP_VERSION, '5.3.0') < 0) {
die("PHP >=5.3 is required.\n");
}
require_once dirname(__FILE__)."/config.php";
# Test purpose only
if(isset($argv) && isset($argv[1]) && ($argv[1] == "test")) {
die("OK");
}
if(
(isset($_ENV["SHELL"]) && !empty($_ENV["SHELL"])) ||
(isset($_SERVER["SHELL"]) && !empty($_SERVER["SHELL"])) ||
php_sapi_name() == 'cli'
) {
# Continue
} else {
if(isset($_GET["cron_secret"]) && isset($_config["cron_secret"]) && ($_GET["cron_secret"] == $_config["cron_secret"])) {
# Continue
} else {
die("You must run from CLI.\n");
}
}
define('CRON', true);
define('APPLICATION_PATH', realpath(dirname(__FILE__)."/app"));
define('APPLICATION_ENV', $_config["environment"]);
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH."/../lib"),
)));
require_once "Zend/Application.php";
$application = new Zend_Application(
$_config["environment"],
array(
"config" => APPLICATION_PATH."/configs/app.ini",
"bootstrap" => array(
"path" => APPLICATION_PATH."/BootstrapCron.php",
"class" => "BootstrapCron",
),
)
);
$config = new Zend_Config($application->getOptions(), true);
Zend_Registry::set('config', $config);
/** Init bootstrap */
$application->bootstrap();
/** Run cron */
$cron = new Siberian_Cron();
$cron->triggerAll();