Created
October 12, 2018 22:23
-
-
Save antonkril/405d5025038fbc0d333dcd59482e58f4 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
Index: manage.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- manage.php (date 1537910031000) | |
+++ manage.php (date 1537910031000) | |
@@ -0,0 +1,74 @@ | |
+<?php | |
+/** | |
+ * Copyright © Magento, Inc. All rights reserved. | |
+ * See COPYING.txt for license details. | |
+ */ | |
+ | |
+try { | |
+ require __DIR__ . '/../../app/bootstrap.php'; | |
+} catch (\Exception $e) { | |
+ echo 'Autoload error: ' . $e->getMessage(); | |
+ exit(1); | |
+} | |
+ini_set('error_reporting', -1); | |
+ini_set('display_errors', 'on'); | |
+try { | |
+ $handler = new \Magento\Framework\App\ErrorHandler(); | |
+ set_error_handler([$handler, 'handler']); | |
+ $application = new Magento\Framework\Console\Cli('Magento CLI'); | |
+ if (isset($_GET['config'])) { | |
+ $output = new \Symfony\Component\Console\Output\BufferedOutput(); | |
+ $commands = array_map(function ($item) { | |
+ $arguments = array_map(function ($argument) { | |
+ return [ | |
+ 'name' => $argument->getName(), | |
+ 'description' => $argument->getDescription(), | |
+ 'is_array' => $argument->isArray(), | |
+ 'is_requied' => $argument->isRequired(), | |
+ 'default' => $argument->getDefault() | |
+ ]; | |
+ }, | |
+ $item->getDefinition()->getArguments() | |
+ ); | |
+ $options = array_map(function ($argument) { | |
+ return [ | |
+ 'name' => $argument->getName(), | |
+ 'description' => $argument->getDescription(), | |
+ 'shortcut' => $argument->getShortcut(), | |
+ 'default' => $argument->getDefault() | |
+ ]; | |
+ }, | |
+ $item->getDefinition()->getOptions() | |
+ ); | |
+ | |
+ return [ | |
+ 'name' => $item->getName(), | |
+ 'description' => $item->getDescription(), | |
+ 'help' => $item->getHelp(), | |
+ 'usages' => $item->getUsages(), | |
+ 'definition' => [ | |
+ 'options' => $options, | |
+ 'arguments' => $arguments | |
+ ] | |
+ ]; | |
+ }, $application->getApplicationCommands()); | |
+ echo json_encode($commands); | |
+ } else { | |
+ $inputArgs = json_decode($_POST); | |
+ $input = new \Symfony\Component\Console\Input\ArrayInput($inputArgs['arguments']); | |
+ array_walk($inputArgs['optinos'], function ($value, $key) use ($input) { | |
+ $input->setOption($key, $value); | |
+ }); | |
+ $output = new \Symfony\Component\Console\Output\StreamOutput(fopen('php://output', 'w')); | |
+ $application->setAutoExit(false); | |
+ $application->run($input, $output); | |
+ } | |
+} catch (\Exception $e) { | |
+ while ($e) { | |
+ echo $e->getMessage(); | |
+ echo $e->getTraceAsString(); | |
+ echo "\n\n"; | |
+ $e = $e->getPrevious(); | |
+ } | |
+ exit(Magento\Framework\Console\Cli::RETURN_FAILURE); | |
+} | |
Index: lib/internal/Magento/Framework/Console/Cli.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/internal/Magento/Framework/Console/Cli.php (revision d00a9193351dd678280599630f2f35124f855298) | |
+++ lib/internal/Magento/Framework/Console/Cli.php (date 1538009169000) | |
@@ -109,6 +109,12 @@ | |
return $exitCode; | |
} | |
+ public function renderException($e, $output) | |
+ { | |
+ die ($e->getMessage()); | |
+ } | |
+ | |
+ | |
/** | |
* {@inheritdoc} | |
*/ | |
@@ -122,7 +128,7 @@ | |
* | |
* @return array a list of available application commands | |
*/ | |
- protected function getApplicationCommands() | |
+ public function getApplicationCommands() | |
{ | |
$commands = []; | |
try { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment