You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
620 B
35 lines
620 B
<?php |
|
/** |
|
* |
|
* Install.php |
|
* User: ChenLong |
|
* DateTime: 2020/4/28 16:58 |
|
*/ |
|
|
|
|
|
namespace app\middleware; |
|
|
|
|
|
use think\facade\App; |
|
use think\Request; |
|
|
|
/** |
|
* Class Install |
|
* @package app\middleware |
|
* @author chenlong <vip_chenlong@163.com> |
|
*/ |
|
class Install |
|
{ |
|
public function handle(Request $request, \Closure $closure) |
|
{ |
|
if (!file_exists(App::getRootPath() . '.env') |
|
&& $request->isGet() |
|
&& ($request->pathinfo() != 'install.html' || $request->rootUrl() != '/admin')) { |
|
|
|
return redirect(admin_url('install')); |
|
} |
|
|
|
return $closure($request); |
|
} |
|
} |
|
|
|
|