From d72b41a9029c2c337efceca2af40957c0801cad8 Mon Sep 17 00:00:00 2001 From: jerry Date: Mon, 29 Mar 2021 15:48:47 +0800 Subject: [PATCH] update to build 404 fix ./zhamao command fix warning when first time starting framework --- src/ZM/Command/InitCommand.php | 2 +- src/ZM/ConsoleApplication.php | 4 ++-- src/ZM/Store/LightCache.php | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ZM/Command/InitCommand.php b/src/ZM/Command/InitCommand.php index ccebea0b..c1c6b8c7 100644 --- a/src/ZM/Command/InitCommand.php +++ b/src/ZM/Command/InitCommand.php @@ -53,7 +53,7 @@ class InitCommand extends Command echo "Copying ./zhamao\n"; file_put_contents( $base_path."/zhamao", - "#!/usr/bin/env php\ninitEnv()->run();" + "#!/usr/bin/env php\ninitEnv(\"server\")->run();" ); chmod($base_path."/zhamao", 0755); $autoload = [ diff --git a/src/ZM/ConsoleApplication.php b/src/ZM/ConsoleApplication.php index 88bf7fe8..96858c76 100644 --- a/src/ZM/ConsoleApplication.php +++ b/src/ZM/ConsoleApplication.php @@ -19,8 +19,8 @@ use ZM\Command\SystemdCommand; class ConsoleApplication extends Application { - const VERSION_ID = 403; - const VERSION = "2.4.3"; + const VERSION_ID = 404; + const VERSION = "2.4.4"; public function __construct(string $name = 'UNKNOWN') { define("ZM_VERSION_ID", self::VERSION_ID); diff --git a/src/ZM/Store/LightCache.php b/src/ZM/Store/LightCache.php index 064809df..b146de16 100644 --- a/src/ZM/Store/LightCache.php +++ b/src/ZM/Store/LightCache.php @@ -256,7 +256,11 @@ class LightCache if (self::$kv_table === null) return; if (!empty(self::$config["persistence_path"])) { - $r = json_decode(file_get_contents(self::$config["persistence_path"]), true); + if (file_exists(self::$config["persistence_path"])) { + $r = json_decode(file_get_contents(self::$config["persistence_path"]), true); + } else { + $r = []; + } if ($r === null) $r = []; foreach ($r as $k => $v) { Console::verbose("Saving " . $k);