web.php 6.0 KB

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