Skip to content

Commit 728dbe9

Browse files
committed
feature: 指定到 translations 下的具体文件,防止 uninstall 时删除整个目录
1 parent bb6abd5 commit 728dbe9

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/Install.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace WebmanTech\AmisAdmin;
34

45
class Install
@@ -8,10 +9,10 @@ class Install
89
/**
910
* @var array
1011
*/
11-
protected static $pathRelation = array (
12-
'../copy/config/plugin' => 'config/plugin/webman-tech/amis-admin',
13-
'../copy/resource/translations' => 'resource/translations',
14-
);
12+
protected static $pathRelation = array(
13+
'../copy/config/plugin' => 'config/plugin/webman-tech/amis-admin',
14+
'../copy/resource/translations/en/amis-admin.php' => 'resource/translations/en/amis-admin.php',
15+
);
1516

1617
/**
1718
* Install
@@ -39,13 +40,13 @@ public static function installByRelation()
3940
{
4041
foreach (static::$pathRelation as $source => $dest) {
4142
if ($pos = strrpos($dest, '/')) {
42-
$parent_dir = base_path().'/'.substr($dest, 0, $pos);
43+
$parent_dir = base_path() . '/' . substr($dest, 0, $pos);
4344
if (!is_dir($parent_dir)) {
4445
mkdir($parent_dir, 0777, true);
4546
}
4647
}
4748
//symlink(__DIR__ . "/$source", base_path()."/$dest");
48-
copy_dir(__DIR__ . "/$source", base_path()."/$dest");
49+
copy_dir(__DIR__ . "/$source", base_path() . "/$dest");
4950
echo "Create $dest
5051
";
5152
}
@@ -58,7 +59,7 @@ public static function installByRelation()
5859
public static function uninstallByRelation()
5960
{
6061
foreach (static::$pathRelation as $source => $dest) {
61-
$path = base_path()."/$dest";
62+
$path = base_path() . "/$dest";
6263
if (!is_dir($path) && !is_file($path)) {
6364
continue;
6465
}

0 commit comments

Comments
 (0)