修改原有框架中英文映射
This commit is contained in:
@@ -108,7 +108,7 @@ class InstallLogic
|
||||
if (empty($info['app'])) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
// 基本配置不完整
|
||||
throw new ApiException('插件的基础配置信息错误');
|
||||
throw new ApiException('Plugin base config is invalid');
|
||||
}
|
||||
|
||||
|
||||
@@ -127,14 +127,14 @@ class InstallLogic
|
||||
$upgrade = Version::compare($nextVersion, $info['version']);
|
||||
if (!$upgrade) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('插件已经存在');
|
||||
throw new ApiException('Plugin already exists');
|
||||
}
|
||||
}
|
||||
|
||||
if (Filesystem::dirIsEmpty($this->appDir) || (!Filesystem::dirIsEmpty($this->appDir) && !$upgrade)) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
// 模块目录被占
|
||||
throw new ApiException('该插件的安装目录已经被占用');
|
||||
throw new ApiException('Plugin install directory is already occupied');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ class InstallLogic
|
||||
public function uploadFromPath(string $zipPath): array
|
||||
{
|
||||
if (!is_file($zipPath)) {
|
||||
throw new ApiException('文件不存在');
|
||||
throw new ApiException('File not found');
|
||||
}
|
||||
|
||||
// 解压
|
||||
@@ -181,7 +181,7 @@ class InstallLogic
|
||||
$info = Server::getIni($copyToDir);
|
||||
if (empty($info['app'])) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('插件的基础配置信息错误');
|
||||
throw new ApiException('Plugin base config is invalid');
|
||||
}
|
||||
|
||||
$this->appName = $info['app'];
|
||||
@@ -199,13 +199,13 @@ class InstallLogic
|
||||
$upgrade = Version::compare($nextVersion, $info['version']);
|
||||
if (!$upgrade) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('插件已经存在');
|
||||
throw new ApiException('Plugin already exists');
|
||||
}
|
||||
}
|
||||
|
||||
if (Filesystem::dirIsEmpty($this->appDir) || (!Filesystem::dirIsEmpty($this->appDir) && !$upgrade)) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('该插件的安装目录已经被占用');
|
||||
throw new ApiException('Plugin install directory is already occupied');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,11 +237,11 @@ class InstallLogic
|
||||
{
|
||||
$state = $this->getInstallState();
|
||||
if ($state == self::INSTALLED || $state == self::DIRECTORY_OCCUPIED) {
|
||||
throw new ApiException('插件已经存在');
|
||||
throw new ApiException('Plugin already exists');
|
||||
}
|
||||
|
||||
if ($state == self::DEPENDENT_WAIT_INSTALL) {
|
||||
throw new ApiException('等待依赖安装');
|
||||
throw new ApiException('Waiting for dependencies to be installed');
|
||||
}
|
||||
|
||||
echo '开始安装[' . $this->appName . ']' . PHP_EOL;
|
||||
@@ -351,14 +351,14 @@ class InstallLogic
|
||||
public function checkPackage(): bool
|
||||
{
|
||||
if (!is_dir($this->appDir)) {
|
||||
throw new ApiException('插件目录不存在');
|
||||
throw new ApiException('Plugin directory not found');
|
||||
}
|
||||
$info = $this->getInfo();
|
||||
$infoKeys = ['app', 'title', 'about', 'author', 'version', 'state'];
|
||||
foreach ($infoKeys as $value) {
|
||||
if (!array_key_exists($value, $info)) {
|
||||
Filesystem::delDir($this->appDir);
|
||||
throw new ApiException('该插件的基础配置信息不完善');
|
||||
throw new ApiException('Plugin base config is incomplete');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -527,6 +527,6 @@ class InstallLogic
|
||||
} elseif ($arr) {
|
||||
return Server::setIni($this->appDir, $arr);
|
||||
}
|
||||
throw new ApiException('参数错误');
|
||||
throw new ApiException('Invalid parameters');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user