Released Version 1.78.0
We deployed a new stable n98-magerun version with some internal changes which are great if you are developing custom database driven commands.
The new version contains also some minor features and uncritical bugfixes.
New Database Helper
In some cases it’s useful to run commands directly on your database. In the past it was usual to extend the class AbstractDatabaseCommand and call methods like _getConnection which returns a PDO Object.
We now ported all methods of this abstract class to a new console helper which can be called in command context.
It’s very easy to use the database functions.
Example:
// get PDO adapter to run queries
$pdo = $this->getHelper('database')->getConnection();
// get a list of all tables
$tables = $this->getHelper('database')->getTables();
// MySQL CLI client connection string
$this->getHelper('database')->getMysqlClientToolConnectionString();
If you are fimilar with the very cool strip function of db:dump command you will like the function resolveTables
which can now be used in your commands.
// get a list of all tables starting with "catalog"
$tables = $this->getHelper()->resolveTables(array('catalog*'));
// Define table groups and call it
$definitions = array(
'test123' => array('tables' => 'catalog\_*'),
'dataflow' => array('tables' => 'dataflow_batch_import dataflow_batch_export')
);
$tables = $this->getHelper()->resolveTables(
array('@test123', '@dataflow'),
$definitions
);
We also added three new functions created by Dmitriy Zavalkin to check i.e. the
MySQL user permissions.
Define a role in admin:user:create command
The admin:user:create command got a new argument to define an existing user role.
Better Configuration Variable Resolving
We added support for the variables %module%
in all module configurations.
In the past the variable was only available in the autoloader config.
This feature also relates to the variable %root%
which contains the path
to detected Magento root dir. The variable can now be used in every part of your system, user and project config.
This offers you new features like registrating an own script folder in your project or module config.
Example Module Config:
script:
folders:
- %module%/res/scripts
This defines a script folder inside your n98-magerun module.
Bugfixes
We fixed two bugs.
- dev:module:rewrite:conflict command: Dont instantiate classes when checking inheritance (by Luke Rotherfield)
- LogicException thrown by script:repo:list where no script directories exist
(by David Alger)
Thanks to all who provide us ideas, pull requests and motivation.
Have fun with new n98-magerun release!
0 Comments