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:
jerry
2021-03-27 16:30:15 +08:00
parent beef44ea50
commit d699a152d5
11 changed files with 81 additions and 74 deletions

View File

@@ -1,4 +1,4 @@
<?php /** @noinspection PhpUnused */ #plain
<?php #plain
use Swoole\Atomic;
use Swoole\Coroutine;
@@ -21,33 +21,13 @@ use Swoole\Coroutine\System;
use ZM\Context\ContextInterface;
function phar_classloader($p) {
$filepath = getClassPath($p);
if ($filepath === null) {
Console::debug("F:Warning: get class path wrongs.$p");
return;
}
try {
/** @noinspection PhpIncludeInspection */
require_once $filepath;
} catch (Exception $e) {
echo "Error when finding class: " . $p . PHP_EOL;
die;
}
}
function getClassPath($class_name) {
$dir = str_replace("\\", "/", $class_name);
$dir2 = WORKING_DIR . "/src/" . $dir . ".php";
//echo "@@@".$dir2.PHP_EOL;
$dir2 = str_replace("\\", "/", $dir2);
if (file_exists($dir2)) return $dir2;
else {
$dir = DataProvider::getWorkingDir() . "/src/" . $dir . ".php";
//echo "###".$dir.PHP_EOL;
if (file_exists($dir)) return $dir;
else return null;
}
else return null;
}
/**
@@ -360,13 +340,9 @@ function uuidgen($uppercase = false): string {
}
function working_dir() {
if (LOAD_MODE == 0) return WORKING_DIR;
elseif (LOAD_MODE == 1) return LOAD_MODE_COMPOSER_PATH;
elseif (LOAD_MODE == 2) return realpath('.');
return null;
return WORKING_DIR;
}
/** @noinspection PhpMissingReturnTypeInspection */
function zm_dump($var, ...$moreVars) {
VarDumper::dump($var);