IndexController.class.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | OneThink [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 小梦科技资源 <zuojiazi@vip.qq.com> <https://www.nanodreamtech.com>
  8. // +----------------------------------------------------------------------
  9. namespace Install\Controller;
  10. use Think\Controller;
  11. use Think\Storage;
  12. class IndexController extends Controller{
  13. //安装首页
  14. public function index(){
  15. if(is_file( '/Modules/Common/Conf/db.php')){
  16. // 已经安装过了 执行更新程序
  17. $msg = '请删除install.lock文件后再运行安装程序!';
  18. }else{
  19. $msg = '已经成功安装,请不要重复安装!';
  20. }
  21. if(Storage::has('Modules/Common/Conf/install.lock')){
  22. $this->error($msg);
  23. }
  24. $this->display();
  25. }
  26. //安装完成
  27. public function complete(){
  28. $step = session('step');
  29. if(!$step){
  30. $this->redirect('index');
  31. } elseif($step != 3) {
  32. $this->redirect("Install/step{$step}");
  33. }
  34. // 写入安装锁定文件
  35. Storage::put('./Modules/Common/Conf/install.lock', 'lock');
  36. clear_cache();
  37. session('step', null);
  38. session('error', null);
  39. session('update',null);
  40. $this->display();
  41. }
  42. }