<?php
if(version_compare(PHP_VERSION,'5.4.0','<'))  die('require PHP > 5.4.0 !');
defined('ROOT_PATH') or define('ROOT_PATH', dirname(__FILE__).'/');
if(!file_exists(ROOT_PATH.'data/install.lock')){
	header("Location:install/index.php");exit;
}

defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

require(__DIR__ . '/protected/vendor/autoload.php');
require(__DIR__ . '/protected/vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/protected/common/config/bootstrap.php');
require(__DIR__ . '/protected/frontend/config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/protected/common/config/main.php'),
    require(__DIR__ . '/protected/common/config/db.php'),
    require(__DIR__ . '/protected/frontend/config/main.php'),
    require(__DIR__ . '/protected/frontend/config/main-local.php'),
    require(__DIR__ . '/protected/frontend/config/route-rule.php')
);
defined('RESOURCE_DIR') or define('RESOURCE_DIR',$config['params']['sitedir'].'data/resource/');
defined('UPLOAD_PATH') or define('UPLOAD_PATH',ROOT_PATH.'data/upload/');

(new yii\web\Application($config))->run();
