2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 12:40:25 +08:00

特性(网站):新增PostgreSQL支持,调整编辑器CSS兼容性

This commit is contained in:
耗子
2022-12-01 02:44:16 +08:00
parent ae3addbc40
commit a52f9029f2
6 changed files with 29 additions and 16 deletions

View File

@@ -307,10 +307,10 @@ class InfosController extends Controller
$dbVersions['mysql'] = false;
}
// 判断postgresql插件是否安装
if (isset(PLUGINS['postgresql15'])) {
$dbVersions['postgresql15'] = PLUGINS['postgresql15']['version'];
if (isset(PLUGINS['postgresql'])) {
$dbVersions['postgresql'] = PLUGINS['postgresql']['version'];
} else {
$dbVersions['postgresql15'] = false;
$dbVersions['postgresql'] = false;
}
// 循环获取已安装的PHP版本
$php_versions = Plugin::query()->where('slug', 'like', 'php%')->get();

View File

@@ -207,6 +207,14 @@ EOF;
shell_exec("mysql -u root -p".$password." -e \"CREATE USER '".$credentials['db_username']."'@'localhost' IDENTIFIED BY '".$credentials['db_password']."';\"");
shell_exec("mysql -u root -p".$password." -e \"GRANT ALL PRIVILEGES ON ".$credentials['db_name'].".* TO '".$credentials['db_username']."'@'localhost';\"");
shell_exec("mysql -u root -p".$password." -e \"flush privileges;\"");
} elseif ($credentials['db_type'] == 'postgresql') {
shell_exec('echo "CREATE DATABASE '.$credentials['db_name'].';"|su - postgres -c "psql"');
shell_exec('echo "CREATE USER '.$credentials['db_username'].' WITH PASSWORD \''.$credentials['db_password'].'\';"|su - postgres -c "psql"');
shell_exec('echo "GRANT ALL PRIVILEGES ON DATABASE '.$credentials['db_name'].' TO '.$credentials['db_username'].';"|su - postgres -c "psql"');
// 写入用户配置
shell_exec('echo "host '.$credentials['db_name'].' '.$credentials['db_username'].' 127.0.0.1/32 scram-sha-256" >> /www/server/postgresql/15/pg_hba.conf');
// 重载
shell_exec('systemctl reload postgresql-15');
}
}
$res['code'] = 0;

View File

@@ -33,7 +33,7 @@ Date: 2022-11-30
提示Ctrl+F 搜索关键字Ctrl+S 保存Ctrl+H 查找替换!
</blockquote>
<div id="openresty-config-editor"
style="width: -webkit-fill-available; height: 600px;"></div>
style="height: 600px;"></div>
<div class="layui-btn-container" style="padding-top: 30px;">
<button id="openresty-config-save" class="layui-btn">保存</button>
</div>

View File

@@ -53,19 +53,19 @@ Date: 2022-11-21
<div class="layui-inline">
<label class="layui-form-label">数据库名</label>
<div class="layui-input-inline">
<input type="text" name="db_name" autocomplete="off" class="layui-input">
<input type="text" name="db_name" autocomplete="off" class="layui-input"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">数据库用户</label>
<div class="layui-input-inline">
<input type="text" name="db_username" autocomplete="off" class="layui-input">
<input type="text" name="db_username" autocomplete="off" class="layui-input"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">数据库密码</label>
<div class="layui-input-inline">
<input type="text" name="db_password" autocomplete="off" class="layui-input">
<input id="add-website-db-password" type="text" name="db_password" autocomplete="off" class="layui-input"/>
</div>
</div>
</div>
@@ -99,15 +99,22 @@ Date: 2022-11-21
layui.use(['admin', 'form', 'laydate'], function () {
var $ = layui.$
, admin = layui.admin
, element = layui.element
, layer = layui.layer
, laydate = layui.laydate
, table = layui.table
, form = layui.form;
$("#add-website-db-info").hide();
form.render();
$('#add-website-db-password').hover(function () {
layer.tips('必须8位以上大小写数字特殊符号混合', '#add-website-db-password', {
tips: 1,
time: 0
});
}, function () {
layer.closeAll('tips');
});
form.on('select(add-website-db)', function (data) {
console.log(data.value); //得到被选中的值
if (data.value === "") {
@@ -118,12 +125,10 @@ Date: 2022-11-21
$("#add-website-db-info").show();
$('input[name="db_name"]').val($('input[name="name"]').val() + '_mysql');
$('input[name="db_username"]').val($('input[name="name"]').val() + '_mysql');
$('input[name="db_password"]').val($('input[name="name"]').val() + '_password');
}else if(data.value === 'postgresql15') {
}else if(data.value === 'postgresql') {
$("#add-website-db-info").show();
$('input[name="db_name"]').val($('input[name="name"]').val() + '_postgresql');
$('input[name="db_username"]').val($('input[name="name"]').val() + '_postgresql');
$('input[name="db_password"]').val($('input[name="name"]').val() + '_password');
}
});
// 提交

View File

@@ -15,14 +15,14 @@ Date: 2022-11-30
<blockquote class="layui-elem-quote layui-quote-nm">
设置站点未找到时的提示页面。
</blockquote>
<div id="index-editor" style="height: -webkit-fill-available;">@{{ d.data.index }}</div>
<div id="index-editor" style="height: 400px;">@{{ d.data.index }}</div>
</div>
<div class="layui-tab-item">
<!-- 停止页 -->
<blockquote class="layui-elem-quote layui-quote-nm">
设置站点停止时的提示页面。
</blockquote>
<div id="stop-editor" style="height: -webkit-fill-available;">@{{ d.data.stop }}</div>
<div id="stop-editor" style="height: 400px;">@{{ d.data.stop }}</div>
</div>
</div>
</div>

View File

@@ -167,7 +167,7 @@ Date: 2022-11-28
<blockquote class="layui-elem-quote layui-quote-nm">
设置伪静态规则,填入 <code>location</code> 部分即可
</blockquote>
<div id="rewrite-editor" style="height: -webkit-fill-available;">@{{ d.params.config.rewrite }}</div>
<div id="rewrite-editor" style="height: 400px;">@{{ d.params.config.rewrite }}</div>
</div>
<div class="layui-tab-item">
<!-- 配置原文 -->
@@ -177,7 +177,7 @@ Date: 2022-11-28
<br>
如果你修改了原文,那么点击保存后,其余的修改将不会生效!
</blockquote>
<div id="config-editor" style="height: -webkit-fill-available;">@{{ d.params.config.config_raw }}</div>
<div id="config-editor" style="height: 400px;">@{{ d.params.config.config_raw }}</div>
</div>
<div class="layui-tab-item">
<!-- 访问日志 -->