-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonnet-cli.php
45 lines (36 loc) · 993 Bytes
/
monnet-cli.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
/**
*
* @author diego/@/envigo.net
* @package
* @subpackage
* @copyright Copyright CC BY-NC-ND 4.0 @ 2020 - 2024 Diego Garcia (diego/@/envigo.net)
*/
define('IN_WEB', true);
define('IN_CLI', true);
//define('DUMP_VARS', true);
$APP_NAME = 'monnet-cli';
/**
* @var Database $db
* @var Config $ncfg
* @var AppContext|null $ctx An instance of AppCtx or null if not defined
*/
require_once 'include/climode.inc.php';
require_once 'include/cron.inc.php';
Log::debug("Starting $APP_NAME");
if (is_locked()) :
Log::debug("CLI Locked skipping");
die();
endif;
register_shutdown_function('unlink', CLI_LOCK);
if ($ctx) :
check_known_hosts($ctx);
cron($ctx);
endif;
//Log::debug($db->getQueryHistory();
if ($db->isConn()) :
$ncfg->set('cli_last_run', date_now());
//$db->update('prefs', ['uid' => 0, 'pref_value' => date_now()], ['pref_name' => 'cli_last_run'], 'LIMIT 1');
endif;
Log::debug("[Finishing] $APP_NAME " . datetime_machine() . "");
exit(0);