mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
added 新增安装脚本模块,完成step1的页面样式
This commit is contained in:
parent
7c08eaec80
commit
e6bf89a2e4
@ -12,8 +12,8 @@
|
||||
return [
|
||||
'PRODUCT_VERSION' => 'V1.0.0', //项目版本
|
||||
'PRODUCT_NAME' => 'ApiAdmin', //产品名称
|
||||
'WEBSITE_DOMAIN' => 'http://www.our-dream.cn', //官方网址
|
||||
'COMPANY_NAME' => 'XXXXXXXX有限公司', //公司名称
|
||||
'WEBSITE_DOMAIN' => 'http://zxblog.our-dream.cn', //官方网址
|
||||
'COMPANY_NAME' => 'ApiAdmin开发维护团队', //公司名称
|
||||
'SQL_PRIMARY_KEY' => 'id',
|
||||
'USER_ADMINISTRATOR' => 4,
|
||||
|
||||
|
262
application/install/common.php
Normal file
262
application/install/common.php
Normal file
@ -0,0 +1,262 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CoreThink [ Simple Efficient Excellent ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2014 http://www.corethink.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: jry <598821125@qq.com> <http://www.corethink.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 系统环境检测
|
||||
* @return array 系统环境数据
|
||||
* @author jry <598821125@qq.com>
|
||||
*/
|
||||
function check_env(){
|
||||
$items = array(
|
||||
'os' => array(
|
||||
'title' => '操作系统',
|
||||
'limit' => '不限制',
|
||||
'current' => PHP_OS,
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
),
|
||||
'php' => array(
|
||||
'title' => 'PHP版本',
|
||||
'limit' => '5.3+',
|
||||
'current' => PHP_VERSION,
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
),
|
||||
'upload' => array(
|
||||
'title' => '附件上传',
|
||||
'limit' => '不限制',
|
||||
'current' => ini_get('file_uploads') ? ini_get('upload_max_filesize'):'未知',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
),
|
||||
// 'gd' => array(
|
||||
// 'title' => 'GD库',
|
||||
// 'limit' => '2.0+',
|
||||
// 'current' => '未知',
|
||||
// 'icon' => 'am-text-success am-icon-check',
|
||||
// ),
|
||||
'disk' => array(
|
||||
'title' => '磁盘空间',
|
||||
'limit' => '100M+',
|
||||
'current' => '未知',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
),
|
||||
);
|
||||
|
||||
//PHP环境检测
|
||||
if($items['php']['current'] < 5.3){
|
||||
$items['php']['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
|
||||
// //GD库检测
|
||||
// $tmp = function_exists('gd_info') ? gd_info() : array();
|
||||
// if(!$tmp['GD Version']){
|
||||
// $items['gd']['current'] = '未安装';
|
||||
// $items['gd']['icon'] = 'am-text-danger am-icon-close';
|
||||
// session('error', true);
|
||||
// }else{
|
||||
// $items['gd']['current'] = $tmp['GD Version'];
|
||||
// }
|
||||
// unset($tmp);
|
||||
|
||||
//磁盘空间检测
|
||||
if(function_exists('disk_free_space')){
|
||||
$disk_size = floor(disk_free_space('./') / (1024*1024)).'M';
|
||||
$items['disk']['current'] = $disk_size.'B';
|
||||
if($disk_size < 100){
|
||||
$items['disk']['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 目录,文件读写检测
|
||||
* @return array 检测数据
|
||||
* @author jry <598821125@qq.com>
|
||||
*/
|
||||
function check_dirfile(){
|
||||
$items = array(
|
||||
'0' => array(
|
||||
'type' => 'file',
|
||||
'path' => APP_PATH . 'Common/Conf/db.php',
|
||||
'title' => '可写',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
),
|
||||
'1' => array(
|
||||
'type' => 'dir',
|
||||
'path' => APP_PATH . 'Common/Conf',
|
||||
'title' => '可写',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
),
|
||||
'2' => array(
|
||||
'type' => 'dir',
|
||||
'path' => RUNTIME_PATH,
|
||||
'title' => '可写',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($items as &$val){
|
||||
$path = $val['path'];
|
||||
if('dir' === $val['type']){
|
||||
if(!is_writable($path)){
|
||||
if(is_dir($path)) {
|
||||
$val['title'] = '不可写';
|
||||
$val['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}else{
|
||||
$val['title'] = '不存在';
|
||||
$val['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(file_exists($path)){
|
||||
if(!is_writable($path)){
|
||||
$val['title'] = '不可写';
|
||||
$val['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
}else{
|
||||
if(!is_writable(dirname($path))){
|
||||
$val['title'] = '不存在';
|
||||
$val['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数检测
|
||||
* @return array 检测数据
|
||||
*/
|
||||
function check_func_and_ext(){
|
||||
$items = [
|
||||
[
|
||||
'type' => 'ext',
|
||||
'name' => 'pdo',
|
||||
'title' => '支持',
|
||||
'current' => extension_loaded('pdo'),
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
],
|
||||
[
|
||||
'type' => 'ext',
|
||||
'name' => 'mongoDB',
|
||||
'title' => '支持',
|
||||
'current' => extension_loaded('mongo'),
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
],
|
||||
[
|
||||
'type' => 'ext',
|
||||
'name' => 'Redis',
|
||||
'title' => '支持',
|
||||
'current' => extension_loaded('redis'),
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
],
|
||||
[
|
||||
'type' => 'func',
|
||||
'name' => 'file_get_contents',
|
||||
'title' => '支持',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
],
|
||||
[
|
||||
'type' => 'func',
|
||||
'name' => 'mb_strlen',
|
||||
'title' => '支持',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
],
|
||||
[
|
||||
'type' => 'func',
|
||||
'name' => 'shell_exec',
|
||||
'title' => '支持',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
],
|
||||
[
|
||||
'type' => 'com',
|
||||
'name' => 'mongodump',
|
||||
'title' => '支持',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
],
|
||||
[
|
||||
'type' => 'com',
|
||||
'name' => 'mongorestore',
|
||||
'title' => '支持',
|
||||
'icon' => 'am-text-success am-icon-check',
|
||||
]
|
||||
];
|
||||
foreach($items as &$val){
|
||||
switch($val['type']){
|
||||
case 'ext':
|
||||
if(!$val['current']){
|
||||
$val['title'] = '不支持';
|
||||
$val['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
break;
|
||||
case 'func':
|
||||
if(!function_exists($val['name'])){
|
||||
$val['title'] = '不支持';
|
||||
$val['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
break;
|
||||
case 'com':
|
||||
$com = 'which '.$val['name'];
|
||||
if(shell_exec($com) == null){
|
||||
$val['title'] = '不支持';
|
||||
$val['icon'] = 'am-text-danger am-icon-close';
|
||||
session('error', true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入配置文件
|
||||
* @param $config
|
||||
* @param $type string 配置类型
|
||||
* @return bool
|
||||
*/
|
||||
function write_config($config, $type){
|
||||
if(is_array($config)){
|
||||
show_msg('开始写入'.$type.'配置文件');
|
||||
//读取配置内容
|
||||
$conf = file_get_contents(MODULE_PATH . 'Data/'.$type.'.tpl');
|
||||
//替换配置项
|
||||
foreach ($config as $name => $value) {
|
||||
$conf = str_replace("[{$name}]", $value, $conf);
|
||||
}
|
||||
//写入应用配置文件
|
||||
if(file_put_contents(APP_PATH . 'Common/Conf/'.$type.'.php', $conf)){
|
||||
show_msg('配置文件'.$type.'写入成功', 'am-text-success');
|
||||
}else{
|
||||
show_msg('配置文件'.$type.'写入失败!', 'am-text-danger');
|
||||
session('error', true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $msg
|
||||
* @param string $class
|
||||
*/
|
||||
function show_msg($msg, $class = ''){
|
||||
usleep(20000);
|
||||
echo "<script type=\"text/javascript\">showmsg(\"{$msg}\", \"{$class}\")</script>";
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
5
application/install/config.php
Normal file
5
application/install/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
//配置文件
|
||||
return [
|
||||
|
||||
];
|
10
application/install/controller/Index.php
Normal file
10
application/install/controller/Index.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace app\install\controller;
|
||||
|
||||
use think\Controller;
|
||||
|
||||
class Index extends Controller {
|
||||
public function index() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
23
application/install/view/index/index.html
Normal file
23
application/install/view/index/index.html
Normal file
@ -0,0 +1,23 @@
|
||||
{extend name="public/base" /}
|
||||
{block name="title"}系统安装Step1{/block}
|
||||
{block name="nav"}
|
||||
<li class="active"><a href="javascript:;">安装协议</a></li>
|
||||
<li><a href="javascript:;">环境检测</a></li>
|
||||
<li><a href="javascript:;">参数设置</a></li>
|
||||
<li><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">
|
||||
<p>感谢您选择{:config('PRODUCT_NAME')},希望我们的努力能为您提供一个简单、高效、卓越的轻量级产品开发框架。</p>
|
||||
<p>用户须知:本协议是您与{:config('COMPANY_NAME')}之间关于您使用{:config('PRODUCT_NAME')}产品及服务的法律协议。本产品是一个对商业友好的开源项目,您可以随意的进行二次开发,修改和发布。</p>
|
||||
<p>本服务条款一旦发生变更, {:config('COMPANY_NAME')}将在官网上公布修改内容。修改后的服务条款一旦在网站公布即有效代替原来的服务条款。您可随时登陆官网查阅最新版服务条款。如果您选择接受本条款,即表示您同意接受协议各项条件的约束。如果您不同意本服务条款,则不能获得使用本服务的权利。您若有违反本条款规定,{:config('COMPANY_NAME')}有权随时中止或终止您对{:config('PRODUCT_NAME')}产品的使用资格并保留追究相关法律责任的权利。</p>
|
||||
<p>在理解、同意、并遵守本协议的全部条款后,方可开始使用{:config('PRODUCT_NAME')}产品。您也可能与{:config('COMPANY_NAME')}直接签订另一书面协议,以补充或者取代本协议的全部或者任何部分。</p>
|
||||
<p>{:config('COMPANY_NAME')}拥有{:config('PRODUCT_NAME')}的全部知识产权,包括商标和著作权。虽然在大部分情况下您都可以自由的进行修改、复制、下载、安装、使用或者以其他方式受益于本软件的功能或者知识产权。但是{:config('COMPANY_NAME')}还是希望您能在底部保留我们的链接和版权声明!</p>
|
||||
<button type="button" class="btn btn-primary btn-block">同意安装协议</button>
|
||||
<button type="button" class="btn btn-default btn-block">不同意</button>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
92
application/install/view/public/base.html
Normal file
92
application/install/view/public/base.html
Normal file
@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>ApiAdmin | {block name="title"}{/block}</title>
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<link rel="stylesheet" href="__PLUGIN__/bootstrap/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="//cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="__CSS__/AdminLTE.min.css">
|
||||
<link rel="stylesheet" href="__CSS__/skins/_all-skins.min.css">
|
||||
<link rel="icon" href="__IMG__/favicon.ico">
|
||||
<style>
|
||||
body{
|
||||
font-family: "Microsoft YaHei",FontAwesome,sans-serif;
|
||||
}
|
||||
.builder-data-empty {
|
||||
margin-bottom: 20px;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
.no-data {
|
||||
padding: 130px 0;
|
||||
color: #555;
|
||||
}
|
||||
.am-text-center {
|
||||
text-align: center !important;
|
||||
}
|
||||
a{
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="__PLUGIN__/compatible/html5shiv.js"></script>
|
||||
<script src="__PLUGIN__/compatible/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<!-- ADD THE CLASS layout-top-nav TO REMOVE THE SIDEBAR. -->
|
||||
<body class="hold-transition skin-blue layout-top-nav">
|
||||
<div class="wrapper">
|
||||
|
||||
<header class="main-header">
|
||||
<nav class="navbar navbar-static-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a href="{:config('WEBSITE_DOMAIN')}" class="navbar-brand"><b>Api</b>Admin</a>
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
|
||||
<i class="fa fa-bars"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
{block name="nav"}{/block}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="content-wrapper">
|
||||
<div class="container">
|
||||
<section class="content" style="width: 70%">
|
||||
{block name="main"}{/block}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="main-footer">
|
||||
<div class="container">
|
||||
<div class="pull-right hidden-xs">
|
||||
<b>Version</b> {:config('PRODUCT_VERSION')}
|
||||
</div>
|
||||
<strong>Copyright © 2015-{:date('Y')} Copyright © 2014-{:date('Y')} <a href="{:config('WEBSITE_DOMAIN')}">{:config('COMPANY_NAME')}</a>.</strong> All rights
|
||||
reserved.
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<!-- jQuery 2.2.3 -->
|
||||
<script src="__PLUGIN__/jQuery/2.2.4/jquery.min.js"></script>
|
||||
<!-- Bootstrap 3.3.6 -->
|
||||
<script src="__PLUGIN__/bootstrap/js/bootstrap.min.js"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="__PLUGIN__/fastClick/fastclick.js"></script>
|
||||
<!-- slimScroll -->
|
||||
<script src="__PLUGIN__/slimScroll/jquery.slimscroll.min.js"></script>
|
||||
<!-- BootBox -->
|
||||
<script src="__PLUGIN__/bootBox/bootbox.min.js"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="__JS__/app.min.js"></script>
|
||||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="__JS__/demo.js"></script>
|
||||
</body>
|
||||
</html>
|
17
public/admin/install.php
Normal file
17
public/admin/install.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// [ 应用入口文件 ]
|
||||
define('BIND_MODULE','install');
|
||||
// 定义应用目录
|
||||
define('APP_PATH', __DIR__ . '/../../application/');
|
||||
// 加载框架引导文件
|
||||
require __DIR__ . '/../../thinkphp/start.php';
|
Loading…
x
Reference in New Issue
Block a user