Skip to content

Commit

Permalink
Merge branch 'develop' into list-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Aug 22, 2024
2 parents 30833e8 + e5e089f commit c7fcb88
Show file tree
Hide file tree
Showing 27 changed files with 154 additions and 387 deletions.
51 changes: 26 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 2 additions & 66 deletions src/N98/Magento/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ class Application extends BaseApplication
*/
public const APP_VERSION = '3.0.0-dev';

/**
* @var int
*/
public const MAGENTO_MAJOR_VERSION_1 = 1;

/**
* @var int
*/
public const MAGENTO_MAJOR_VERSION_2 = 2;

/**
* @var string
*/
Expand Down Expand Up @@ -104,12 +94,7 @@ class Application extends BaseApplication
/**
* @var int
*/
protected $_magentoMajorVersion = self::MAGENTO_MAJOR_VERSION_1;

/**
* @var EntryPoint
*/
protected $_magento2EntryPoint = null;
protected $_magentoMajorVersion = 1;

/**
* @var bool
Expand Down Expand Up @@ -465,12 +450,7 @@ public function initMagento($soft = false)
return false;
}

$isMagento2 = $this->_magentoMajorVersion === self::MAGENTO_MAJOR_VERSION_2;
if ($isMagento2) {
$this->_initMagento2();
} else {
$this->_initMagento1($soft);
}
$this->_initMagento1($soft);

return true;
}
Expand Down Expand Up @@ -791,50 +771,6 @@ protected function _initMagento1($soft = false)
}
}

/**
* @return void
*/
protected function _initMagento2()
{
$this->outputMagerunCompatibilityNotice('2');
}

/**
* Show a hint that this is Magento incompatible with Magerun and how to obtain the correct Magerun for it
*
* @param string $version of Magento, "1" or "2", that is incompatible
*/
private function outputMagerunCompatibilityNotice($version)
{
$file = $version === '2' ? $version : '';
$magentoHint = <<<MAGENTOHINT
You are running a Magento $version.x instance. This version of n98-magerun is not compatible
with Magento $version.x. Please use n98-magerun$version (version $version) for this shop.
A current version of the software can be downloaded on github.
<info>Download with curl
------------------</info>
<comment>curl -O https://files.magerun.net/n98-magerun$file.phar</comment>
<info>Download with wget
------------------</info>
<comment>wget https://files.magerun.net/n98-magerun$file.phar</comment>
MAGENTOHINT;

$output = new ConsoleOutput();

/** @var FormatterHelper $formatter */
$formatter = $this->getHelperSet()->get('formatter');

$output->writeln(['', $formatter->formatBlock('Compatibility Notice', 'bg=blue;fg=white', true), '', $magentoHint]);

throw new RuntimeException('This version of n98-magerun is not compatible with Magento ' . $version);
}

/**
* @return EventDispatcher
*/
Expand Down
Loading

0 comments on commit c7fcb88

Please sign in to comment.