-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9edbf91
Showing
5 changed files
with
557 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Youloge.tool Webman 辅助函数百宝箱 | ||
|
||
> 使用前看一下下面辅助函数:尤其注意`函数名称得问题`:不适合老项目:老项目可以选择查询源码,把代码片段复制出来使用 | ||
### 项目地址 | ||
|
||
[Github Youloge.Tool](https://github.com/youfeed/webman.tool) Star我 `我们一起做大做强` | ||
|
||
- 0.0.1 初始项目 | ||
|
||
### 有帮助的话,记得给个star 打赏打赏,代码风格极简 欢迎提交代码 | ||
|
||
> `composer require youloge/webman.tool` | ||
|
||
### 使用说明 | ||
|
||
- `config/youloge.php` 新增一个配置文件(升级时候不影响配置) | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "youloge/webman.tool", | ||
"type": "library", | ||
"license": "MIT", | ||
"description": "Webman plugin youloge/webman.tool", | ||
"require": { | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Youloge\\Webman.tool\\": "src" | ||
}, | ||
"files": [ | ||
"src/helpers.php" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
namespace Youloge\Webman.tool; | ||
|
||
class Install | ||
{ | ||
const WEBMAN_PLUGIN = true; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected static $pathRelation = array ( | ||
'config/plugin/youloge/webman.tool' => 'config/plugin/youloge/webman.tool', | ||
); | ||
|
||
/** | ||
* Install | ||
* @return void | ||
*/ | ||
public static function install() | ||
{ | ||
static::installByRelation(); | ||
} | ||
|
||
/** | ||
* Uninstall | ||
* @return void | ||
*/ | ||
public static function uninstall() | ||
{ | ||
self::uninstallByRelation(); | ||
} | ||
|
||
/** | ||
* installByRelation | ||
* @return void | ||
*/ | ||
public static function installByRelation() | ||
{ | ||
foreach (static::$pathRelation as $source => $dest) { | ||
if ($pos = strrpos($dest, '/')) { | ||
$parent_dir = base_path().'/'.substr($dest, 0, $pos); | ||
if (!is_dir($parent_dir)) { | ||
mkdir($parent_dir, 0777, true); | ||
} | ||
} | ||
//symlink(__DIR__ . "/$source", base_path()."/$dest"); | ||
copy_dir(__DIR__ . "/$source", base_path()."/$dest"); | ||
echo "Create $dest | ||
"; | ||
} | ||
} | ||
|
||
/** | ||
* uninstallByRelation | ||
* @return void | ||
*/ | ||
public static function uninstallByRelation() | ||
{ | ||
foreach (static::$pathRelation as $source => $dest) { | ||
$path = base_path()."/$dest"; | ||
if (!is_dir($path) && !is_file($path)) { | ||
continue; | ||
} | ||
echo "Remove $dest | ||
"; | ||
if (is_file($path) || is_link($path)) { | ||
unlink($path); | ||
continue; | ||
} | ||
remove_dir($path); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
return [ | ||
'enable' => true, | ||
]; |
Oops, something went wrong.