| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- use lwmf\base\Config;
- //定义app id
- define('LWM_APP_ID', "front");
- //定义项目根目录
- define('LWM_PROJECT_PATH', dirname(dirname(__FILE__)));
- //YII框架路径
- define('YII_PATH', dirname(LWM_PROJECT_PATH) . '/yii/framework');
- // remove the following lines when in production mode
- defined('YII_DEBUG') or define('YII_DEBUG', true);
- // specify how many levels of call stack should be shown in each log message
- defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',5);
- defined('LEWAIMAI_DEBUG') or define('LEWAIMAI_DEBUG', true);
- //开启性能分析 - 线上关闭
- /*$isOpenTideways = false;
- if (function_exists('tideways_enable')) {
- $isOpenTideways = true;
- tideways_enable(TIDEWAYS_FLAGS_NO_SPANS);
- }*/
- require_once LWM_PROJECT_PATH .'/system/commons/Loader.php';
- // change the following paths if necessary
- //加载扩展后的YII框架
- require LWM_PROJECT_PATH . '/lwmf/Yii.php';
- defined('LEWAIMAI_VERSION') or define('LEWAIMAI_VERSION', Config::getInstance()->get('frontVersion'));
- defined('LEWAIMAI_CDN_DATE') or define('LEWAIMAI_CDN_DATE', Config::getInstance()->get('frontCdnDate'));
- //兼容旧的配置定义
- require LWM_PROJECT_PATH . '/protected-front/include/define.php';
- //初始化静态资源常量
- define('LWM_ASSETS_URL', Config::getInstance()->get('assetsUrl'));
- //初始化当前系统环境
- define('LWM_ENV', Config::getInstance()->get('env'));
- //获取默认配置
- $config = Config::getInstance()->get('', 'main');
- $app = Yii::createWebApplication($config);
- //记录性能分析日志 - 线上关闭
- /*if ($isOpenTideways) {
- $app->attachEventHandler('onEndRequest', function () {
- $data = tideways_disable();
- $logPath = "/alidata/log/tideways";
- if (file_exists($logPath)) {
- $app = Yii::app();
- $logName = $app->request->getPathInfo();
- if ($app instanceof \lwmf\base\WebApplication) {
- $logName = $app->getRoute();
- }
- if (empty($logName)) {
- $logName = '/';
- }
- $logName = LWM_APP_ID . "_" . $logName;
- $logName = $logPath . "/" . str_replace('/', '_', $logName) . "_" . uniqid() .".lewaimai.xhprof";
- file_put_contents(
- $logName,
- serialize($data)
- );
- }
- });
- }*/
- $app->run();
|