[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Cli 5 * 6 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 // We are a valid entry point. 11 const _JEXEC = 1; 12 13 // Define the application's minimum supported PHP version as a constant so it can be referenced within the application. 14 const JOOMLA_MINIMUM_PHP = '7.2.5'; 15 16 if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { 17 echo 'Sorry, your PHP version is not supported.' . PHP_EOL; 18 echo 'Your command line php needs to be version ' . JOOMLA_MINIMUM_PHP . ' or newer to run the Joomla! CLI Tools' . PHP_EOL; 19 echo 'The version of PHP currently running this code, at the command line, is PHP version ' . PHP_VERSION . '.' . PHP_EOL; 20 echo 'Please note, the version of PHP running your commands here, may be different to the version that is used by '; 21 echo 'your web server to run the Joomla! Web Application' . PHP_EOL; 22 23 exit; 24 } 25 26 // Load system defines 27 if (file_exists(dirname(__DIR__) . '/defines.php')) { 28 require_once dirname(__DIR__) . '/defines.php'; 29 } 30 31 if (!defined('_JDEFINES')) { 32 define('JPATH_BASE', dirname(__DIR__)); 33 require_once JPATH_BASE . '/includes/defines.php'; 34 } 35 36 // Check for presence of vendor dependencies not included in the git repository 37 if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_ROOT . '/media/vendor')) { 38 echo 'It looks like you are trying to run Joomla! from our git repository.' . PHP_EOL; 39 echo 'To do so requires you complete a couple of extra steps first.' . PHP_EOL; 40 echo 'Please see https://docs.joomla.org/Special:MyLanguage/J4.x:Setting_Up_Your_Local_Environment for further details.' . PHP_EOL; 41 42 exit; 43 } 44 45 // Check if installed 46 if ( 47 !file_exists(JPATH_CONFIGURATION . '/configuration.php') 48 || (filesize(JPATH_CONFIGURATION . '/configuration.php') < 10) 49 ) { 50 echo 'Install Joomla to run cli commands' . PHP_EOL; 51 52 exit; 53 } 54 55 // Get the framework. 56 require_once JPATH_BASE . '/includes/framework.php'; 57 58 // Boot the DI container 59 $container = \Joomla\CMS\Factory::getContainer(); 60 61 /* 62 * Alias the session service keys to the CLI session service as that is the primary session backend for this application 63 * 64 * In addition to aliasing "common" service keys, we also create aliases for the PHP classes to ensure autowiring objects 65 * is supported. This includes aliases for aliased class names, and the keys for aliased class names should be considered 66 * deprecated to be removed when the class name alias is removed as well. 67 */ 68 $container->alias('session', 'session.cli') 69 ->alias('JSession', 'session.cli') 70 ->alias(\Joomla\CMS\Session\Session::class, 'session.cli') 71 ->alias(\Joomla\Session\Session::class, 'session.cli') 72 ->alias(\Joomla\Session\SessionInterface::class, 'session.cli'); 73 74 $app = \Joomla\CMS\Factory::getContainer()->get(\Joomla\Console\Application::class); 75 \Joomla\CMS\Factory::$application = $app; 76 $app->execute();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |