spark 2.6 KB

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