Released n98-magerun Version 1.95.0

Published by Christian Münch on

We released a new version of n98-magerun for Magento 1 (for Magento 2 have a look at https://github.com/netz98/n98-magerun2).

There are some features and improvements which we are try to explain.

Alternative project config

Many of you don’t use the standard project structure where the root folder of the project is also the webroot of the virtual host.
In the last releases we added support for a “stop file” which stops n98-magerun’s Magento root detection. If the file is found it contains a relative path to the webroot like “www” or “htdocs”.

In this release we added support to place a project config in the project root folder. If a “stop” file was found we search for a “n98-magerun.yaml” in the same folder.

An example structure could be like this:

.
├── composer.json
├── composer.lock
├── .n98-magerun
├── n98-magerun.yaml (will be loaded if .n98-magerun stop file exists)
├── vendor
└── www
  • #444 Added support to place .n98-magerun.yaml file in the same folder as “n98-magerun” stop file. (by Christian Münch)

PSR-4 support for modules

It’s now possible to use PSR-4 compatible autoloader of embedded composer.

This can reduce the numbers of sub-folders inside a module.

The autoloader definition in n98-magerun.yaml is nearly the same.

autoloaders_psr4:
  Foo\Bar\Zoz\: %module%/src

commands:
  customCommands:
    - Foo\Bar\Zoz\ExampleCommand

The only thing we changed was to change “autoloaders” to “autoloaders_psr4”. The trailing “\” at the namespace definition is required.

If psr-4 autoloader is used we don’t need to create empty “Foo\Bar\Zoz\” folders. The autoloaders will load directly from defined target folder (in this case “src”).

.
├── n98-magerun.yaml
└── src
    └── ExampleCommand.php
  • Added support for PSR-4 autoloading. (by Christian Münch)

New dev:console !!!

With release 1.56.0 we added the dev:console command which was a greate feature. The problem with the dev:console command was that we used the PHP internal interactive console which shows a different behaviour on some systems.
We was not able to fix that. Now we replaced the dev:console command with psych a userland code PHP shell.

You can run the dev:console with n98-magerun.phar dev:console.

Init Magento

dev_console_initialization

PHPDoc

dev_console_doc

Local Variables

dev_console_dump_variables

dev_console_local_variables

Show Code

dev_console_show

  • Added new Psy\Console. Replaced dev:console command. (by Christian Münch)

Fixes and Improvements

  • #465 checking for presence of Mage.php file in list of files searched for since Magento 2 no longer has a god class (by David Alger)
  • #466 Configuration loader fatal error (by Tom Klingenberg)
  • #472 Allow setting unix socket in host component (by Melvyn Sopacua)
  • #474474 Add index event tables to @ids table group of the db:dump command (by Aad [Mathijssen)
  • #475 Add importexporttemp table group for db:dump command (by Aad Mathijssen)
  • #478 Improve sys:cron:run input handling (by Aad Mathijssen)
  • #482 Infinite loop on n98-magerun script:repo:run –no-interaction (by Tom Klingenberg)
  • #483 Cache clean “race” condition (by Jason Potkanski)
  • #488 Fix wording (by will-b)
  • #496 Upgrade PhpStorm (by Rafael Corrêa Gomes)
  • #506 backend_type in eav:attribute:list (by Steve Robbins)
  • Added debug logging if project config file is loaded. (by Christian Münch)
  • Fixed magento detection. Try every command if Magento was found. (by Christian Münch)
  • Removed Magento 2 installation source. (by Christian Münch)

5 Comments

pierswarmers · March 10, 2015 at 02:22

Looks great… will check it out.

Wojtek · March 13, 2015 at 20:48

Christian, thanks for new release, the console looks really interesting and I’m excited to try that. However, I can’t see that command after I updated tool to 1.95:

bash-3.2$ n98-magerun –version
n98-magerun version 1.95.0 by netz98 new media GmbH
bash-3.2$ n98-magerun dev:console
[InvalidArgumentException]
Command “dev:console” is not defined.

Did I do anything wrong?

    Christian Münch · March 13, 2015 at 21:09

    I checked it and found that we have a (useless) check in the command.
    The dev:console is only available in .phar mode. I will remove that in the next release.
    Give me some minutes and i remove the check in develop branch.

      Wojtek · March 13, 2015 at 21:47

      Thanks Christian, I renamed file in my /usr/local/bin to include .phar extension and it works now. I’m able to play with the command then.

Magento-Neuigkeiten #34 · March 20, 2015 at 06:51

[…] n98-magerun erschien in Version 1.95.0. […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.