-
Notifications
You must be signed in to change notification settings - Fork 7
/
cron.php
69 lines (56 loc) · 1.7 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
66
67
68
69
<?php
/*
Name: Index.php
URI: http://ezrpgproject.net/
Author: Zeggy, Booher, UAKTags
Package: ezRPG-Core
*/
namespace ezRPG;
use ezRPG\lib\Application,
ezRPG\lib\ModuleFactory;
// Define IN_EZRPG as TRUE
define('IN_EZRPG', true);
$rootPath = dirname(__DIR__);
if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
die('You must initialize composer!');
}
// Check for config and if it has data. @since 1.2RC
if (!file_exists('config.php') OR filesize('config.php') == 0) {
exit(1);
}
// Load init.php
require_once 'init.php';
try {
$container = new \Pimple\Container;
$ezrpg = new Application($container);
$ezrpg->getConfig(CUR_DIR . '/config.php');
// Database
$ezrpg->setDatabase();
// Database password no longer needed, unset variable
unset($config_password);
// Settings
$ezrpg->getSettings();
$container['hooks'] = $hooks = $ezrpg->getHooks();
parse_str($argv[1], $params);
if (isset($params['act'])) {
if ($params['act'] == "hour") {
$cron = new \ezRPG\lib\HourlyCron($container);
$cron->start();
echo date("H:i:s") . "Executed Hourly \n";
} elseif ($params['act'] == "halfhour") {
$cron = new \ezRPG\lib\HalfHourCron($container);
$cron->start();
echo date("H:i:s") . "Executed HalfHour \n";
} elseif ($params['act'] == "daily") {
$cron = new \ezRPG\lib\DailyCron($container);
$cron->start();
echo date("H:i:s") . "Executed Daily";
} else {
die('Unknown argument');
}
} else {
die("There weren't any arguments!");
}
} catch (\Exception $ex) {
die("Error: ".$ex->getMessage());
}