n98-magerun2 v5.0.0 released
This release is named Zhytomyr, which is a city in Ukraine, where a lot of our Valantic colleagues are located.
Magento 2.4.4 has landed. Today we are proud to release a compatible version of n98-magerun2.
The new version is compatible with PHP 8.1 and runs also well in older Magento versions.
We decided to tag the new version as major break, because we removed the bundled Composer library. This reduces the size of the phar file a lot.
The new release comes with some nice new features and like all the releases with improvments and bug fixes.
New Features
customer:delete Command
A nice contribution by Andreas Mautz provides a new command to delete customers. The customer to delete can be defined by common properties like email, firstname, lastname or website.
$> n98-magerun2.phar customer:delete --id 1
$> n98-magerun2.phar customer:delete --email="[email protected]"
It can delete fuzzy. The following example deltes all customers which have “foo” in the email address.
$> n98-magerun2.phar customer:delete --fuzzy --email=foo
There is a handy range option available where the ID range can be limited. The command is currently interactive only.
$> n98-magerun2.phar customer:delete --range
Translate Commands
We ported some Magerun 1 command to Magerun 2.
dev:translate:admin Toggle inline translation tool for admin
dev:translate:export Export inline translations
dev:translate:set Adds a translation to core_translate table. Globally for locale
dev:translate:shop Toggle inline translation tool for shop
Find missing Composer dependencies
The new command dev:module:detect-composer-dependencies provides a hot new feature for all developer who are interested to have corretly defined Composer dependencies. The command is developed by Jens Richter and Alexander Dite. It is a netz98 contribution to help other agencies. We already used this command internally in a private n98-magerun module. We decided to open source it to the public.
The command scans a defined code base for hard- and soft- dependencies. It looks into php, phtml, xml files and checks everything agains the PSR-4 namespaces.
The command will recommend a possible composer.json based on the installed versions in your shop.
$> n98-magerun2.phar dev:module:detect-composer-dependencies <path-to-your-modules>
There is an option to print only the missing dependencies by adding the –only-missing flag.
The command can scan more than one module at once. We think this command is one of the highlights of the new v5.0.0. Feedback is welcome.
Under the hood
The new version is compatible with PHP 8.1 That means that all libraries and the Magerun core code was refactored.
To be compatible we had to replace libraries. We also removed the bundled Composer library to reduce the amount of external code. The Composer library was mainly used to download files in commands. We added the Guzzle library as replacement to handle file downloads.
Custom commands with a dependency to the Composer library have to be refactored before a Magerun 5.0.0 upgrade!
Like in very release we updated a bunch of external dependencies. See Changelog for details.
Update 2022-04-14
There were Guzzle incompatbilities reported for Magento 2.3.x if a Guzzle client is used in a contructor argument. We decided to replace the Guzzle library, bundled in n98-magerun2 with a alternative HTTP client library. This fix is released as 5.0.1.
Mage-OS
Due to the currently developments in the Open Source community, we started to test n98-magerun2 against the Magento shop installed via the official Mage-OS Composer repository. That means that we are able to find incompatibilities in a very early stage.
The first available Mage-OS releases are added to install command.
We love our contributors …
For n98-magerun2 contributors we improved a lot. Let’s see what we did for you, guys.
ddev Setup for Contributors
There is a ddev setup commited to the n98-magerun2 Github repository. You can find everyhing in the .ddev directory. If you do not know ddev. It’s a docker based PHP development environment.
The ddev setup contains a hook script which installs the latest Magento versions inside the generated Docker container.
If ddev is installed on your machine, then a simple ddev start will do all the magic.
We ship some custom ddev commands:
- ddev mr2-dev-23 Run n98-magerun2.phar agains installed Magento 2.3.x shop.
- ddev mr2-dev-24 Run n98-magerun2.phar agains installed Magento 2.4.x shop.
- ddev mr2-dev-23 Run phpunit against Magento 2.3.x shop.
- ddev mr2-dev-24 Run phpunit against Magento 2.4.x shop.
Please note: The web url is currently not in use!
Better QA
Like in the previous releases, we improved our infrastructure and QA. To the test setup we added functional tests for the generated phar file. This means that we run the phar file agains all compatible Magento versions. The great thing is that the tests cover the Magerun command as well a lot of core commands.
Phar build process
The phar build process is completely replaced. The old patched Phinx script could be replaced by box which provided a lot of the required features out of the box. That reduces our maintenance effort. If you wish to build your own phar file, the just run the build.sh script in the root of the Git repository.
Full Changelog
- Add: #56: Delete customer command (by Andreas Mautz)
- Add: #906: guzzle dependency (by Christian Münch)
- Add: #917: ddev developer setup (by Christian Münch)
- Add: #922: phar functional tests (by Christian Münch)
- Add: #924: dev:translate commands (by Christian Münch)
- Add: #927: PHP 8.1 compatibility (by Christian Münch)
- Add: Commit hash to version command (by Christian Münch)
- Add: #954: dev:module:detect-composer-dependencies command (by Alexander Dite, Jens Richter)
- Add: Test MageOS in Github Actions
- Add: Update version list of install command (MageOS and Adobe)
- Imp: #918: Replace phar build process (by Christian Münch)
- Imp: Github actions to test Magento development versions (by Christian Münch)
- Imp: Replace dependency “adbario/php-dot-notation” with “dflydev/dot-access-data”
- Imp: Update 3rd party dependencies
(symfony/yaml, symfony/event-dispatcher, fakerphp, symfony/finder,
phpunit, captainhook, psysh, twig, phar-utils, symfony-console-autocomplete) - Del: Composer download methods in abstract command
- Del: phing developer dependency
- Del: Bundled Composer library
- Fix: #934: install command. Allow for xdebug ^3.0 (by Martin Århof)
- Fix: Error in sys:cron:history command (by Christian Münch)
- Fix: PHP warnings in cache:report command (by Christian Münch)
Thanks to all Contributors and the Magento Community.
We ❤️ you! Stay safe! Stay strong! Don’t be a racist!
2 Comments
Alexader · April 21, 2022 at 12:47
Thank you from Zhytomyr!
Hotfix Release 5.0.1 / n98-magerun2 | magerun.net · April 14, 2022 at 23:57
[…] https://magerun.net/n98-magerun2-v5-0-0-released/ for all changes provided with […]