-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmagento_cli.php
40 lines (35 loc) · 1.35 KB
/
magento_cli.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
$file = dirname(__FILE__) . '/hoi/app/bootstrap.php';
$file = str_replace('/public_html/', '/public_htmls/', $file);
require $file;
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class MagentoCLI extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$this->_state->setAreaCode('frontend');
$k[0]='bin/magento';
$k[1]='cache:flush'; // You can change command as you want like setup:static-content:deploy, cache:status etc.
$_SERVER['argv']=$k;
try {
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);
$application = new Magento\Framework\Console\Cli('Magento CLI');
$application->run();
echo 'done Command';
} catch (\Exception $e) {
while ($e) {
echo $e->getMessage();
echo $e->getTraceAsString();
echo "\n\n";
$e = $e->getPrevious();
}
}
//the method must end with this line
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('MagentoCLI');
$bootstrap->run($app);