Categories
Magerun

n98-magerun2 – Project Update 2014-12

n98-magerun2 Updated

Last month we started the development of Version 2 of n98-magerun which will only run with Magento 2.
After the official release of Magento 2 Dev-Beta 1 we must change some parts of the tool according to some refactored stuff in Magento 2.
If you checkout the code on github please note that we port any command one at a time.
This is why we don’t only add the same features, we also refactor all the code we put into the n98-magerun2 code base.

As one of the first thing we did a complete refactor of the “install” command.

Installer

The new installer got a big refactoring. All the code is now organized in sub-commands. Sub-Commands are a new feature which should help us to cluster code of big commands (like the installer) into peaces of small code which is much better to extend and maintain.

The sub-command classes can be found in new namespace N98\Magento\Command\SubCommand.
There is an interface which must be implemented and a Abstract class which does the most the of work for you.

n98-magerun2-subcommands

The main installer commands like like this now:

Is that great? I hope you can see the difference.

The new installer command works like in Version 1 with one big difference. The main repository will be cloned and
all depencies are now fetched by composer. If you have composer installed on your system and n98-magerun2 can find
it we use the existing composer to install packages. If composer cannot be found we download and install composer
automatically in the new created Magento 2 root folder. So you can use composer after the installation.

Currently we found an issue in the sample data composer package. We hope the issue will be resolved soon.

Test System

We setup Travis for our QA. Like Magento 2 we dropped support for 5.3 and test only PHP 5.4 and PHP 5.5.
Magento 2 requires also at least MySQL 5.6. This is not available on Travis servers. How can we test now with Travis?
We looked at Magento 2 Travis file and found the solution. Travis supports installing 3rd party packages on testing platform.
This can be done, because after every build a snapshot of the system (before the test) will be restored.
So we copied the travis file code into ours and now we are able to test the complete n98-magerun installation.
Thanks to the Magento 2 core developers for the great setup.

The unit test framework is now also up to date to start test driven development.

https://travis-ci.org/netz98/n98-magerun2/builds/45283372

DB Commands

We already ported all DB related commands from Version 1.

  • db:console
  • db:create
  • db:drop
  • db:dump
  • db:import
  • db:info
  • db:maintain:check-tables
  • db:query
  • db:status
  • db:variables

There are some changes from Magento 1 to Magento 2. The first thing we investigated was the removed app/etc/local.xml file.
The config is now saved in the new file app/etc/config.php. This change to PHP offers us some new capabilities. The config can now contain ENV vars which is great in combination with i.e. docker.
The bad part is that other systems cannot process them like the old XML file.

In n98-magerun2 we changed the DatabaseHelper. The base config is now loaded in MagentoHelper.
If you need the base config you can load the config array in a command without Magento initalization.

The DB part could be refactored so that no code-change is needed.
The DB settings can be loaded like in “n98-magerun 1”.

If you are wondering where the tests are located… we added a new “dev” folder in the project root.

Please help us to test the n98-magerun2 code. We also accept pull requests for the develop branch. Please don’t update
the phar file. The phar file only exists in the master branch. We don’t build it in the develop branch.

If you search for the new features in master branch… We have not merged it yet. The phar file is not up to date.
Please use the develop branch to test the new features.

Categories
Magerun

MageRun Addons by Peter Jaap Blaakmeer

This article is part of a series covering 3rd party n98-magerun modules/extensions.

In this post we cover a 3rd party n98-magerun module created by Peter Jaap Blaakmeer which adds some new commands to your list.

Categories
Magerun

Released n98-magerun Version 1.93.0

n98-magerun_1_93_0

The year is nearing its end fast and we have bundled a new n98-magerun release for you. The version contains some new commands, enhancements (listed at the end of the post) and updated Symfony components to 2.6.

New Features

Unlock Admin User

Any user of the Enterprise Edition had this. If have enabled automatic user locking you must wait some time
if user will be unlocked.
Now you can unlock any user with the new admin:user:unlock command.

  • #399 Admin user unlock [EE only] (by Steve Robbins)

Clean multiple caches at once

It’s now possible to pass more than once cache identifier to the cache:clean command.

  • #415 Clean multiple caches at once (by Michael Barrett)

Better Cache Handling

Alan Storm optimized the cache initialization. I some cases we recreated the already initialized cache. This is now fixed.

  • #418 Use already instantiated cache object. (by Alan Storm)

Enable/Disable Module (by definitions)

Enable or disable a module in app/etc/modules/*.xml by name or codePool:

Examples with codepool option:

Please not that the codepool option affects ALL modules of the codepool.

  • #421 enable or disable a module based on name or codepool (by Steve Robbins)

DB-Status / Variables

Cyrill Schumacher added two new command to the db namespace.

db:variables -> Print all important MySQL variables

db_variables

db:status -> Print status informations like the current used InnoDB Buffer Pool hit rate.

db_status

  • #435 New db:status and db:variable commands (by Cyrill Schumacher)

Refactored bash completion script

On some platforms the current version of the bash complection script is not working. Johannes Klein provided a refactored bash completion script which contains a workaround for some problematic PHP versions.
We got also a patch by Paweł Bogut which is not needed anymore because we can provide a command list which is parsable without a regex.

Other Improvements

  • Minor documentation corrections (by Jaik Dean)
  • Refactored db:maintain:check-tables to allow InnoDB and Memory tables to be optimized. (by Cyrill Schumacher)
  • Bash completion – change regexp condition to string contains. (by Paweł Bogut)
  • Updated Symfony components to V2.6
  • Updated locked phpunit version.
  • #423 db:import –drop does not take into account the “only-command” option (by Michael Lühr)
  • #429 Install command ignores skin folder of 1.9.0.0 sample data (by Vinai Kopp)
  • #436 Alternative Installation Port is not respected (by Christian Münch)
  • #440 Added Magento CE 1.9.1.0 to installer (by Rouven Rieker)
Categories
Magerun

n98-magerun 2 development started

n98-magerun2-dev

As already posted on MageHero we started the development of a seperate n98-magerun version for Magento 2.
We decided to create a complete new version and against some other options like to create a “clone command” or sperate lib inside the same phar file.

The purposes are:

  • The phar file will be too big (> 4MB)
  • The Magento 2 framework is too different
  • We need a clean development start
  • Maintenance!

If you like to test the current unstable development version you can checkout the existing source code on github.

https://github.com/netz98/n98-magerun2

Please note that all development is done in develop branch.
During development we don’t create any phar file inside the git repository.
Pull requests are only accepted for develop branch.

You can checkout everything by running this commands:

It’s a good idea to create an alias.

After that you can run “n98-magerun-dev2” in your Magento 2 test installation.

Categories
Magerun

Released n98-magerun Version 1.92.0

We have deployed a new n98-magerun version with only one new command but many improvements which makes the
tool more stable in daily usage.

New features/optimizations

Disable root warning

root_warning

It’s now possible to supress the “It’s not recommended to run n98-magerun as root user” warning.
This can be useful i.e. during a deployment which runs as root-user. In this case you can create
a system wide config on the remote host in file “/etc/n98-magerun.yaml” with this content:

  • #332 make WARNING_ROOT_USER configurable/optional (by Christian Münch)

Remove setup resources

Removes the entry for one or all module resource setups. This command is useful if you want to re-run an install
script again possibly due to debugging. Alternatively you would have to remove the row from the database manually.

  • #392 Add remove setup resource command (by Aydin Hassan)

Create dummy users with addresses

A new option was added to the customer:create:dummy command which allows automatic address creation.

customer_addresses

  • #397 Added option to create dummy customer with an address (by Gilles Doge)

Better observer list

A new event area “crontab” was added. All events are now sorted and the type of the observer is visible in the table.

observer_list

  • #413 Enhanced dev:module:observer:list (by Cyrill Schumacher)

Improvements

  • #387 Unlink sym-linked folders instead of recursively removing (by Aydin Hassan)
  • #390 Some documentation updates (by Aydin Hassan)
  • #391 Fixed broken filters in dev:module:list command (by Tjerk Ameel)
  • #393 Optimize failing on long lines (by Alexander Menk)
  • #400 Added adminhtml_cache_refresh_type event (by Marc Päpper)
  • #403 Sys setup incremental tiny fixes (by Cyrill Schumacher)
  • #407 Check for Enterprise_PageCache presence before using it (by Vinai Kopp)

Other updates and fixes

  • Changed db:dump strip settings (by Alexander Menk)
  • Updated 3rd party components (Symfony, PHPUnit, Twig)

Please update to the latest version by:

I hope the new version let you more efficient in the daily work with Magento. Have fun!

Categories
Magerun

Interview in Regalsprecher-Blog about n98-magerun development (German)

I gave an interview in the german Blog Regalsprecher about
the start of n98-magerun development and the ideas behind the tool.
The blog post is written in german. If you are able to understand the beautiful german language we would be happy if you can leave a comment.

The post can be found here: http://www.netz98.de/regalsprecher/magerun/

Categories
Magerun

HarrisStreet ImpEx for Magento

This article is part of a series covering 3rd party n98-magerun modules/extensions.

In this post we show you another great module to manage your Magento configurations. It supports importing and exporting of store config data in a hierarchical folder structure. This can be done for different environments.

The module was created by Zookal pty ltd the largest student portal in Australia.

Categories
Magerun

Released n98-magerun version 1.91.0

We are happy to present you a new stable release of n98-magerun.
The new release contains many new features and some enables users of Microsoft Windows some features which was only
available for MacOS/Linux users.

Let’s see what we have changed since the last release…

Remove Admin-Users and Customers

We have two new commands to remove admin (backend) users and (frontend) customers.

Customers can be deleted by a ID range or by defining a email address.

Example:

As analog command we have the new command to delete an admin user:

  • #370 Remove Admin Users (by Aydin Hassan)
  • #380 Customer delete command (by Michael Woodward)

Better Microsoft Windows Support

We added support for user config and n98-magerun modules.
Now you can add your own user specific config in %userprofile% folder. To make it a little bit easier we removed the leading
dot which is normal on Unix but could produce problems on Windows machines.
A system wide config is also possible under the path %windir%\n98-magerun.yaml

For an overview please refer the wiki pages:

Generate model method for magic getter/setter

We added our first command to a new command namespace “code”. The namespace is designed to add code generator command to n98-magerun.
We start with a command to generate getter/setter of models.

Before (do not use this with code models):

method_annotations_after

After:

method_annotations_before

  • #376 New command dev:code:model:method (by Cyrill Schumacher)

Change Resource Versions

A very useful new command sys:setup:change-version allows you to set the version of a single resource setup or of all
resource setups of a module from cli.

  • #382 Change module version command (by Michael Woodward)

Other fixes and enhancements

  • #299 Removed header if format parameter is passed (by Christian Münch)
  • #303 Please warn instead of blocking input (by Christian Münch)
  • #315 sys:setup:run on enterprise requires admin session. (by Thorsten Essig and Christian Münch)
  • #362 db:import –optimize: Cut line in 8MB pieces (by Alexander Menk)
  • #367 Exclude sessions from @stripped (and therefore @development) (by Aaron Brady)
  • #368 Skip sys:setup:incremental’s Version Check (by Alan Storm)
  • #369 get use_rewrites/use_secure from config (Kristof Ringleff)
  • #352 Added –stop-on-error option. (by Christian Münch)
  • #372 print root warning to std_error (by Edward Rowley)
  • #373 Refactored local-config:generate command (by Rouven Rieker)
  • sys:info command: Added row count for main entities (by Christian Münch)
  • sys:setup returns exit status code “1” if setup fails (by Christian Münch)
  • Updated 3rd party components (Symfony, PHPUnit, Twig)

Update

Please run n98-magerun.phar self-update to fetch the new version.

Categories
Magerun

LimeSoda Environment Configuration

This article is part of a series covering 3rd party n98-magerun modules/extensions.

The next article presents a solution to manage several developer, staging, production environements with a n98-magerun module and and a Magento module (can be installed at once).
If you have multiple Magento environments i.e. for all your developers you know the problem. Someone dumps a database and share it with another developer. Now every developer runs in the same boring issue. Changing the configuration according to the current environment. The list of configurations grows and grows… You know the problems.

At this point the solution of Limesoda can help you.

Installation

You need to install the file directly in your Magento installation via modman.

After the installation you must define the name of your config environment. This can be done in config.xml (in this case
the app/etc/local.xml file).

Define your dev-environment:

Default environment

Create a new Magento module to define a config. Add a global > limesoda > environments node to your config.xml file.

This was easy! We have our first default environment defined.

Now we can run n98-magerun with the new embedded command.

The output is currently empty, because our environment has no commands defined.

Define commands

Now we extend the previous config and add some n98-magerun commands. You can call every n98-magerun command as batch.

This calls two config settings and a cache flush sequentially.

Using variables

If you look at the previous example you see that we used the same url two times. Let’s create a varible for that and see how simple is is to use a variable.

Run n98-magerun again and you should see that output:

Nesting environments

This was very cool, but nesting the environments is really hot!
Let’s do it.
You can do it by adding the attribut parent to your environment definition in XML.

A typical setup could be:

Now we define this setup in our config:

The command processes your configs recursivly. That’s the power of the LimeSode Environment Configuration module.

If you like this way to manage your environments give the modules a change.
You can fetch the module from github.

https://github.com/LimeSoda/LimeSoda_EnvironmentConfiguration

Categories
Magerun

MageRun Addons by Kalen Jordan

This article is part of a series covering 3rd party n98-magerun modules/extensions.

Kalen Jordan (creator and founder of MageMail) is one of our longest n98-magerun users and contributors.
He was the first who published a 3rd party module with some nice commands. That’s what i like to present you now (mostly copied from module README).

You can find the module here: https://github.com/kalenjordan/magerun-addons

Installation is really simple:

Bust Frontend Browser Caches

This command modifies the skin and js base URLs with a timestamp-specific URL, so that browsers will pull down fresh CSS and JS.

It’s intended to be used in conjunction with a web server rewrite rule that will rewrite, for example:

to

Create dummy order

This command can create some dummy orders. It’s marked as experimental but could help you to create dummy data in your shop i.e. for performance tests.

Assign order to new customer

This command can assign an order to a new customer by ID.
This is very experimental – doesn’t modify all of the places that customer data exists on the order models, such as the shipping and billing address – just the customer name, email, ID on the order entity.

Example:

Assigns the order #10000000001 to customer ID 10.

Anonymize customer data

Anonymize customer data across a bunch of tables: order, order address, newsletter, quotes, newsletter subscriber.

Core file diff / Theme diff

This command can diff core files to see if they have been modified.
The command depends the command line tool diff which should be installed on all unix based systems.

kalen_addons1

kalen_addons2

Same functionality for theme files:

See what customizations have been made in your custom theme against the base theme.

Grab mailchimp unsubscribes

Grab all of the mailchimp unsubscribes to your primary list

If you’re using Ebizmarts_MageMonkey to manage your Mailchimp integration, this will allow you to grab a list of all of the unsubscribed emails to your primary list.

The main purpose for doing this is if you need to import these unsubscribes somewhere. The routine will dispatch an event mailchimp_list_unsubscribe_discovered which you can observe in order to handle them.

Uninstall a module

ninstall a module by deleting all the module’s files and removing database tables.

NOTE: This is not fully baked yet, at the moment it just deletes the main module config file and the code directory. Pretty trivial, but I’m going to add in database tables, layout files, template files, etc.

Generate gift card codes

The missing tool to generate EE gift card codes!