web.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. 'yii\bootstrap\BootstrapPluginAsset' => [
  100. 'js'=>[]
  101. ],
  102. 'yii\bootstrap\BootstrapAsset' => [
  103. 'css' => [],
  104. ],
  105. ],
  106. ],
  107. 'sphinx' => [
  108. 'class' => 'yii\sphinx\Connection',
  109. 'dsn' => 'mysql:host=192.168.1.3;port=9306;',
  110. 'username' => '',
  111. 'password' => '',
  112. ],
  113. 'og'=>[
  114. 'class'=>\app\helpers\OG::class
  115. ],
  116. 'view' => [
  117. 'theme' => [
  118. 'pathMap' => [
  119. '@app/views' => [
  120. '@dektrium/user/views'
  121. ],
  122. '@dektrium/user/views' => '@manager/views/user'
  123. ],
  124. ],
  125. ],
  126. ],
  127. "modules"=>[
  128. "manager"=>[
  129. "class"=>manager\Manager::class
  130. ],
  131. "control"=>[
  132. "class"=>control\Control::class
  133. ],
  134. "sitemap"=>[
  135. "class"=>sitemap\Sitemap::class,
  136. ],
  137. "rss" => [
  138. "class"=>rss\Rss::class,
  139. 'supportModels' => [ // list of supported models for displaying a Turbo-pages feed
  140. 'News' => '\app\models\News',
  141. ],
  142. 'cacheExpire' => 1, // cache lifetime, `0` - for not use cache
  143. 'channelOptions' => ['title' => 'ИА Амител', 'link' => 'https://www.amic.ru/'], // default channel options
  144. 'turboRoute' => '/rss', // default route to render Turbo-pages feed (use "/" - for root)
  145. 'layout' => '@manager/views/layouts/main',
  146. 'routePrefix' => ''
  147. ],
  148. 'user' => [
  149. 'class' => 'dektrium\user\Module',
  150. 'admins' => ['admin'],
  151. 'adminPermission' => 'admin',
  152. 'mailer' => [ 'sender' => 'info@api.amic.ru', ],
  153. 'controllerMap' => [
  154. 'admin' => [
  155. 'class' => 'dektrium\user\controllers\AdminController',
  156. 'layout' => '@manager/views/layouts/main'
  157. ],
  158. 'profile' => [
  159. 'class' => 'dektrium\user\controllers\ProfileController',
  160. 'layout' => '@manager/views/layouts/main'
  161. ],
  162. ]
  163. ],
  164. 'rbac' => [
  165. 'class' => 'dektrium\rbac\RbacWebModule',
  166. 'controllerMap' => [
  167. 'role' => [
  168. 'class' => 'dektrium\rbac\controllers\RoleController',
  169. 'layout' => '@manager/views/layouts/main'
  170. ],
  171. 'permission' => [
  172. 'class' => 'dektrium\rbac\controllers\PermissionController',
  173. 'layout' => '@manager/views/layouts/main'
  174. ],
  175. 'rule' => [
  176. 'class' => 'dektrium\rbac\controllers\RuleController',
  177. 'layout' => '@manager/views/layouts/main'
  178. ]
  179. ]
  180. ]
  181. ],
  182. 'params' => $params,
  183. ];
  184. if (YII_ENV_DEV) {
  185. // configuration adjustments for 'dev' environment
  186. $config['bootstrap'][] = 'debug';
  187. $config['modules']['debug'] = [
  188. 'class' => 'yii\debug\Module',
  189. // uncomment the following to add your IP if you are not connecting from localhost.
  190. 'allowedIPs' => ['*'],
  191. ];
  192. $config['bootstrap'][] = 'gii';
  193. $config['modules']['gii'] = [
  194. 'class' => 'yii\gii\Module',
  195. // uncomment the following to add your IP if you are not connecting from localhost.
  196. 'allowedIPs' => ['*'],
  197. ];
  198. }
  199. Yii::setAlias('@manager', '../modules/manager');
  200. return $config;