mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-09 19:42:47 +08:00
调整更新的append的逻辑;为login增加trait扩展机制;发布新版本
This commit is contained in:
@@ -7,12 +7,15 @@ use app\common\controller\AdminController;
|
|||||||
use think\captcha\facade\Captcha;
|
use think\captcha\facade\Captcha;
|
||||||
use think\facade\Env;
|
use think\facade\Env;
|
||||||
use think\facade\Event;
|
use think\facade\Event;
|
||||||
|
use trait\admin\controller\LoginTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Login.
|
* Class Login.
|
||||||
*/
|
*/
|
||||||
class Login extends AdminController
|
class Login extends AdminController
|
||||||
{
|
{
|
||||||
|
use LoginTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化方法.
|
* 初始化方法.
|
||||||
*/
|
*/
|
||||||
@@ -33,7 +36,6 @@ class Login extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
$captcha = Env::get('adminsystem.captcha', 1);
|
$captcha = Env::get('adminsystem.captcha', 1);
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$post = $this->request->post();
|
$post = $this->request->post();
|
||||||
|
|||||||
@@ -210,6 +210,67 @@ class Update extends Command
|
|||||||
file_put_contents($now_file_path, $file_content);
|
file_put_contents($now_file_path, $file_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理append的文件
|
||||||
|
$last_version_list_skip_files = $last_version_filesystem->listContents('/', Filesystem::LIST_DEEP)
|
||||||
|
->filter(function (StorageAttributes $attributes) use ($last_version_skip_config) {
|
||||||
|
if ($attributes->isDir()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $attributes->path();
|
||||||
|
|
||||||
|
if (str_starts_with($path, '.git')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$skip_files = $last_version_skip_config['skip_files'] ?? [];
|
||||||
|
|
||||||
|
if (in_array($path, $skip_files)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$skip_dir = $last_version_skip_config['skip_dir'] ?? [];
|
||||||
|
|
||||||
|
foreach ($skip_dir as $dir) {
|
||||||
|
if (str_starts_with($path, $dir)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
->map(fn (StorageAttributes $attributes) => $attributes->path())
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$last_version_list_append_files = [];
|
||||||
|
|
||||||
|
foreach ($last_version_list_skip_files as $file_path) {
|
||||||
|
if (in_array($file_path, $last_version_skip_config['append_files'])) {
|
||||||
|
$last_version_list_append_files[] = $file_path;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($last_version_skip_config['append_dir'] as $dir) {
|
||||||
|
if(str_starts_with($file_path,$dir)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($last_version_list_append_files as $file_path) {
|
||||||
|
$now_file_path = $now_dir. '/'. $file_path;
|
||||||
|
$last_file_path = $last_version_dir. '/'. $file_path;
|
||||||
|
|
||||||
|
if(file_exists($now_file_path)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_content = file_get_contents($last_file_path);
|
||||||
|
|
||||||
|
PathTools::intiDir($now_file_path);
|
||||||
|
file_put_contents($now_file_path, $file_content);
|
||||||
|
}
|
||||||
|
|
||||||
// 检测now的composer依赖和最新的composer依赖
|
// 检测now的composer依赖和最新的composer依赖
|
||||||
|
|
||||||
$last_composer_json = file_get_contents($last_version_dir . '/composer.json');
|
$last_composer_json = file_get_contents($last_version_dir . '/composer.json');
|
||||||
|
|||||||
@@ -14,12 +14,13 @@ use think\facade\App;
|
|||||||
|
|
||||||
class Version extends Command
|
class Version extends Command
|
||||||
{
|
{
|
||||||
public const VERSION = 'v2.0.33';
|
public const VERSION = 'v2.0.34';
|
||||||
|
|
||||||
public const LAYUI_VERSION = '2.8.16';
|
public const LAYUI_VERSION = '2.8.16';
|
||||||
|
|
||||||
public const COMMENT = [
|
public const COMMENT = [
|
||||||
'调整更新的文件替换逻辑;',
|
'调整更新的append的逻辑',
|
||||||
|
'为login增加trait扩展机制',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"app\\": "app",
|
"app\\": "app",
|
||||||
|
"trait\\": "extend/trait",
|
||||||
"Phinx\\": "extend/phinx"
|
"Phinx\\": "extend/phinx"
|
||||||
},
|
},
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
|
|||||||
@@ -18,7 +18,17 @@ $config['skip_files'] = $skip_files;
|
|||||||
$skip_dir = [];
|
$skip_dir = [];
|
||||||
$skip_dir[] = 'runtime';
|
$skip_dir[] = 'runtime';
|
||||||
$skip_dir[] = 'vendor';
|
$skip_dir[] = 'vendor';
|
||||||
|
$skip_dir[] = 'extend/trait';
|
||||||
|
|
||||||
$config['skip_dir'] = $skip_dir;
|
$config['skip_dir'] = $skip_dir;
|
||||||
|
|
||||||
|
|
||||||
|
// append 如果当前版本不存在,则追加,如果存在,则不应当覆盖
|
||||||
|
// append 的文件应当在skip内部
|
||||||
|
$config['append_files'] = [];
|
||||||
|
|
||||||
|
$config['append_dir'] = [
|
||||||
|
'extend/trait',
|
||||||
|
];
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|||||||
8
extend/trait/admin/controller/LoginTrait.php
Normal file
8
extend/trait/admin/controller/LoginTrait.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace trait\admin\controller;
|
||||||
|
|
||||||
|
trait LoginTrait
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user