mirror of https://gitee.com/karson/fastadmin.git
调整 安装时生成网站配置文件
parent
b552ccd403
commit
2a1ceffa60
|
|
@ -4,6 +4,7 @@
|
|||
/runtime/*
|
||||
/addons/*
|
||||
/application/admin/command/Install/*.lock
|
||||
/application/extra/site.php
|
||||
/public/assets/libs/
|
||||
/public/assets/addons/*
|
||||
/public/uploads/*
|
||||
|
|
|
|||
|
|
@ -103,6 +103,23 @@ class Install extends Command
|
|||
|
||||
\think\Cache::rm('__menu__');
|
||||
|
||||
// 生成站点配置文件
|
||||
$config = [];
|
||||
foreach (model('app\common\model\Config')->all() as $k => $v) {
|
||||
$value = $v->toArray();
|
||||
if (in_array($value['type'], ['selects', 'checkbox', 'images', 'files'])) {
|
||||
$value['value'] = explode(',', $value['value']);
|
||||
}
|
||||
if ($value['type'] == 'array') {
|
||||
$value['value'] = (array)json_decode($value['value'], true);
|
||||
}
|
||||
$config[$value['name']] = $value['value'];
|
||||
}
|
||||
file_put_contents(
|
||||
APP_PATH . 'extra' . DS . 'site.php',
|
||||
'<?php' . "\n\nreturn " . var_export($config, true) . ";"
|
||||
);
|
||||
|
||||
$output->info("Install Successed!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
return array (
|
||||
'name' => 'FastAdmin',
|
||||
'beian' => '',
|
||||
'cdnurl' => '',
|
||||
'version' => '1.0.1',
|
||||
'timezone' => 'Asia/Shanghai',
|
||||
'forbiddenip' => '',
|
||||
'languages' =>
|
||||
array (
|
||||
'backend' => 'zh-cn',
|
||||
'frontend' => 'zh-cn',
|
||||
),
|
||||
'fixedpage' => 'dashboard',
|
||||
'categorytype' =>
|
||||
array (
|
||||
'default' => 'Default',
|
||||
'page' => 'Page',
|
||||
'article' => 'Article',
|
||||
'test' => 'Test',
|
||||
),
|
||||
'configgroup' =>
|
||||
array (
|
||||
'basic' => 'Basic',
|
||||
'email' => 'Email',
|
||||
'dictionary' => 'Dictionary',
|
||||
'user' => 'User',
|
||||
'example' => 'Example',
|
||||
),
|
||||
'mail_type' => '1',
|
||||
'mail_smtp_host' => 'smtp.qq.com',
|
||||
'mail_smtp_port' => '465',
|
||||
'mail_smtp_user' => '10000',
|
||||
'mail_smtp_pass' => 'password',
|
||||
'mail_verify_type' => '2',
|
||||
'mail_from' => '10000@qq.com',
|
||||
);
|
||||
|
|
@ -190,6 +190,24 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
$adminName = substr(str_shuffle(str_repeat($x, ceil(10 / strlen($x)))), 1, 10) . '.php';
|
||||
rename($adminFile, ROOT_PATH . 'public' . DS . $adminName);
|
||||
}
|
||||
|
||||
// 生成站点配置文件
|
||||
$config = [];
|
||||
$config_list = $pdo->query("SELECT * FROM {$mysqlPrefix}config ORDER BY id ASC");
|
||||
foreach ($config_list as $k => $v) {
|
||||
if (in_array($v['type'], ['selects', 'checkbox', 'images', 'files'])) {
|
||||
$v['value'] = explode(',', $v['value']);
|
||||
}
|
||||
if ($v['type'] == 'array') {
|
||||
$v['value'] = (array)json_decode($v['value'], true);
|
||||
}
|
||||
$config[$v['name']] = $v['value'];
|
||||
}
|
||||
file_put_contents(
|
||||
APP_PATH . 'extra' . DS . 'site.php',
|
||||
'<?php' . "\n\nreturn " . var_export($config, true) . ";"
|
||||
);
|
||||
|
||||
echo "success|{$adminName}";
|
||||
} catch (PDOException $e) {
|
||||
$err = $e->getMessage();
|
||||
|
|
|
|||
Loading…
Reference in New Issue