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