mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 完成安装脚本
This commit is contained in:
parent
583e4490bb
commit
64aeeffa04
@ -96,11 +96,11 @@ class Index extends Controller {
|
||||
$this->error('环境检测没有通过,请调整环境后重试!', url('step3'));
|
||||
}else{
|
||||
$step = session('step');
|
||||
// if( $step != 3){
|
||||
// $this->error("请按顺序安装", url('index'));
|
||||
// }else{
|
||||
session('step', 4);
|
||||
if( $step != 3){
|
||||
$this->error("请按顺序安装", url('index'));
|
||||
}else{
|
||||
session('error', false);
|
||||
echo $this->fetch();
|
||||
$dbConfig = session('dbConfig');
|
||||
$cacheConfig = session('cacheConfig');
|
||||
$adminConfig = session('adminConfig');
|
||||
@ -140,9 +140,18 @@ class Index extends Controller {
|
||||
$this->writeConfig($cacheConfig, 'cache', $extraConfPath);
|
||||
}
|
||||
$this->writeConfig($baseConfig, 'base', $extraConfPath);
|
||||
return $this->fetch();
|
||||
if(session('error')){
|
||||
$this->error('安装出错', url('index'));
|
||||
}else{
|
||||
session('step', 4);
|
||||
$this->redirect('complete');
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public function complete(){
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,7 +163,7 @@ class Index extends Controller {
|
||||
*/
|
||||
private function writeConfig($config, $type, $path){
|
||||
if(is_array($config)){
|
||||
showMsg('开始写入'.$type.'配置文件');
|
||||
showMsg('开始写入配置文件...', 'info');
|
||||
//读取配置内容
|
||||
$conf = file_get_contents(APP_PATH . $this->request->module(). DS . 'data'. DS .$type.'.tpl');
|
||||
//替换配置项
|
||||
@ -163,9 +172,9 @@ class Index extends Controller {
|
||||
}
|
||||
//写入应用配置文件
|
||||
if(file_put_contents($path.$type.'.php', $conf)){
|
||||
showMsg('配置文件'.$type.'写入成功', 'bg-success');
|
||||
showMsg('写入配置文件'.$type.'...成功', 'success');
|
||||
}else{
|
||||
showMsg('配置文件'.$type.'写入失败!', 'bg-danger');
|
||||
showMsg('写入配置文件'.$type.'...失败!', 'danger');
|
||||
session('error', true);
|
||||
}
|
||||
return true;
|
||||
@ -184,7 +193,7 @@ class Index extends Controller {
|
||||
$sql = explode(";\n", $sql);
|
||||
|
||||
//开始安装
|
||||
showMsg('开始安装数据库...');
|
||||
showMsg('开始安装数据库...', 'info');
|
||||
foreach ($sql as $value) {
|
||||
$value = trim($value);
|
||||
if (empty($value)) continue;
|
||||
@ -193,9 +202,9 @@ class Index extends Controller {
|
||||
$value = str_replace(" `{$name}", " `{$prefix}{$name}", $value);
|
||||
$msg = "创建数据表{$name}";
|
||||
if (false !== $db->exec($value)) {
|
||||
showMsg($msg . '...成功');
|
||||
showMsg($msg . '...成功', 'success');
|
||||
} else {
|
||||
showMsg($msg . '...失败!', 'error');
|
||||
showMsg($msg . '...失败!', 'danger');
|
||||
session('error', true);
|
||||
}
|
||||
} else {
|
||||
|
20
application/install/view/index/complete.html
Normal file
20
application/install/view/index/complete.html
Normal file
@ -0,0 +1,20 @@
|
||||
{extend name="public/base" /}
|
||||
{block name="title"}系统安装Step4{/block}
|
||||
{block name="nav"}
|
||||
<li><a href="javascript:;">安装协议</a></li>
|
||||
<li><a href="javascript:;">参数设置</a></li>
|
||||
<li><a href="javascript:;">环境检测</a></li>
|
||||
<li class="active"><a href="javascript:;">开始安装</a></li>
|
||||
<li><a href="javascript:;">安装完成</a></li>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">恭喜您,{:config('PRODUCT_NAME')} 安装完成!</div>
|
||||
<div class="panel-body" style="font-size: 14px">
|
||||
<div class="alert alert-success" role="alert">
|
||||
<h4 align="center">{:config('PRODUCT_NAME')}提示您:您的系统已经成功安装,为了系统安全,请删除Install模块!</h4>
|
||||
</div>
|
||||
<a class="btn btn-primary btn-block" target="_blank" href="http://{:$_SERVER['HTTP_HOST']}">进入系统</a>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
@ -8,6 +8,16 @@
|
||||
<li><a href="javascript:;">安装完成</a></li>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<style>
|
||||
.install-database {
|
||||
height: 500px;
|
||||
max-height: 500px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.install-database p{
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">{:config('PRODUCT_NAME')} 开始安装</div>
|
||||
<div class="panel-body" style="font-size: 14px">
|
||||
@ -18,14 +28,12 @@
|
||||
function showMsg(msg, classname){
|
||||
var li = document.createElement('p');
|
||||
li.innerHTML = msg;
|
||||
classname && li.setAttribute('class', classname);
|
||||
classname && li.setAttribute('class', 'bg-' + classname);
|
||||
list.appendChild(li);
|
||||
document.scrollTop += 30;
|
||||
}
|
||||
</script>
|
||||
<button class="am-radius am-btn am-btn-warning am-disabled">正在安装,请稍后...</button>
|
||||
<a type="button" href="{:url('step4')}" class="btn btn-primary btn-block">下一步</a>
|
||||
<a type="button" href="{:url('step2')}" class="btn btn-default btn-block">上一步</a>
|
||||
<button class="btn btn-warning btn-block" disabled>正在安装,请稍后...</button>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
Loading…
x
Reference in New Issue
Block a user