Yii.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. if (is_file(__DIR__ . '/.env')) {
  3. (new \Dotenv\Dotenv(__DIR__))->load();
  4. }
  5. defined('YII_DEBUG') or define('YII_DEBUG', env('YII_DEBUG'));
  6. defined('YII_ENV') or define('YII_ENV', env('YII_ENV', 'prod'));
  7. class Yii extends \yii\BaseYii
  8. {
  9. /**
  10. * @var \install\Application|BaseApplication|WebApplication|ConsoleApplication the application instance
  11. */
  12. public static $app;
  13. public static function getVersion()
  14. {
  15. return '3.0';
  16. }
  17. public static function powered()
  18. {
  19. return parent::powered() . ' & <a href="http://www.51siyuan.cn/" rel="external">Yii2 CMF</a>';
  20. }
  21. }
  22. spl_autoload_register(['Yii', 'autoload'], true, true);
  23. Yii::$classMap = require(__DIR__ . '/vendor/yiisoft/yii2/classes.php');
  24. Yii::$container = new yii\di\Container();
  25. function checkInstalled()
  26. {
  27. return file_exists(Yii::getAlias('@root/web/storage/install.txt'));
  28. }
  29. //IDE友好
  30. /**
  31. * Class BaseApplication
  32. * Used for properties that are identical for both WebApplication and ConsoleApplication
  33. * @property \common\modules\config\components\Config $config
  34. * @property \common\modules\attachment\components\FilesystemManager|\common\modules\attachment\components\FilesystemAdapter $storage
  35. * @property \common\components\notify\Handler $notify
  36. */
  37. abstract class BaseApplication extends yii\base\Application
  38. {
  39. }
  40. /**
  41. * Class WebApplication
  42. * Include only Web application related components here
  43. * @property \frontend\components\Search $search
  44. * @property \common\components\PluginManager $pluginManager
  45. * @property \common\components\ModuleManager $moduleManager
  46. * @property \common\components\ThemeManager $themeManager
  47. * @property User $user
  48. */
  49. class WebApplication extends yii\web\Application
  50. {
  51. }
  52. /**
  53. * Class ConsoleApplication
  54. * Include only Console application related components here
  55. *
  56. */
  57. class ConsoleApplication extends yii\console\Application
  58. {
  59. }
  60. /**
  61. * Class User
  62. * @property \common\modules\user\models\User $identity
  63. */
  64. class User
  65. {
  66. }