mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-24 17:15:36 +08:00
update to 2.4.2 version (build 402)
change WORKING_DIR constant change logic of savePersistence() add LightCache addPersistence() and removePersistence() method add `./zhamao` command
This commit is contained in:
@@ -19,11 +19,11 @@ class CheckConfigCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
if (LOAD_MODE !== 1) {
|
||||
$output->writeln("<error>仅限在Composer依赖模式中使用此命令!");
|
||||
$output->writeln("<error>仅限在Composer依赖模式中使用此命令!</error>");
|
||||
return Command::FAILURE;
|
||||
}
|
||||
$current_cfg = getcwd() . "/config/";
|
||||
$remote_cfg = include_once WORKING_DIR . "/config/global.php";
|
||||
$remote_cfg = include_once FRAMEWORK_ROOT_DIR . "/config/global.php";
|
||||
if (file_exists($current_cfg . "global.php")) {
|
||||
$this->check($remote_cfg, "global.php", $output);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class CheckConfigCommand extends Command
|
||||
$this->check($remote_cfg, "global.production.php", $output);
|
||||
}
|
||||
if ($this->need_update === true) {
|
||||
$output->writeln("<comment>有配置文件需要更新,详情见文档 https://framework.zhamao.xin/update/config.md</comment>");
|
||||
$output->writeln("<comment>有配置文件需要更新,详情见文档 `https://framework.zhamao.xin/update/config.md`</comment>");
|
||||
} else {
|
||||
$output->writeln("<info>配置文件暂无更新!</info>");
|
||||
}
|
||||
@@ -51,9 +51,8 @@ class CheckConfigCommand extends Command
|
||||
private function check($remote, $local, OutputInterface $out) {
|
||||
$local_file = include_once getcwd() . "/config/".$local;
|
||||
foreach($remote as $k => $v) {
|
||||
$out->writeln("<comment>正在检查".$k."</comment>");
|
||||
if (!isset($local_file[$k])) {
|
||||
$out->writeln("<error>配置文件 ".$local . " 需要更新!(缺少 `$k` 字段配置)</error>");
|
||||
$out->writeln("<comment>配置文件 ".$local . " 需要更新!(当前配置文件缺少 `$k` 字段配置)</comment>");
|
||||
$this->need_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class InitCommand extends Command
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
if (LOAD_MODE === 1) { // 从composer依赖而来的项目模式,最基本的需要初始化的模式
|
||||
$output->writeln("<comment>Initializing files</comment>");
|
||||
$base_path = LOAD_MODE_COMPOSER_PATH;
|
||||
$base_path = WORKING_DIR;
|
||||
$args = $input->getOption("force");
|
||||
foreach ($this->extract_files as $file) {
|
||||
if (!file_exists($base_path . $file) || $args) {
|
||||
@@ -50,6 +50,12 @@ class InitCommand extends Command
|
||||
echo "Skipping " . $file . " , file exists." . PHP_EOL;
|
||||
}
|
||||
}
|
||||
echo "Copying ./zhamao\n";
|
||||
file_put_contents(
|
||||
$base_path."/zhamao",
|
||||
"#!/usr/bin/env php\n<?php require_once \"vendor/autoload.php\";(new ZM\ConsoleApplication(\"zhamao-framework\"))->initEnv()->run();"
|
||||
);
|
||||
chmod($base_path."/zhamao", 0755);
|
||||
$autoload = [
|
||||
"psr-4" => [
|
||||
"Module\\" => "src/Module",
|
||||
|
||||
Reference in New Issue
Block a user