| 
									
										
										
										
											2014-08-31 22:56:25 -07:00
										 |  |  | #!/usr/bin/env php | 
					
						
							|  |  |  | <?php | 
					
						
							| 
									
										
										
										
											2018-11-12 12:21:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-04 21:09:42 -08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2025-01-06 14:14:42 +00:00
										 |  |  |  * @copyright  Copyright (c) 2015 - 2025 Trilby Media, LLC. All rights reserved. | 
					
						
							| 
									
										
										
										
											2021-02-04 21:09:42 -08:00
										 |  |  |  * @license    MIT License; see LICENSE file for details. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-12 12:21:44 +02:00
										 |  |  | use Grav\Common\Composer; | 
					
						
							|  |  |  | use Grav\Common\Grav; | 
					
						
							| 
									
										
										
										
											2021-01-06 13:45:19 +02:00
										 |  |  | use Grav\Console\Application\GpmApplication; | 
					
						
							| 
									
										
										
										
											2018-11-12 12:21:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-16 13:12:26 +03:00
										 |  |  | \define('GRAV_CLI', true); | 
					
						
							|  |  |  | \define('GRAV_REQUEST_TIME', microtime(true)); | 
					
						
							| 
									
										
										
										
											2014-08-31 22:56:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-12 12:21:44 +02:00
										 |  |  | if (!file_exists(__DIR__ . '/../vendor/autoload.php')){ | 
					
						
							|  |  |  |     // Before we can even start, we need to run composer first | 
					
						
							| 
									
										
										
										
											2015-05-15 19:54:33 +02:00
										 |  |  |     require_once __DIR__ . '/../system/src/Grav/Common/Composer.php'; | 
					
						
							| 
									
										
										
										
											2015-05-14 21:37:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-15 19:54:33 +02:00
										 |  |  |     $composer = Composer::getComposerExecutor(); | 
					
						
							| 
									
										
										
										
											2014-09-04 16:29:48 -07:00
										 |  |  |     echo "Preparing to install vendor dependencies...\n\n"; | 
					
						
							| 
									
										
										
										
											2015-05-15 19:54:33 +02:00
										 |  |  |     echo system($composer.' --working-dir="'.__DIR__.'/../" --no-interaction --no-dev --prefer-dist -o install'); | 
					
						
							| 
									
										
										
										
											2014-09-04 16:29:48 -07:00
										 |  |  |     echo "\n\n"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-16 13:12:26 +03:00
										 |  |  | $autoload = require __DIR__ . '/../vendor/autoload.php'; | 
					
						
							| 
									
										
										
										
											2014-08-31 22:56:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-14 09:38:22 +02:00
										 |  |  | // Set timezone to default, falls back to system if php.ini not set | 
					
						
							|  |  |  | date_default_timezone_set(@date_default_timezone_get()); | 
					
						
							| 
									
										
										
										
											2014-08-31 22:56:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-10 09:50:39 +02:00
										 |  |  | // Set internal encoding. | 
					
						
							|  |  |  | @ini_set('default_charset', 'UTF-8'); | 
					
						
							|  |  |  | mb_internal_encoding('UTF-8'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-12 12:21:44 +02:00
										 |  |  | if (!file_exists(GRAV_ROOT . '/index.php')) { | 
					
						
							| 
									
										
										
										
											2014-08-31 22:56:25 -07:00
										 |  |  |     exit('FATAL: Must be run from ROOT directory of Grav!'); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 16:39:58 -06:00
										 |  |  | if (!function_exists('curl_version')) { | 
					
						
							|  |  |  |     exit('FATAL: GPM requires PHP Curl module to be installed'); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-11 12:40:53 -07:00
										 |  |  | $grav = Grav::instance(array('loader' => $autoload)); | 
					
						
							| 
									
										
										
										
											2014-08-31 22:56:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-06 13:45:19 +02:00
										 |  |  | $app = new GpmApplication('Grav Package Manager', GRAV_VERSION); | 
					
						
							| 
									
										
										
										
											2014-08-31 22:56:25 -07:00
										 |  |  | $app->run(); |