Created
October 1, 2016 15:43
-
-
Save webflo/840cb84b12f403f12c8d822b237ca861 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\Console\Application; | |
use Drupal\Console\Bootstrap\Drupal as DrupalConsole; | |
use Drupal\Console\ConsoleApplication; | |
set_time_limit(0); | |
$autoLoadFile = __DIR__ . '/../../../autoload.php'; | |
if (file_exists($autoLoadFile)) { | |
$autoload = require_once $autoLoadFile; | |
} else { | |
echo PHP_EOL . | |
' Something goes wrong with your package.'.PHP_EOL. | |
' Try downloading again.'. PHP_EOL . | |
' Executing:'. PHP_EOL . | |
' composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader'. PHP_EOL; | |
exit(1); | |
} | |
$reflector = new ReflectionClass(Drupal::class); | |
$drupalRoot = dirname(dirname(dirname($reflector->getFileName()))); | |
$reflector = new ReflectionClass(ConsoleApplication::class); | |
$consoleCoreRoot = dirname(dirname($reflector->getFileName())); | |
/* | |
if (!file_exists($appRoot.'composer.json')) { | |
$root = realpath($appRoot . '../') . '/'; | |
} | |
if (!file_exists($root.'composer.json')) { | |
echo 'No composer.json file found at:' . PHP_EOL . | |
$root . PHP_EOL . | |
'you should try run this command,' . PHP_EOL . | |
'from project root directory.' . PHP_EOL; | |
exit(1); | |
} | |
*/ | |
$drupal = new DrupalConsole($autoload, $drupalRoot, $consoleCoreRoot, $consoleCoreRoot); | |
$container = $drupal->boot(); | |
if (!$container) { | |
echo 'In order to list all of the available commands,' . PHP_EOL . | |
'you should install drupal first.' . PHP_EOL; | |
exit(1); | |
} | |
$application = new Application($container); | |
$application->setDefaultCommand('about'); | |
$application->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment