3.8.1
This commit is contained in:
19
public/install/_error.php
Normal file
19
public/install/_error.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php defined('PHALAPI_INSTALL') || die('no access'); ?>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_header.php'; ?>
|
||||
<div class="radius bg bouncein window window_small">
|
||||
<div class="window_title t_error">
|
||||
<span class="icon-circle"> </span>
|
||||
<span class="icon-circle"></span>
|
||||
<span class="margin-small-left">错误提示</span>
|
||||
</div>
|
||||
<div class="padding-large text-black">
|
||||
<h1 class="margin-small-bottom" >PhalApi专业版安装遇到问题</h1>
|
||||
<h4><?php echo $error ?></h4>
|
||||
<hr>
|
||||
<div class="margin-big-top" >
|
||||
<a class="button bg-yellow margin-small-right" href="/install/" role="button"> 重新安装 </a>
|
||||
<button class="button">联系我们</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_footer.php'; ?>
|
||||
13
public/install/_footer.php
Normal file
13
public/install/_footer.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php defined('PHALAPI_INSTALL') || die('no access'); ?>
|
||||
|
||||
<footer class="footer margin-top">
|
||||
<p class="text-white text-little">©2018-<?= date('Y') ?> <a class="text-yellow text-little" href="http://pro.yesapi.cn/" target="_blank">PhalApi Pro</a> All Rights Reserved. 粤ICP备19016086号</p>
|
||||
</footer>
|
||||
|
||||
</div> <!-- /container -->
|
||||
|
||||
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<!-- <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> -->
|
||||
</body>
|
||||
</html>
|
||||
59
public/install/_header.php
Normal file
59
public/install/_header.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php defined('PHALAPI_INSTALL') || die('no access'); ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<title>快速安装 - PhalApi Pro 专业版</title>
|
||||
<link href="./static/css/pintuer.css" rel="stylesheet">
|
||||
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
|
||||
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
|
||||
<!-- <script src="../../assets/js/ie-emulation-modes-warning.js"></script> -->
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<style>
|
||||
|
||||
body{
|
||||
background-color:#333;
|
||||
color: #fff;
|
||||
}
|
||||
.window{
|
||||
height: auto; margin: 0px auto;margin-top: 50px
|
||||
}
|
||||
.window_big{
|
||||
width: 800px;
|
||||
}
|
||||
.window_small{
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.window_title{
|
||||
border-radius: 4px 4px 0px 0px;padding: 20px;
|
||||
}
|
||||
.t_normal{
|
||||
background-color: #FCB244 !important;
|
||||
}
|
||||
.t_error{
|
||||
background-color: #DE4E4E
|
||||
}
|
||||
.t_success{
|
||||
background-color: #7AC997
|
||||
}
|
||||
.footer{text-align: center;color: #333;}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
35
public/install/_start.php
Normal file
35
public/install/_start.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php defined('PHALAPI_INSTALL') || die('no access'); ?>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_header.php'; ?>
|
||||
<div class="radius bg bouncein window window_small" >
|
||||
<div class="window_title t_normal">
|
||||
<span class="icon-circle"> </span>
|
||||
<span class="icon-circle"></span>
|
||||
<span class="margin-small-left">安装向导</span>
|
||||
</div>
|
||||
<div class="padding-large text-black">
|
||||
<h1 class="margin-small-bottom" >欢迎使用,PhalApi Pro 安装向导</h1>
|
||||
<h5 class="margin-big-bottom ">一款开发和管理接口的超级框架!</h5>
|
||||
<div class="input padding bg-white" style="width: 100%;height: 200px; overflow: auto">
|
||||
<h4 class="margin-small-bottom">协议许可的权利</h4>
|
||||
<p>PhalApi Pro 接口开发框架专业版软件(以下简称PhalApi Pro),是一套专注搭建企业开放平台的系统软件,基于PHP+MySQL,由广州果创网络科技有限公司(以下简称广州果创)自主研发的软件。使用者需仔细阅读本协议,在理解、同意、并遵守本协议的全部条款后,并通过PhalApi Pro 官网<a href="http://pro.yesapi.cn/">http://pro.yesapi.cn</a>成功购买后,方可开始使用 PhalApi Pro 软件,并用于商业用途的项目开发。</p>
|
||||
<br>
|
||||
|
||||
<h4 class="margin-small-bottom">协议规定的约束和限制</h4>
|
||||
<p>PhalApi Pro,应当在成功购买并授权后使用,本产品由广州果创网络科技有限公司自主研发并拥有软件著作权,未经授权,禁止用于商业用途。未经广州果创书面授权,用户不能以任何目的(包括学习或研究等目的),以任何方式和媒介复制、转载和传播本软件源代码提供给第三人或公众使用。无论用途如何,是否经过修改,修改程度如何,未经过许可,PHP、Javascript和HTML源代码中关于PhalApi Pro的版权信息及作者信息必须保留,不许修改或删除,除非您获得广州果创的许可。 </p>
|
||||
<p>如果您未能遵守本协议的条款,您的授权将被终止,所被许可的权利将被收回,并承担相应法律责任。 </p>
|
||||
<br>
|
||||
|
||||
<h4 class="margin-small-bottom">有限担保和免责声明</h4>
|
||||
<p>本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的。 用户出于自愿付费使用本软件,您必须了解使用本软件的风险,在尚未购买产品技术服务之前,我们不承诺提供任何形式的技术支持、使用担保,也不承担任何因使用本软件而产生问题的相关责任。广州果创不对使用本软件及官网发布的衍生产品构建的软件中的文章或信息承担责任。 </p>
|
||||
<p>有关 PhalApi Pro 的最终用户授权协议、商业授权与技术服务的详细内容,均由广州果创独家提供。广州果创拥有在不事先通知的情况下,修改授权协议和服务价目表的权力,修改后的协议或价目表对自改变之日起的新授权用户生效。 电子文本形式的授权协议如同双方书面签署的协议一样,具有完全的和等同的法律效力。您一旦开始安装 PhalApi Pro,即被视为完全理解并接受本协议的各项条款,在享有上述条款授予的权力的同时,受到相关的约束和限制。 协议许可范围以外的行为,将直接违反本授权协议并构成侵权,我们有权随时终止授权,责令停止损害,并保留追究相关责任的权力。 </p>
|
||||
<p>本授权协议适用于 <a href="http://pro.yesapi.cn/">http://pro.yesapi.cn/</a> 发布的产品,广州果创拥有对本授权协议的最终解释权。 </p>
|
||||
|
||||
</div>
|
||||
<div class="margin-big-top" >
|
||||
<a class="button bg-yellow margin-small-right" href=".?step=1" role="button"> 同意安装 </a>
|
||||
<button class="button">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_footer.php'; ?>
|
||||
42
public/install/_step1.php
Normal file
42
public/install/_step1.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php defined('PHALAPI_INSTALL') || die('no access'); ?>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_header.php'; ?>
|
||||
<div class="radius bg bouncein window window_big">
|
||||
<div class="window_title t_normal">
|
||||
<span class="icon-circle"> </span>
|
||||
<span class="icon-circle"></span>
|
||||
<span class="margin-small-left">安装向导</span>
|
||||
</div>
|
||||
<div class="padding-large text-black">
|
||||
<h1 class="margin-small-bottom" >PhalApi Pro 环境检查</h1>
|
||||
<h5 class="margin-big-bottom ">为了确保PhalApi Pro 专业版能正常使用, 您的服务器需要满足以下系统需求的运行环境。</h5>
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<?php $num = 0; ?>
|
||||
<?php foreach ($checkList as $item) { ?>
|
||||
<tr class="<?php if ($item['status'] == -1) echo 'alert alert-danger'; else if ($item['status'] == 1) echo 'alert alert-success';?>">
|
||||
<th style="vertical-align : middle;" align="center" scope="row"><?php echo ++ $num; ?></th>
|
||||
<th style="vertical-align : middle;"><?php echo $item['name']; ?></th>
|
||||
<td style="vertical-align : middle; font-size: 12px"><?php echo $item['tip']; ?></td>
|
||||
<td align="center" style="vertical-align : middle;"><?php
|
||||
if ($item['status'] == 1) {
|
||||
echo '<span aria-hidden="true" class="text-green icon-check-circle"></span>';
|
||||
} else {
|
||||
echo '<span aria-hidden="true" class="text-red icon-times-circle"></span>';
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><small>安装前,可手动执行脚本:./bin/install_check.sh,添加必要的目录写入权限。</small></p>
|
||||
|
||||
<div class="margin-big-top" >
|
||||
<a class="button bg-yellow margin-small-right" href=".?step=2" role="button"> 下一步 </a>
|
||||
<a class="button margin-small-right" href=".?step=0" role="button"> 上一步 </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_footer.php'; ?>
|
||||
144
public/install/_step2.php
Normal file
144
public/install/_step2.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php defined('PHALAPI_INSTALL') || die('no access'); ?>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_header.php'; ?>
|
||||
|
||||
<div class="radius bg bouncein window window_big">
|
||||
<div class="window_title t_normal" >
|
||||
<span class="icon-circle"> </span>
|
||||
<span class="icon-circle"></span>
|
||||
<span class="margin-small-left">安装向导</span>
|
||||
</div>
|
||||
<div class="padding-large text-black">
|
||||
<h1 class="margin-small-bottom" >PhalApi Pro 初始化配置</h1>
|
||||
<h5 class="margin-big-bottom ">需要您提供必要的系统配置信息,当前域名/IP:<?= $_SERVER['HTTP_HOST'] ?><small>(授权后方可用于商业用途,<a href="http://pro.yesapi.cn/index.php?r=site%2Fquery" target="_blank">官方授权查询</a>)</small></h5>
|
||||
<hr>
|
||||
<form class="form-horizontal" action="./?step=3" method="POST" >
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="project"><font color="red">*</font> 当前域名/IP(授权后方可用于商业用途)</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="auth_host" size="30" placeholder="必填" value="<?= $_SERVER['HTTP_HOST'] ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="project_name"> 项目名称(安装后的网站名称)</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="project_name" size="30" placeholder="项目名称,设置后仍可通过配置修改" value="果果云" />
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="host">MySQL数据库服务器</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="host" size="30" placeholder="通常为 localhost或127.0.0.1" value="127.0.0.1" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="user">MySQL数据库帐号</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="user" size="30" placeholder="通常为 root" value="root" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="username">MySQL数据库密码</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="password" class="input" name="password" size="30" placeholder=""/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="port">MySQL数据库端口</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="port" size="30" placeholder="一般情况下不需要修改" value="3306"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="name">MySQL数据库名称 <font color="red">(请注意:开始安装后将会清除旧的数据库表!推荐使用新数据库。)</font></label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="name" size="30" placeholder="数据库不存在时需要先创建" value="phalapi_pro"/>
|
||||
<!-- <small><input type="checkbox" name="is_create_new_db" value="1" checked /> 同时创建新数据库</small> -->
|
||||
<!-- <small>创建数据库:CREATE DATABASE phalapi_pro DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;</small> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="prefix">MySQL数据库表前缀</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="prefix" size="30" placeholder="同数据库安装多个本程序时需要更改" value="pp_"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="admin_user"><font color="red">*</font> 管理员账号</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="text" class="input" name="admin_user" size="30" placeholder="管理后台的管理员账号" value="admin" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="label">
|
||||
<label for="admin_pass"><font color="red">*</font> 管理员密码(默认密码:123456)</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input type="password" class="input" name="admin_pass" size="30" placeholder="管理后台的管理员密码,至少需要6位以上" value="123456" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group"> -->
|
||||
<!-- <div class="label"> -->
|
||||
<!-- <label for="charset">数据库编码</label> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="field"> -->
|
||||
<!-- <input type="text" class="input" name="charset" size="30" placeholder="一般情况下不需要修改" value="UTF8"/> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<!-- <hr>-->
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <div class="label">-->
|
||||
<!-- <label for="db_engine">接口签名方案</label>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="field">-->
|
||||
<!-- <select name="db_engine" class="form-control"><option value="zh_cn">无接口签名验证</option><option value="en">MD5验签</option>><option value="en">自定义难签</option></select>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <hr>-->
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <div class="label">-->
|
||||
<!-- <label for="db_engine">翻译语言</label>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="field">-->
|
||||
<!-- <select name="db_engine" class="form-control"><option value="zh_cn">中文</option><option value="en">English</option></select> </div>-->
|
||||
<!-- </div>-->
|
||||
<hr>
|
||||
<div class="margin-big-top" >
|
||||
<button type="submit" class="button bg-yellow margin-small-right" name="doSubmit" value="ok" > 开始安装 </button>
|
||||
<a class="button margin-small-right" href="./?step=1" role="button"> 上一步 </a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_footer.php'; ?>
|
||||
20
public/install/_step3.php
Normal file
20
public/install/_step3.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php defined('PHALAPI_INSTALL') || die('no access'); ?>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_header.php'; ?>
|
||||
|
||||
<div class="radius bg bouncein window window_small">
|
||||
<div class="window_title t_success">
|
||||
<span class="icon-circle"> </span>
|
||||
<span class="icon-circle"></span>
|
||||
<span class="margin-small-left">安装完成</span>
|
||||
</div>
|
||||
<div class="padding-large text-black">
|
||||
<h1 class="margin-small-bottom" >恭喜您,PhalApi Pro 已安装成功!</h1>
|
||||
<h4 class="margin-big-bottom">接下来,可以开始使用啦,成功安装后请删除./public/install目录。</h4>
|
||||
<hr>
|
||||
<div class="margin-big-top" >
|
||||
<a target="_blank" href="/" class="button bg-yellow margin-left">进入首页</a>
|
||||
<a target="_blank" href="/api/app.php?s=App.HelloWorld.Say" class="button bg-green">测试接口</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . '_footer.php'; ?>
|
||||
289
public/install/index.php
Normal file
289
public/install/index.php
Normal file
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
// ---------------------------------------------------------------------------------
|
||||
// _____ _ _ _ _____
|
||||
// | __ \ | | | | /\ (_) | __ \
|
||||
// | |__) || |__ __ _ | | / \ _ __ _ | |__) |_ __ ___
|
||||
// | ___/ | '_ \ / _` || | / /\ \ | '_ \ | | | ___/| '__|/ _ \
|
||||
// | | | | | || (_| || | / ____ \ | |_) || | | | | | | (_) |
|
||||
// |_| |_| |_| \__,_||_|/_/ \_\| .__/ |_| |_| |_| \___/
|
||||
// | |
|
||||
// |_|
|
||||
// PhalApi Pro 专业版
|
||||
// 广州果创网络科技有限公司
|
||||
//
|
||||
// ---------------------------------------------------------------------------------
|
||||
//
|
||||
// 一、协议的许可和权利
|
||||
// 1. 您可以在完全遵守本协议的基础上,将本软件应用于商业用途;
|
||||
// 2. 您可以在协议规定的约束和限制范围内修改本产品源代码或界面风格以适应您的要求;
|
||||
// 3. 您拥有使用本产品中的全部内容资料、商品信息及其他信息的所有权,并独立承担与其内容相关的
|
||||
// 法律义务;
|
||||
// 4. 获得商业授权之后,您可以将本软件应用于商业用途,自授权时刻起,在技术支持期限内拥有通过
|
||||
// 指定的方式获得指定范围内的技术支持服务;
|
||||
//
|
||||
// 二、协议的约束和限制
|
||||
// 1. 未获商业授权之前,禁止将本软件用于商业用途(包括但不限于企业法人经营的产品、经营性产品
|
||||
// 以及以盈利为目的或实现盈利产品);
|
||||
// 2. 未获商业授权之前,禁止在本产品的整体或在任何部分基础上发展任何派生版本、修改版本或第三
|
||||
// 方版本用于重新开发;
|
||||
// 3. 如果您未能遵守本协议的条款,您的授权将被终止,所被许可的权利将被收回并承担相应法律责任;
|
||||
//
|
||||
// 三、有限担保和免责声明
|
||||
// 1. 本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的;
|
||||
// 2. 用户出于自愿而使用本软件,您必须了解使用本软件的风险,在尚未获得商业授权之前,我们不承
|
||||
// 诺提供任何形式的技术支持、使用担保,也不承担任何因使用本软件而产生问题的相关责任;
|
||||
// 3. 广州果创网络科技有限公司不对使用本产品构建的商城中的内容信息承担责任,但在不侵犯用户隐
|
||||
// 私信息的前提下,保留以任何方式获取用户信息及商品信息的权利;
|
||||
//
|
||||
// 有关本产品最终用户授权协议、商业授权与技术服务的详细内容,均由广州果创网络科技有限公司独家
|
||||
// 提供。广州果创网络科技有限公司拥有在不事先通知的情况下,修改授权协议的权力,修改后的协议对
|
||||
// 改变之日起的新授权用户生效。电子文本形式的授权协议如同双方书面签署的协议一样,具有完全的和
|
||||
// 等同的法律效力。您一旦开始修改、安装或使用本产品,即被视为完全理解并接受本协议的各项条款,
|
||||
// 在享有上述条款授予的权力的同时,受到相关的约束和限制。协议许可范围以外的行为,将直接违反本
|
||||
// 授权协议并构成侵权,我们有权随时终止授权,责令停止损害,并保留追究相关责任的权力。
|
||||
//
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'On');
|
||||
|
||||
define('PHALAPI_INSTALL', TRUE);
|
||||
define('D_S', DIRECTORY_SEPARATOR);
|
||||
|
||||
$step = isset($_GET['step']) ? intval($_GET['step']) : 0;
|
||||
|
||||
$runtimePath = dirname(__FILE__) . implode(D_S, array('', '..', '..', 'runtime'));
|
||||
if (file_exists($runtimePath . D_S . '_install.lock')) {
|
||||
$error = '项目已安装,请不要重复安装。<br/>成功安装 后,建议手动删除 ./public/install目录。<br/>如果需要安装,请手动删除./runtime/_install.lock文件。';
|
||||
include dirname(__FILE__) . D_S . '_error.php';
|
||||
exit(0);
|
||||
}
|
||||
|
||||
switch ($step) {
|
||||
//第一步:环境检测
|
||||
case 1:
|
||||
//-1:必须但不支持 0:可选但不支持 1:完美支持
|
||||
$checkList = array(
|
||||
'php' => array('name' => 'PHP 版本', 'status' => -1, 'tip' => '建议使用PHP 5.3.3及以上版本,推荐使用PHP 7'),
|
||||
'opcache' => array('name' => 'Opcache', 'status' => -1, 'tip' => '开启opcache后,将无法生成在线接口文档,需要设置opcache.enable=0关闭opcache'),
|
||||
'pdo' => array('name' => '数据库模块', 'status' => -1, 'tip' => '建议使用PDO扩展,否则NotORM无法使用PDO进行数据库操作'),
|
||||
//'memcache' => array('name' => 'Memcache扩展', 'status' => 0, 'tip' => '无此扩展时,不能使用Memcache缓存'),
|
||||
//'mcrypt' => array('name' => 'Mcrypt扩展', 'status' => 0, 'tip' => '无此扩展时,不能使用mcrypt进行加密处理'),
|
||||
'config' => array('name' => '配置目录权限', 'status' => -1, 'tip' => '配置文件目录缺少写入权限,无法写入配置,将会导致安装失败,需要手动添加写入权限。'),
|
||||
'runtime' => array('name' => '运行时目录权限', 'status' => -1, 'tip' => '运行时目录缺少写入权限,将不能写入日记和进行文件缓存,需要手动添加写入权限。'),
|
||||
'uploads' => array('name' => '文件上传目录权限', 'status' => -1, 'tip' => '文件上传目录缺少写入权限,将不能上传文件,需要手动添加写入权限。'),
|
||||
);
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.3.3', '>=')) {
|
||||
$checkList['php']['status'] = 1;
|
||||
}
|
||||
if (class_exists('PDO', false) && extension_loaded('PDO')) {
|
||||
$checkList['pdo']['status'] = 1;
|
||||
}
|
||||
|
||||
if (ini_get('opcache.enable') === false || ini_get('opcache.enable') == '0') {
|
||||
$checkList['opcache']['status'] = 1;
|
||||
}
|
||||
// if (class_exists('Memcache', false) && extension_loaded('memcache')) {
|
||||
// $checkList['memcache']['status'] = 1;
|
||||
// }
|
||||
// if (extension_loaded('mcrypt')) {
|
||||
// $checkList['mcrypt']['status'] = 1;
|
||||
// }
|
||||
$runtimePath = dirname(__FILE__) . implode(D_S, array('', '..', '..', 'runtime'));
|
||||
$runtimePath = file_exists($runtimePath) ? realpath($runtimePath) : $runtimePath;
|
||||
$checkList['runtime']['tip'] = $runtimePath . '<br>' . $checkList['runtime']['tip'];
|
||||
if (is_writeable($runtimePath)) {
|
||||
$checkList['runtime']['status'] = 1;
|
||||
}
|
||||
|
||||
$configPath = dirname(__FILE__) . implode(D_S, array('', '..', '..', 'config'));
|
||||
$configPath = file_exists($configPath) ? realpath($configPath) : $configPath;
|
||||
$checkList['config']['tip'] = $configPath . '<br>' . $checkList['config']['tip'];
|
||||
if (is_writeable($configPath)) {
|
||||
$checkList['config']['status'] = 1;
|
||||
}
|
||||
|
||||
$publicPath = dirname(__FILE__) . implode(D_S, array('', '..', '..', 'public', 'uploads'));
|
||||
$publicPath = file_exists($publicPath) ? realpath($publicPath) : $publicPath;
|
||||
$checkList['uploads']['tip'] = $publicPath . '<br>' . $checkList['uploads']['tip'];
|
||||
if (is_writable($publicPath)) {
|
||||
$checkList['uploads']['status'] = 1;
|
||||
}
|
||||
|
||||
include dirname(__FILE__) . D_S . '_step1.php';
|
||||
break;
|
||||
//第2步:系统配置
|
||||
case 2:
|
||||
include dirname(__FILE__) . D_S . '_step2.php';
|
||||
break;
|
||||
//第3步:接口请求
|
||||
case 3:
|
||||
if (empty($_POST['doSubmit']) || empty($_POST)) {
|
||||
header('Location: ./?step=1');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//数据库配置文件
|
||||
$search = array(
|
||||
'{project}',
|
||||
'{host}',
|
||||
'{name}',
|
||||
'{user}',
|
||||
'{password}',
|
||||
'{port}',
|
||||
'{charset}',
|
||||
'{prefix}',
|
||||
);
|
||||
$replace = array(
|
||||
'phalapi_pro',
|
||||
$_POST['host'],
|
||||
$_POST['name'],
|
||||
$_POST['user'],
|
||||
$_POST['password'],
|
||||
$_POST['port'],
|
||||
'utf8mb4', // $_POST['charset'],
|
||||
$_POST['prefix'],
|
||||
);
|
||||
$configDbsContent = str_replace($search, $replace, getConfigDbsTpl());
|
||||
file_put_contents(
|
||||
dirname(__FILE__) . implode(D_S, array('', '..', '..', 'config', 'dbs.php')),
|
||||
$configDbsContent
|
||||
);
|
||||
|
||||
// 应用配置
|
||||
$appCfgFile = dirname(__FILE__) . implode(D_S, array('', '..', '..', 'config', 'app.php'));
|
||||
$configAppContent = str_replace(
|
||||
array('*#FD2F9DM~E*', '9DfnseJ%sD#', '果果云'),
|
||||
array(createRandStr(12), createRandStr(12), !empty($_POST['project_name']) ? str_replace("'", '', $_POST['project_name']) : '果果云'),
|
||||
file_get_contents($appCfgFile)
|
||||
);
|
||||
@file_put_contents($appCfgFile, $configAppContent);
|
||||
|
||||
// 创建数据库
|
||||
$sql = "CREATE DATABASE IF NOT EXISTS {$_POST['name']} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;";
|
||||
sqlExcute($_POST['host'] . ':' . $_POST['port'], $_POST['user'], $_POST['password'], $sql);
|
||||
|
||||
// 导入数据库
|
||||
$sqlFile = dirname(__FILE__) . implode(D_S, array('', '..', '..', 'data', 'phalapi_pro.sql'));
|
||||
require_once dirname(__FILE__) . implode(D_S, array('', '..', '..', 'public', 'init.php'));
|
||||
$sqlContent = str_replace('`pp_', '`' . $_POST['prefix'], file_get_contents($sqlFile));
|
||||
$sqlArr = explode(";\n", str_replace(";\r\n", ";\n", $sqlContent)); // 兼容windows系统的换行
|
||||
|
||||
// 开启调试,避免安装过程中连接不上,可以相撞看原因
|
||||
\PhalApi\DI()->debug = true;
|
||||
|
||||
foreach ($sqlArr as $sql) {
|
||||
$sql = trim($sql);
|
||||
if (empty($sqlArr)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
\PhalApi\DI()->notorm->demo->executeSql($sql);
|
||||
} catch (Exception $ex) {
|
||||
$error = $ex->getTraceAsString();
|
||||
$error = $ex->getMessage() . '<hr/>' . str_replace("\n", '<br />', $error);
|
||||
include dirname(__FILE__) . D_S . '_error.php';
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
// 创建管理员
|
||||
$userDomain = new \Base\Domain\User();
|
||||
$userDomain->register($_POST['admin_user'], $_POST['admin_pass'], '', '超级管理员', '', 0, '', \Base\Domain\UserType::MEMBER_LEVEL_SUPER_ADMIN);
|
||||
|
||||
touch($runtimePath . D_S . '_install.lock');
|
||||
|
||||
//请求链接
|
||||
$apiUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/docs.php';
|
||||
include dirname(__FILE__) . D_S . '_step3.php';
|
||||
break;
|
||||
default:
|
||||
include dirname(__FILE__) . D_S . '_start.php';
|
||||
}
|
||||
|
||||
function createRandStr($len, $chars = null) {
|
||||
if (!$chars) {
|
||||
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
}
|
||||
|
||||
return substr(str_shuffle(str_repeat($chars, rand(5, 8))), 0, $len);
|
||||
}
|
||||
|
||||
function getConfigDbsTpl() {
|
||||
$configDbs = <<<EOT
|
||||
<?php
|
||||
/**
|
||||
* 分库分表的自定义数据库路由配置
|
||||
*
|
||||
* @license http://www.phalapi.net/license GPL 协议
|
||||
* @link http://www.phalapi.net/
|
||||
* @author: dogstar <chanzonghuang@gmail.com> 2015-02-09
|
||||
*/
|
||||
|
||||
return array(
|
||||
/**
|
||||
* DB数据库服务器集群
|
||||
*/
|
||||
'servers' => array(
|
||||
'db_master' => array( //服务器标记
|
||||
'host' => '{host}', //数据库域名
|
||||
'name' => '{name}', //数据库名字
|
||||
'user' => '{user}', //数据库用户名
|
||||
'password' => '{password}', //数据库密码
|
||||
'port' => '{port}', //数据库端口
|
||||
'charset' => '{charset}', //数据库字符集
|
||||
'pdo_attr_string' => false, // 数据库查询结果统一使用字符串,true是,false否
|
||||
'driver_options' => array( // PDO初始化时的连接选项配置
|
||||
// 若需要更多配置,请参考官方文档:https://www.php.net/manual/zh/pdo.constants.php
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
/**
|
||||
* 自定义路由表
|
||||
*/
|
||||
'tables' => array(
|
||||
//通用路由
|
||||
'__default__' => array(
|
||||
'prefix' => '{prefix}',
|
||||
'key' => 'id',
|
||||
'map' => array(
|
||||
array('db' => 'db_master'),
|
||||
),
|
||||
),
|
||||
|
||||
/**
|
||||
'demo' => array( //表名
|
||||
'prefix' => '', //表名前缀
|
||||
'key' => 'id', //表主键名
|
||||
'map' => array( //表路由配置
|
||||
array('db' => 'db_master'), //单表配置:array('db' => 服务器标记)
|
||||
array('start' => 0, 'end' => 2, 'db' => 'db_master'), //分表配置:array('start' => 开始下标, 'end' => 结束下标, 'db' => 服务器标记)
|
||||
),
|
||||
),
|
||||
*/
|
||||
),
|
||||
);
|
||||
|
||||
EOT;
|
||||
|
||||
return $configDbs;
|
||||
}
|
||||
|
||||
|
||||
function sqlExcute($servername, $username, $password, $sql)
|
||||
{
|
||||
// 创建连接
|
||||
$conn = mysqli_connect($servername, $username, $password);
|
||||
// 检测连接
|
||||
if ($conn) {
|
||||
// 执行sql
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
return true;
|
||||
}
|
||||
$conn->close();
|
||||
// die("Connection failed: " . mysqli_connect_error());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
1079
public/install/static/css/pintuer.css
Normal file
1079
public/install/static/css/pintuer.css
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user