-
Notifications
You must be signed in to change notification settings - Fork 0
/
yii
executable file
·36 lines (34 loc) · 1.18 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
#!/usr/bin/env php
<?php
if (function_exists('ini_set')) {
@ini_set('display_errors', 1);
$memoryInBytes = function ($value) {
$unit = strtolower(substr($value, -1, 1));
$value = (int) $value;
switch($unit) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'g':
$value *= 1024;
// no break (cumulative multiplier)
/** @noinspection PhpMissingBreakStatementInspection */
case 'm':
$value *= 1024;
// no break (cumulative multiplier)
/** @noinspection PhpMissingBreakStatementInspection */
case 'k':
$value *= 1024;
}
return $value;
};
$memoryLimit = trim(ini_get('memory_limit'));
// Increase memory_limit if it is lower than 1GB
if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 256 * 1024 * 1024) {
@ini_set('memory_limit', '256M');
}
unset($memoryInBytes, $memoryLimit);
}
require(__DIR__ . '/bootstrap.php');
$config = require(__DIR__ . '/config/console.php');
$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);