-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgdo_cronjob.php
45 lines (35 loc) · 879 Bytes
/
gdo_cronjob.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
<?php
use GDO\CLI\CLI;
use GDO\Core\Application;
use GDO\Core\Debug;
use GDO\Core\Logger;
use GDO\Core\Method\Stub;
use GDO\Cronjob\Cronjob;
use GDO\DB\Database;
use GDO\Language\Trans;
############
### Init ###
############
if (php_sapi_name() !== 'cli')
{
echo 'This is a CLI application.';
die(-1);
}
require 'GDO7.php';
require 'protected/config.php';
final class gdo_cronjob extends Application
{
public function isCLI(): bool { return true; }
public function isCronjob(): bool { return true; }
}
global $me;
$me = Stub::make();
gdo_cronjob::instance();
CLI::setServerVars();
Debug::init(GDO_ERROR_DIE, GDO_ERROR_MAIL);
Logger::init('cronjob', Logger::ALL, 'protected/logs');
Database::init();
Trans::setISO('en');
/** @var $argv string[] * */
$force = in_array('--force', $argv, true);
Cronjob::run($me && $force); # '$me &&' removes a warning for unused $me