mirror of
https://github.com/acepanel/panel.git
synced 2026-02-05 02:07:18 +08:00
特性(网站):新增PostgreSQL支持,调整编辑器CSS兼容性
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user