Magerun

Magerun is a very useful commandline tool for dealing with daily Magento development problem like:

  • clean / flush caches
  • reindexing the indices
  • set configuration values in the database (core_config_data)
  • shorthand query syntax for database accesses

It’s developed by netz98 (http://www.netz98.de/) and made my daily business so much easier.

Installation (Linux)

$> wget https://raw.githubusercontent.com/netz98/n98-magerun/master/n98-magerun.phar
$> chmod +x ./n98-magerun.phar
$> sudo cp ./n98-magerun.phar /usr/local/bin/ #make it runs from everywhere

GIT repository and docs can be found here: https://github.com/netz98/n98-magerun.

If you want to run Magerun in an Apache context, you have to tell your Apache, that .phar is an executable php file ending:

F.e. Apache configuration:

AddType application/x-httpd-php .php .phar

To use Magerun everywhere in your file system, you can define a bash_alieas.

F.e.: .bash_alias under Debian / Ubuntu
alias magerun="n98-magerun.phar --root-dir=/var/www/magentoroot/"
 The parameter root-dir depends on your Magento project root directory.

Updates

Updates can be done vial Magerun itself:

n98-magerun.phar self-update
# or over alias
magerun self-update

Usesage examples

Here are some examples for the power of this tool:

  • Reset Admin Password
    $> magerun admin:user:change-password
  • Set system config value
    $> magerun config:set "web/unsecure/base_url" "http://ask-sheldon.com"
  • Dump system config
    $> magerun config:list
  • Clean caches
    $> magerun cache:clean
  •  Flush cache storages
    $> magerun cache:flush
  • Query database
    $> magerun db:query "SELECT * FROM core_config_data"
  • Run step wise setup scripts
    $> magerun sys:setup:incremental
  • Reindex
    $> magerun index:reindex:all

More information

 

1 thoughts on “Magerun

Leave a Reply

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.