Skip to content

Commit 26f5b75

Browse files
committed
1、修复PHP7中mysql_get_server_info无法获取mysql版本号造成安装第一步环境检测无法通过的BUG
2、框架类库schema.php增加获取mysql版本号的方法
1 parent bca74ac commit 26f5b75

File tree

8 files changed

+40
-22
lines changed

8 files changed

+40
-22
lines changed

application/admin/controller/index.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace app\admin\controller;
44

5+
use gophp\schema;
6+
57
class index extends auth {
68

79
public function index(){
@@ -11,7 +13,9 @@ public function index(){
1113
$last_login = \app\user::get_last_login();
1214

1315
$system = [
14-
'version' => GOPHP_VERSION,
16+
'gophp_version' => GOPHP_VERSION,
17+
'php_version' => PHP_OS,
18+
'mysql_version' => schema::instance()->version(),
1519
];
1620

1721
$this->assign('user', $user);

application/admin/view/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h1 class="page-header">管理中心</h1>
3535
<div class="row text-center">
3636
<div class="col-xs-4">
3737
<i class="fa fa-user fa-4x"></i>
38-
<span>会员</span>
38+
<div>会员</div>
3939
</div>
4040
<div class="col-xs-8">
4141
<div class="huge">{{\app\statistics::get_all_num('user')}}</div>
@@ -52,7 +52,7 @@ <h1 class="page-header">管理中心</h1>
5252
<div class="row text-center">
5353
<div class="col-xs-4">
5454
<i class="fa fa-th fa-4x"></i>
55-
<span>项目</span>
55+
<div>项目</div>
5656
</div>
5757
<div class="col-xs-8">
5858
<div class="huge">{{\app\statistics::get_all_num('project')}}</div>
@@ -69,7 +69,7 @@ <h1 class="page-header">管理中心</h1>
6969
<div class="row text-center">
7070
<div class="col-xs-4">
7171
<i class="fa fa-folder-open fa-4x"></i>
72-
<span>模块</span>
72+
<div>模块</div>
7373
</div>
7474
<div class="col-xs-8">
7575
<div class="huge">{{\app\statistics::get_all_num('module')}}</div>
@@ -86,7 +86,7 @@ <h1 class="page-header">管理中心</h1>
8686
<div class="row text-center">
8787
<div class="col-xs-4">
8888
<i class="fa fa-files-o fa-4x"></i>
89-
<span>接口</span>
89+
<div>接口</div>
9090
</div>
9191
<div class="col-xs-8">
9292
<div class="huge">{{\app\statistics::get_all_num('api')}}</div>
@@ -145,8 +145,8 @@ <h1 class="page-header">管理中心</h1>
145145
</div>
146146
<!-- /.panel-heading -->
147147
<div class="panel-body">
148-
<p>程序版本:V{{$system.version}} [<a href="https://github.com/gouguoyin/phprap" target="_blank">查看最新版本</a>]</p>
149-
<p>服务器环境:{{PHP_OS}}</p>
148+
<p>程序版本:V{{$system.gophp_version}} [<a href="https://github.com/gouguoyin/phprap" target="_blank">查看最新版本</a>]</p>
149+
<p>服务器环境:{{$system.php_version}}+{{$system.mysql_version}}</p>
150150
<p>使用技术:PHP+MySQL+Bootstrap+JQuery</p>
151151
<p>系统开发:<a target="_blank" href="http://www.gouguoyin.cn/about.html">勾国印</a></p>
152152
<p>帮助中心:<a target="_blank" href="https://github.com/gouguoyin/apidoc/blob/master/README.md">help.gouguoyin.cn</a></p>

application/home/controller/project.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public function search()
287287

288288
$where = $where ? ' where ' . $where : '';
289289

290-
$sql = "select * from $table_name $where";
290+
$sql = "select * from $table_name $where order by id desc";
291291

292292
$total = count($db->show(false)->query($sql));
293293

application/home/controller/test.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ class test {
2121
* 添加/编辑字段
2222
*/
2323
public function index(){
24+
$a =schema::instance();
2425

25-
$project_id = 3;
26+
$b = $a->version();
2627

27-
$module_ids = db('module')->where('project_id', '=', $project_id)->column('id');
28+
dump($b);
2829

29-
$module_ids = $module_ids ? $module_ids : 0;
30-
31-
$a= db('api')->show(false)->where('module_id', 'in', $module_ids)->count();
32-
33-
34-
dump($a);
3530

3631

3732

application/home/view/public/nav.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
22
<div class="navbar-header">
3-
<button type="button" class="navbar-toggle hidden-xs" data-toggle="collapse" data-target=".navbar-collapse">
3+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
44
<span class="sr-only">Toggle navigation</span>
55
<span class="icon-bar"></span>
66
<span class="icon-bar"></span>

application/install/controller/step1.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use gophp\request;
66
use gophp\response;
7+
use gophp\schema;
78

89
class step1 extends auth {
910

@@ -37,11 +38,18 @@ public function index(){
3738

3839
session('step', 1);
3940

41+
$system = [
42+
'php_os' => PHP_OS,
43+
'php_version' => PHP_VERSION,
44+
'mysql_version' => schema::instance()->version(),
45+
];
46+
4047
$chmod['runtime'] = get_dir_chmod(ROOT_PATH.'/runtime/');
4148
$chmod['compile'] = get_dir_chmod(RUNTIME_PATH.'/compile');
4249
$chmod['config'] = get_dir_chmod(RUNTIME_PATH.'/config/');
4350
$chmod['log'] = get_dir_chmod(RUNTIME_PATH.'/log/');
4451

52+
$this->assign('system', $system);
4553
$this->assign('chmod', $chmod);
4654
$this->display('step1');
4755

application/install/view/step1.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ <h3 class="panel-title text-center">安装步骤一</h3>
3636
<tbody>
3737
<tr>
3838
<td>操作系统</td>
39-
<td>{{PHP_OS}}</td>
39+
<td>{{$system.php_os}}</td>
4040
<td>Linux</td>
4141
<td><i class="fa fa-check"></i></td>
4242
</tr>
4343
<tr>
4444
<td>PHP版本</td>
45-
<td>{{PHP_VERSION}}</td>
45+
<td>{{$system.php_version}}</td>
4646
<td>>=5.4.0</td>
4747
<td>
48-
{{if version_compare( PHP_VERSION, '5.4.0', '>=' )}}
48+
{{if version_compare( $system.php_version, '5.4.0', '>=' )}}
4949
<i class="fa fa-check"></i>
5050
{{else}}
5151
<i class="fa fa-times"></i>
@@ -55,10 +55,10 @@ <h3 class="panel-title text-center">安装步骤一</h3>
5555
</tr>
5656
<tr>
5757
<td>MySQL版本</td>
58-
<td>{{mysql_get_server_info()}}</td>
58+
<td>{{$system.mysql_version}}</td>
5959
<td>>=5.1.0</td>
6060
<td>
61-
{{if version_compare( mysql_get_server_info(), '5.1.0', '>=' )}}
61+
{{if version_compare( $system.mysql_version, '5.1.0', '>=' )}}
6262
<i class="fa fa-check"></i>
6363
{{else}}
6464
<i class="fa fa-times"></i>

gophp/library/schema.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,15 @@ public function query($sql)
241241

242242
}
243243

244+
public function version()
245+
{
246+
247+
$stmt = $this->query('select VERSION()');
248+
249+
$versions = $stmt->fetchAll(PDO::FETCH_ASSOC);
250+
251+
return $versions[0]['VERSION()'];
252+
253+
}
254+
244255
}

0 commit comments

Comments
 (0)