ci4
/
spark
84 строки · 2.6 Кб
1#!/usr/bin/env php
2<?php
3
4/**
5* This file is part of CodeIgniter 4 framework.
6*
7* (c) CodeIgniter Foundation <admin@codeigniter.com>
8*
9* For the full copyright and license information, please view
10* the LICENSE file that was distributed with this source code.
11*/
12
13/*
14* --------------------------------------------------------------------
15* CODEIGNITER COMMAND-LINE TOOLS
16* --------------------------------------------------------------------
17* The main entry point into the CLI system and allows you to run
18* commands and perform maintenance on your application.
19*/
20
21/*
22*---------------------------------------------------------------
23* CHECK SERVER API
24*---------------------------------------------------------------
25*/
26
27// Refuse to run when called from php-cgi
28if (str_starts_with(PHP_SAPI, 'cgi')) {
29exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
30}
31
32/*
33*---------------------------------------------------------------
34* CHECK PHP VERSION
35*---------------------------------------------------------------
36*/
37
38$minPhpVersion = '8.1'; // If you update this, don't forget to update `public/index.php`.
39if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
40$message = sprintf(
41'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
42$minPhpVersion,
43PHP_VERSION
44);
45
46exit($message);
47}
48
49// We want errors to be shown when using it from the CLI.
50error_reporting(E_ALL);
51ini_set('display_errors', '1');
52
53/*
54*---------------------------------------------------------------
55* SET THE CURRENT DIRECTORY
56*---------------------------------------------------------------
57*/
58
59// Path to the front controller
60define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
61
62// Ensure the current directory is pointing to the front controller's directory
63chdir(FCPATH);
64
65/*
66*---------------------------------------------------------------
67* BOOTSTRAP THE APPLICATION
68*---------------------------------------------------------------
69* This process sets up the path constants, loads and registers
70* our autoloader, along with Composer's, loads our constants
71* and fires up an environment-specific bootstrapping.
72*/
73
74// LOAD OUR PATHS CONFIG FILE
75// This is the line that might need to be changed, depending on your folder structure.
76require FCPATH . '../app/Config/Paths.php';
77// ^^^ Change this line if you move your application folder
78
79$paths = new Config\Paths();
80
81// LOAD THE FRAMEWORK BOOTSTRAP FILE
82require $paths->systemDirectory . '/Boot.php';
83
84exit(CodeIgniter\Boot::bootSpark($paths));
85