@@ -8,18 +8,23 @@ class Install
88 /**
99 * @var array
1010 */
11- protected static $ pathRelation = array (
12- 'config/plugin/webman/console ' => 'config/plugin/webman/console ' ,
13- ) ;
11+ protected static $ pathRelation = [
12+ 'config/plugin/webman/console ' => 'config/plugin/webman/console ' ,
13+ ] ;
1414
1515 /**
1616 * Install
1717 * @return void
1818 */
1919 public static function install ()
2020 {
21- copy (__DIR__ . "/webman " , base_path ()."/webman " );
22- chmod (base_path ()."/webman " , 0755 );
21+ $ dest = base_path () . "/webman " ;
22+ if (is_dir ($ dest )) {
23+ echo "Installation failed, please remove directory $ dest \n" ;
24+ return ;
25+ }
26+ copy (__DIR__ . "/webman " , $ dest );
27+ chmod (base_path () . "/webman " , 0755 );
2328
2429 static ::installByRelation ();
2530 }
@@ -33,7 +38,6 @@ public static function uninstall()
3338 if (is_file (base_path ()."/webman " )) {
3439 unlink (base_path () . "/webman " );
3540 }
36-
3741 self ::uninstallByRelation ();
3842 }
3943
@@ -50,7 +54,6 @@ public static function installByRelation()
5054 mkdir ($ parent_dir , 0777 , true );
5155 }
5256 }
53- //symlink(__DIR__ . "/$source", base_path()."/$dest");
5457 copy_dir (__DIR__ . "/ $ source " , base_path ()."/ $ dest " );
5558 }
5659 }
@@ -66,9 +69,6 @@ public static function uninstallByRelation()
6669 if (!is_dir ($ path ) && !is_file ($ path )) {
6770 continue ;
6871 }
69- /*if (is_link($path) {
70- unlink($path);
71- }*/
7272 remove_dir ($ path );
7373 }
7474 }
0 commit comments