Skip to content

Commit

Permalink
We do not need to register Magerun as Magento "app"
Browse files Browse the repository at this point in the history
We tried to fullfil the AppInterface of the Magento core all the
years. This is not needed to run the cli application.
In Magento 2.4.7 there are plugins on the AppInterface.
We do not want to trigger any code generation in the core application.
So I removed the compatbility layer which is not required.
  • Loading branch information
cmuench committed Jan 16, 2024
1 parent 0317cc7 commit 727cd18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 85 deletions.
3 changes: 1 addition & 2 deletions src/N98/Magento/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ public function initMagento($soft = false)
$isMagento2 = $this->detectionResult->getMajorVersion() === self::MAGENTO_MAJOR_VERSION_2;
if ($isMagento2) {
$magento2Initializer = new Magento2Initializer($this->getAutoloader());
$app = $magento2Initializer->init($this->getMagentoRootFolder());
$this->_objectManager = $app->getObjectManager();
$this->_objectManager = $magento2Initializer->init($this->getMagentoRootFolder());
} else {
$magento1Initializer = new Magento1Initializer($this->getHelperSet());
$magento1Initializer->init();
Expand Down
10 changes: 4 additions & 6 deletions src/N98/Magento/Application/Magento2Initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Composer\Autoload\ClassLoader;
use Magento\Framework\App\Bootstrap;
use Magento\Framework\Autoload\AutoloaderRegistry;
use Magento\Framework\ObjectManagerInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManager;
use N98\Magento\Framework\App\Magerun;
Expand Down Expand Up @@ -32,7 +33,7 @@ public function __construct(ClassLoader $autoloader)

/**
* @param string $magentoRootFolder
* @return \N98\Magento\Framework\App\Magerun
* @return ObjectManagerInterface
* @throws \Exception
*/
public function init($magentoRootFolder)
Expand All @@ -57,12 +58,9 @@ public function init($magentoRootFolder)
$params['entryPoint'] = basename(__FILE__);

$bootstrap = Bootstrap::create($magentoRootFolder, $params);
/** @var \Magento\Framework\App\Cron $app */
$app = $bootstrap->createApplication(Magerun::class, []);
/* @var $app \N98\Magento\Framework\App\Magerun */
$app->launch();
$objectManager = $bootstrap->getObjectManager();

return $app;
return $objectManager;
}

public static function loadMagentoBootstrap($magentoRootFolder)
Expand Down
77 changes: 0 additions & 77 deletions src/N98/Magento/Framework/App/Magerun.php

This file was deleted.

0 comments on commit 727cd18

Please sign in to comment.