Skip to content

Commit 7870f6b

Browse files
committedApr 27, 2021
Create Magicmenu.php
1 parent 01e3924 commit 7870f6b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 

‎Magicmenu.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
4+
5+
$file = dirname(__FILE__) . '/app/bootstrap.php';
6+
$file = str_replace('/pub/', '/', $file);
7+
require $file;
8+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
9+
10+
11+
class MagentoCLI extends \Magento\Framework\App\Http
12+
implements \Magento\Framework\AppInterface {
13+
14+
protected $_menu;
15+
protected $nodeFactory;
16+
protected $treeFactory;
17+
18+
public function launch()
19+
{
20+
$this->_state->setAreaCode('frontend');
21+
22+
$time_start = microtime(true);
23+
24+
$menu = $this->_objectManager->create('\Magiccart\Magicmenu\Block\Menu');
25+
$menu->setTemplate('Magiccart_Magicmenu::aio-topmenu.phtml');
26+
$html = $menu->toHtml();
27+
echo $html;
28+
29+
$time_end = microtime(true);
30+
31+
//dividing with 60 will give the execution time in minutes otherwise seconds
32+
$execution_time = ($time_end - $time_start)/60;
33+
echo 'Execution time ' . $execution_time;
34+
return $this->_response;
35+
}
36+
37+
}
38+
39+
/** @var \Magento\Framework\App\Http $app */
40+
$app = $bootstrap->createApplication('MagentoCLI');
41+
$bootstrap->run($app);

0 commit comments

Comments
 (0)
Please sign in to comment.