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.
Installation
You need to install the files in your n98-magerun module folder.
mkdir -p ~/.n98-magerun/modules/
cd ~/.n98-magerun/modules/
git clone [email protected]:peterjaap/magerun-addons.git
Commands
After the installation you should see this new commands:
- media:sync
- sys:store:config:base-url:set
- customer:clean-taxvat
- dev:events:fire
- extension:translations
- extension:disable
- extension:enable
Media Sync
The media sync command lets you sync the media folder over SSH or FTP.
Please note that you require rsync for SSH mode and ncftpget for FTP mode.
The SSH/FTP credentials can be configured in app/etc/local.xml configuration file.
<config>
<global>
...
<production>
<ssh>
<host>yourhost.com</host>
<username>yourusername</username>
<path>public_html</path>
</ssh>
... OR ...
<ftp>
<host>yourhost.com</host>
<username>yourusername</username>
<password>yourpassword</password>
<path>public_html</path>
</ftp>
</production>
...
</gobal>
</config>
After that you can start your media sync with a simple call.
$> n98-magerun.phar media:sync
For more informations refer the README on the github page: https://github.com/peterjaap/magerun-addons#sync-media-over-ssh-or-ftp
Set Base-URLs
This is the counterpart to the sys:store:config:base-url:list command.
Now it’s easy to select a store and set the base-url.
$> n98-magerun.phar sys:store:config:base-url:set
Do you want to set the base URL for the main shop or for a storeview?
[0] Main shop
[1] Storeview
> 0
Base URL: http://magento.local/
Unsecure base URL? [http://magento.local/]http://magento.local/
Secure base URL? [https://magento.local/]http://magento.local/
Use secure base URL in frontend? [no]
Use secure base URL in backend? [no]
Unsecure base URL for store Admin [admin] set to http://magento.local/
Secure base URL for store Admin [admin] set to http://magento.local/
Clean up customers’ taxvat fields
This command is was designed for store owners to cleanup the entered Tax/VAT numbers.
It normalizes the numbers and removes wrong country prefixes.
$> n98-magerun.phar customer:clean-taxvat
Dispatch/fire a Magento event
A dev command which is very useful to test an observer. It offers you a select with 336 options!
Select your event and enter additional parameters. If an observer needs a complexer value (not only a scalar values)
it’s possible to load a model by a special syntax “Mage_Catalog_Model_Product:1337”.
$> n98-magerun.phar dev:events:fire
Select event to fire
[0 ] add_synchronize_message
[1 ] admin_permissions_role_prepare_save
[2 ] admin_session_user_login_failed
[3 ] admin_session_user_login_success
[4 ] admin_system_config_changed_section_currency
[5 ] admin_system_config_changed_section_currency_before_reinit
[6 ] admin_system_config_section_save_after
[7 ] admin_user_authenticate_after
[8 ] admin_user_authenticate_before
[9 ] adminhtml_block_eav_attribute_edit_form_init
[10 ] adminhtml_block_html_before
[11 ] adminhtml_block_html_before
[12 ] adminhtml_block_promo_widget_chooser_prepare_collection
[13 ] adminhtml_block_salesrule_actions_prepareform
[14 ] adminhtml_block_system_config_init_tab_sections_before
[15 ] adminhtml_cache_flush_all
[16 ] adminhtml_cache_flush_system
[17 ] adminhtml_cache_refresh_type
[18 ] adminhtml_catalog_category_edit_prepare_form
...
To save time you can pass all parameters from command line.
$> n98-magerun.phar dev:events:fire --event your_event_that_will_fire \
--parameters "product::Mage_Catalog_Model_Product:1337;testparam::testvalue"
Find translations
This command lets you choose a language and a extension. The it searchs for translatable strings.
Which language do you want to check translations for? [nl_NL] de_DE
Select extension to check for translations
[0 ] Mage_Core
[1 ] Mage_Eav
[2 ] Mage_Page
...
> 111
Extension N98_AdminGuestOrder found in codepool local
All found translation strings in the extension N98_AdminGuestOrder:
Filename: www/app/code/local/N98/AdminGuestOrder/Block/Adminhtml/Sales/Order/Create.php:
Submit Order as Guest
Translation de_DE: NOT FOUND
===============================================================================================================================
Copy/paste this into app/locale/de_DE/N98_AdminGuestOrder.csv and add the translations;
"Submit Order as Guest","Submit Order as Guest"
Enable/Disable Extensions
In the last n98-magerun 1.93.0 we added commands to enabled/disable modules. This is done by changing the app/etc/modules XML files.
This commands do the same in a different way. It renames the module file itself and appends “.disabled”.
$> n98-magerun.phar extension:disable
$> n98-magerun.phar extension:enable
Conclusion
I really like the extension:translate command which safes much time if you create a new shop.
Also the dev:fire:event command helps me as developer to work more efficiently.
Thanks Peter for this great addon.
1 Comment
Magento-Neuigkeiten der Wochen 51/52 2014 · December 28, 2014 at 07:02
[…] Zwei magerun-Addons erweitern das Tool um Admin-Rollen-Befehle und diverse Entwicklungs-Hilfs-Befehle. […]