spark 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. /*
  12. * --------------------------------------------------------------------
  13. * CODEIGNITER COMMAND-LINE TOOLS
  14. * --------------------------------------------------------------------
  15. * The main entry point into the CLI system and allows you to run
  16. * commands and perform maintenance on your application.
  17. */
  18. /*
  19. *---------------------------------------------------------------
  20. * CHECK SERVER API
  21. *---------------------------------------------------------------
  22. */
  23. // Refuse to run when called from php-cgi
  24. if (str_starts_with(PHP_SAPI, 'cgi')) {
  25. exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
  26. }
  27. /*
  28. *---------------------------------------------------------------
  29. * CHECK PHP VERSION
  30. *---------------------------------------------------------------
  31. */
  32. $minPhpVersion = '8.1'; // If you update this, don't forget to update `public/index.php`.
  33. if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
  34. $message = sprintf(
  35. 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
  36. $minPhpVersion,
  37. PHP_VERSION
  38. );
  39. exit($message);
  40. }
  41. // We want errors to be shown when using it from the CLI.
  42. error_reporting(E_ALL);
  43. ini_set('display_errors', '1');
  44. /*
  45. *---------------------------------------------------------------
  46. * SET THE CURRENT DIRECTORY
  47. *---------------------------------------------------------------
  48. */
  49. // Path to the front controller
  50. define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
  51. // Ensure the current directory is pointing to the front controller's directory
  52. chdir(FCPATH);
  53. /*
  54. *---------------------------------------------------------------
  55. * BOOTSTRAP THE APPLICATION
  56. *---------------------------------------------------------------
  57. * This process sets up the path constants, loads and registers
  58. * our autoloader, along with Composer's, loads our constants
  59. * and fires up an environment-specific bootstrapping.
  60. */
  61. // LOAD OUR PATHS CONFIG FILE
  62. // This is the line that might need to be changed, depending on your folder structure.
  63. require FCPATH . '../app/Config/Paths.php';
  64. // ^^^ Change this line if you move your application folder
  65. $paths = new Config\Paths();
  66. // LOAD THE FRAMEWORK BOOTSTRAP FILE
  67. require $paths->systemDirectory . '/Boot.php';
  68. exit(CodeIgniter\Boot::bootSpark($paths));