portal.mkgtu.ru/console/yii

48 lines
1.3 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
// fcgi doesn't have STDIN and STDOUT defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));
$commands_before_installed = ['install-lk', 'checksum'];
// if any $commands_before_installed contains in string in $argv
$is_before_installed = false;
foreach ($argv as $arg) {
foreach ($commands_before_installed as $command) {
if (strpos($arg, $command) !== false) {
$is_before_installed = true;
break;
}
}
if ($is_before_installed) {
break;
}
}
if ($is_before_installed) {
defined('PORTAL_CONSOLE_INSTALLATION') or define('PORTAL_CONSOLE_INSTALLATION', true);
}
// Composer
require(__DIR__ . '/../vendor/autoload.php');
// Environment
require(__DIR__ . '/../common/env.php');
// Yii
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
// Bootstrap application
require(__DIR__ . '/../common/config/bootstrap.php');
require(__DIR__ . '/config/bootstrap.php');
$config = \yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../common/config/base.php'),
require(__DIR__ . '/../common/config/console.php'),
require(__DIR__ . '/config/console.php')
);
$app = (new yii\console\Application($config));
$exitCode = $app->run();
exit($exitCode);