mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
system: use singleton implementation everywhere
This commit is contained in:
parent
0e286b3a34
commit
3e749e1132
@ -47,7 +47,7 @@ final class product
|
||||
{
|
||||
self::$data = json_decode(file_get_contents('/usr/local/opnsense/version/core'), true);
|
||||
|
||||
/* boot detection via exit_on_bootup() */
|
||||
/* boot detection */
|
||||
$bootflag = '/var/run/booting';
|
||||
@touch($bootflag);
|
||||
$fp = fopen($bootflag, 'r');
|
||||
|
||||
@ -296,23 +296,11 @@ function unlock($cfglckkey = null)
|
||||
|
||||
function exit_on_bootup($callback = null, $arguments = [])
|
||||
{
|
||||
$bootflag = '/var/run/booting';
|
||||
|
||||
/* make sure file exists */
|
||||
@touch($bootflag);
|
||||
|
||||
$fp = fopen($bootflag, 'r');
|
||||
if (!$fp) {
|
||||
/* log possible error and adjust exist code */
|
||||
log_msg("exit_on_bootup(): error opening $bootflag", LOG_ERR);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!flock($fp, LOCK_SH | LOCK_NB)) {
|
||||
if (product::getInstance()->booting()) {
|
||||
if ($callback) {
|
||||
call_user_func_array($callback, $arguments);
|
||||
}
|
||||
/* intentionally we exit here to avoid future cleverness WRT bootup handing */
|
||||
/* intentionally we exit here to avoid future cleverness WRT bootup handling */
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user