1
+ <?php
2
+
3
+ require dirname (__FILE__ ) . '/orfarm/app/bootstrap.php ' ;
4
+ $ bootstrap = \Magento \Framework \App \Bootstrap::create (BP , $ _SERVER );
5
+
6
+ use Magento \Framework \Console \Cli ;
7
+ use Psr \Log \LoggerInterface ;
8
+ use Symfony \Component \Console \Input \ArrayInput ;
9
+ use Symfony \Component \Console \Output \ConsoleOutput ;
10
+ use Symfony \Component \Console \Output \NullOutput ;
11
+
12
+ class Outslide extends \Magento \Framework \App \Http
13
+ implements \Magento \Framework \AppInterface {
14
+ public function launch ()
15
+ {
16
+ $ myClass = $ this ->_objectManager ->create ('RunCLI ' );
17
+ $ myClass ->execute ();
18
+ return $ this ->_response ;
19
+ }
20
+
21
+ }
22
+
23
+
24
+ class RunCLI
25
+ {
26
+
27
+ private $ logger ;
28
+
29
+ public function __construct (LoggerInterface $ logger )
30
+ {
31
+ $ this ->logger = $ logger ;
32
+ }
33
+
34
+ public function execute ()
35
+ {
36
+ $ application = new Cli ('Magento CLI ' );
37
+ $ input = new ArrayInput ([
38
+ 'command ' => 'cache:flush ' ,
39
+ ]);
40
+ /* use NullOutput if don't want show output */
41
+ $ output = new NullOutput ();
42
+
43
+ /* use NullOutput if want show output in command line */
44
+ $ output = new ConsoleOutput ();
45
+
46
+ try {
47
+ $ application ->run ($ input , $ output );
48
+ } catch (\Exception $ exception ) {
49
+ $ this ->logger ->critical ('Cache Flush failed. ' , ['exception ' => $ exception ]);
50
+ }
51
+ }
52
+ }
53
+
54
+
55
+ /** @var \Magento\Framework\App\Http $app */
56
+ $ app = $ bootstrap ->createApplication ('Outslide ' );
57
+ $ bootstrap ->run ($ app );
0 commit comments