forked from craftcms/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.php
40 lines (32 loc) · 918 Bytes
/
console.php
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
<?php
/**
* Craft console bootstrap file.
*
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/
use yii\console\ExitCode;
// Make sure they're running PHP 8+
if (PHP_VERSION_ID < 80002) {
echo "Craft requires PHP 8.0.2 or later.\n";
exit(ExitCode::UNSPECIFIED_ERROR);
}
// Make sure $_SERVER['SCRIPT_FILENAME'] is set
if (!isset($_SERVER['SCRIPT_FILENAME'])) {
$trace = debug_backtrace(0);
if (($first = end($trace)) !== false && isset($first['file'])) {
$_SERVER['SCRIPT_FILENAME'] = $first['file'];
}
}
mb_detect_order('auto');
// https://github.com/craftcms/cms/issues/4239
setlocale(
LC_CTYPE,
'C.UTF-8', // libc >= 2.13
'C.utf8' // different spelling
);
// Set default timezone to UTC
date_default_timezone_set('UTC');
$appType = 'console';
return require __DIR__ . '/bootstrap.php';