-
Notifications
You must be signed in to change notification settings - Fork 0
/
yii
executable file
·45 lines (36 loc) · 1.16 KB
/
yii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env php
<?php
/**
* Yii console bootstrap file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
require(__DIR__ . '/vendor/autoload.php');
// Load Environment Variables
if (getenv('APPLICATION_ENV') != 'production') {
$dotenv = new Dotenv\Dotenv(__DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR .'env');
$dotenv->load();
}
// Setup application environment
$envs = ['development', 'staging', 'production', 'local'];
$env = getenv("APPLICATION_ENV");
if (!in_array($env, $envs)) {
echo("Environment is not valid");
exit(1);
}
if (in_array($env, ['local', 'develop'])) {
defined('YII_DEBUG') or define('YII_DEBUG', true);
}
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . "/app/config/console.php");
require(__DIR__ . "/app/config/services.php");
// Set default timezone
date_default_timezone_set("Africa/Lagos");
if (!ini_get("auto_detect_line_endings")) {
ini_set("auto_detect_line_endings", '1');
}
$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);