From b0419624030dcda262dfa395c485c7aa5cd88ceb Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 29 Nov 2018 01:42:14 +0100 Subject: [PATCH] Improved CLI mode checking. --- misuzu.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misuzu.php b/misuzu.php index 1b29306d..7834c535 100644 --- a/misuzu.php +++ b/misuzu.php @@ -26,6 +26,7 @@ $errorHandler->pushHandler( ); $errorHandler->register(); +// TODO: do something about this, probably a good idea to include shit as required rather than all at once here require_once 'src/array.php'; require_once 'src/audit_log.php'; require_once 'src/cache.php'; @@ -83,7 +84,7 @@ db_setup([ define('MSZ_STORAGE', create_directory(config_get_default(MSZ_ROOT . '/store', 'Storage', 'path'))); if (PHP_SAPI === 'cli') { - if ($argv[0] === basename(__FILE__)) { + if (realpath($_SERVER['SCRIPT_FILENAME']) === __FILE__) { switch ($argv[1] ?? null) { case 'cron': // Ensure main role exists.