web.php 6.0 KB

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