web.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. $params = require __DIR__ . '/params.php';
  3. $db = require __DIR__ . '/db.php';
  4. $routes = require __DIR__ . '/routes.php';
  5. $config = [
  6. 'id' => 'basic',
  7. 'basePath' => dirname(__DIR__),
  8. 'bootstrap' => ['log','rss','sitemap'],
  9. 'language' => 'ru',
  10. 'aliases' => [
  11. '@bower' => '@vendor/bower-asset',
  12. '@npm' => '@vendor/npm-asset',
  13. '@manager' => '@app/modules/manager',
  14. '@control' => '@app/modules/control',
  15. '@rss' => '@app/modules/rss',
  16. '@sitemap' => '@app/modules/sitemap',
  17. ],
  18. 'timeZone' => 'Asia/Novosibirsk',
  19. 'components' => [
  20. 'request' => [
  21. // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  22. 'cookieValidationKey' => 'WyEyjj5Lk_8A5msMn1mn5-UQN_xDaNsc',
  23. ],
  24. 'ya' => [
  25. 'class' => 'app\models\Ya',
  26. 'tokenAI' => 't1.9euelZqKz8-YxsyZyJWXi8eblM-Yle3rnpWal56NkcjMyMicipSeyp3LjInl9Pc_PBlO-e8Hd3bj3fT3f2oWTvnvB3d2483n9euelZqMlZfKioqbz87Kj4nOlonLmu_8xeuelZqMlZfKioqbz87Kj4nOlonLmg.vGi2BEtkZdD8WnuEzZJ8-uQwHECXS3ittjcv0ao_UUogKkhFw4cCiU_XVw8OjpLIh46xTGTzUQ9H5bCxM6tUCw',
  27. 'tokenMetrica' => 'y0_AgAAAAABspRzAAKENgAAAADl049iHuuiZPWuSTOGV3NsbVUNsXCymlc',
  28. 'idMetrica' => 34950850
  29. ],
  30. 'deviceDetect' => [
  31. 'class' => 'alexandernst\devicedetect\DeviceDetect'
  32. ],
  33. 'cache' => [
  34. 'class' => 'yii\caching\FileCache',
  35. ],
  36. 'memcache' => [
  37. 'class' => 'yii\caching\MemCache',
  38. 'useMemcached' => true,
  39. 'servers' => [
  40. [
  41. 'host' => '127.0.0.1',
  42. 'port' => 11211,
  43. 'weight' => 100,
  44. ],
  45. ],
  46. ],
  47. 'acache' => [
  48. 'class' => 'yii\caching\ArrayCache',
  49. ],
  50. 'user' => [
  51. 'identityClass' => 'app\models\User',
  52. 'enableAutoLogin' => true,
  53. 'on afterLogin' => function($event) {
  54. $user = $event->identity;
  55. $user->last_login_at = time();
  56. $user->save();
  57. }
  58. ],
  59. 'errorHandler' => [
  60. 'errorAction' => 'site/error',
  61. ],
  62. 'mailer' => [
  63. 'class' => 'yii\swiftmailer\Mailer',
  64. // send all mails to a file by default. You have to set
  65. // 'useFileTransport' to false and configure transport
  66. // for the mailer to send real emails.
  67. 'useFileTransport' => false,
  68. ],
  69. 'log' => [
  70. 'traceLevel' => YII_DEBUG ? 3 : 1,
  71. 'targets' => [
  72. [
  73. 'class' => 'yii\log\FileTarget',
  74. 'levels' => ['error'],
  75. 'except' => ['yii\web\HttpException:404'],
  76. ],
  77. ],
  78. ],
  79. 'db' => $db,
  80. 'old_db' => require __DIR__ . '/db_old.php',
  81. 'urlManager' => [
  82. 'enablePrettyUrl' => true,
  83. 'showScriptName' => false,
  84. 'rules' =>$routes,
  85. ],
  86. 'assetManager' => [
  87. 'bundles' => [
  88. 'yii\web\JqueryAsset' => [
  89. 'jsOptions' => ['position' => \yii\web\View::POS_HEAD],
  90. 'js' => ['jquery.min.js']
  91. ],
  92. 'yii\web\YiiAsset' => [
  93. 'jsOptions' => ['position' => \yii\web\View::POS_HEAD]
  94. ],
  95. 'yii\bootstrap4\BootstrapAsset' => [
  96. // 'cssOptions' => ["rel"=>"preload", "as"=>"style"],
  97. 'css' => ['css/bootstrap.min.css']
  98. ],
  99. ],
  100. ],
  101. 'sphinx' => [
  102. 'class' => 'yii\sphinx\Connection',
  103. 'dsn' => 'mysql:host=192.168.1.3;port=9306;',
  104. 'username' => '',
  105. 'password' => '',
  106. ],
  107. 'og'=>[
  108. 'class'=>\app\helpers\OG::class
  109. ],
  110. 'view' => [
  111. 'theme' => [
  112. 'pathMap' => [
  113. '@app/views' => [
  114. '@dektrium/user/views'
  115. ],
  116. '@dektrium/user/views' => '@manager/views/user'
  117. ],
  118. ],
  119. ],
  120. ],
  121. "modules"=>[
  122. "manager"=>[
  123. "class"=>manager\Manager::class
  124. ],
  125. "control"=>[
  126. "class"=>control\Control::class
  127. ],
  128. "sitemap"=>[
  129. "class"=>sitemap\Sitemap::class,
  130. ],
  131. "rss" => [
  132. "class"=>rss\Rss::class,
  133. 'supportModels' => [ // list of supported models for displaying a Turbo-pages feed
  134. 'News' => '\app\models\News',
  135. ],
  136. 'cacheExpire' => 1, // cache lifetime, `0` - for not use cache
  137. 'channelOptions' => ['title' => 'ИА Амител', 'link' => 'https://www.amic.ru/'], // default channel options
  138. 'turboRoute' => '/rss', // default route to render Turbo-pages feed (use "/" - for root)
  139. 'layout' => '@manager/views/layouts/main',
  140. 'routePrefix' => ''
  141. ],
  142. 'user' => [
  143. 'class' => 'dektrium\user\Module',
  144. 'admins' => ['admin'],
  145. 'adminPermission' => 'admin',
  146. 'mailer' => [ 'sender' => 'info@api.amic.ru', ],
  147. 'controllerMap' => [
  148. 'admin' => [
  149. 'class' => 'dektrium\user\controllers\AdminController',
  150. 'layout' => '@manager/views/layouts/main'
  151. ],
  152. 'profile' => [
  153. 'class' => 'dektrium\user\controllers\ProfileController',
  154. 'layout' => '@manager/views/layouts/main'
  155. ],
  156. ]
  157. ],
  158. 'rbac' => [
  159. 'class' => 'dektrium\rbac\RbacWebModule',
  160. 'controllerMap' => [
  161. 'role' => [
  162. 'class' => 'dektrium\rbac\controllers\RoleController',
  163. 'layout' => '@manager/views/layouts/main'
  164. ],
  165. 'permission' => [
  166. 'class' => 'dektrium\rbac\controllers\PermissionController',
  167. 'layout' => '@manager/views/layouts/main'
  168. ],
  169. 'rule' => [
  170. 'class' => 'dektrium\rbac\controllers\RuleController',
  171. 'layout' => '@manager/views/layouts/main'
  172. ]
  173. ]
  174. ]
  175. ],
  176. 'params' => $params,
  177. ];
  178. if (YII_ENV_DEV) {
  179. // configuration adjustments for 'dev' environment
  180. $config['bootstrap'][] = 'debug';
  181. $config['modules']['debug'] = [
  182. 'class' => 'yii\debug\Module',
  183. // uncomment the following to add your IP if you are not connecting from localhost.
  184. 'allowedIPs' => ['*'],
  185. ];
  186. $config['bootstrap'][] = 'gii';
  187. $config['modules']['gii'] = [
  188. 'class' => 'yii\gii\Module',
  189. // uncomment the following to add your IP if you are not connecting from localhost.
  190. 'allowedIPs' => ['*'],
  191. ];
  192. }
  193. Yii::setAlias('@manager', '../modules/manager');
  194. return $config;