1.0.0 Alpha Release #59
1 changed files with 15 additions and 4 deletions
|
@ -12,6 +12,7 @@
|
||||||
use ncc\ncc;
|
use ncc\ncc;
|
||||||
use ncc\Utilities\Console;
|
use ncc\Utilities\Console;
|
||||||
use ncc\Utilities\Resolver;
|
use ncc\Utilities\Resolver;
|
||||||
|
use ncc\Utilities\RuntimeCache;
|
||||||
|
|
||||||
class Main
|
class Main
|
||||||
{
|
{
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
private static $log_level;
|
private static $log_level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the main CLI process
|
* Executes the main CLI process
|
||||||
*
|
*
|
||||||
|
@ -51,8 +52,8 @@
|
||||||
Console::outException('Cannot initialize NCC due to a runtime error.', $e, 1);
|
Console::outException('Cannot initialize NCC due to a runtime error.', $e, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define CLI stuff
|
|
||||||
define('NCC_CLI_MODE', 1);
|
define('NCC_CLI_MODE', 1);
|
||||||
|
register_shutdown_function('ncc\CLI\Main::shutdown');
|
||||||
|
|
||||||
if(isset(self::$args['l']) || isset(self::$args['log-level']))
|
if(isset(self::$args['l']) || isset(self::$args['log-level']))
|
||||||
{
|
{
|
||||||
|
@ -82,13 +83,14 @@
|
||||||
if(Resolver::checkLogLevel(self::$log_level, LogLevel::Debug))
|
if(Resolver::checkLogLevel(self::$log_level, LogLevel::Debug))
|
||||||
{
|
{
|
||||||
Console::outDebug('Debug logging enabled');
|
Console::outDebug('Debug logging enabled');
|
||||||
Console::outDebug(sprintf('consts: %s', json_encode(ncc::getConstants(), JSON_UNESCAPED_SLASHES)));
|
/** @noinspection PhpUnhandledExceptionInspection */
|
||||||
|
Console::outDebug(sprintf('const: %s', json_encode(ncc::getConstants(), JSON_UNESCAPED_SLASHES)));
|
||||||
Console::outDebug(sprintf('args: %s', json_encode(self::$args, JSON_UNESCAPED_SLASHES)));
|
Console::outDebug(sprintf('args: %s', json_encode(self::$args, JSON_UNESCAPED_SLASHES)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(in_array(NccBuildFlags::Unstable, NCC_VERSION_FLAGS))
|
if(in_array(NccBuildFlags::Unstable, NCC_VERSION_FLAGS))
|
||||||
{
|
{
|
||||||
//Console::outWarning('This is an unstable build of NCC, expect some features to not work as expected');
|
Console::outWarning('This is an unstable build of NCC, expect some features to not work as expected');
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -152,4 +154,13 @@
|
||||||
return self::$log_level;
|
return self::$log_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function shutdown()
|
||||||
|
{
|
||||||
|
Console::outDebug('clearing cache');
|
||||||
|
RuntimeCache::clearCache();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue