Wiz is a CLI interface for Magento. It aims to provide useful functionality for developers and administrators in a powerful and scriptable CLI format.
How do I use it?
- Install it (instructions below).
- Navigate to a Magento directory.
- Run the program by calling
- Optionally, you can set the
WIZ_MAGE_ROOTenvironment variable to always point Wiz to a specific location. If you have multiple sites and want to be able to manipulate multiple sites without having to navigate through directories, you can do this:
alias wiz1="WIZ_MAGE_ROOT=/path/to/site1 ~/bin/Wiz/wiz" alias wiz2="WIZ_MAGE_ROOT=/path/to/site2 ~/bin/Wiz/wiz"
Now you can run
wiz1from any location and it will run inside the context of the site1.
Setup instructions (for the less technical)
- Download Wiz and uncompress it somewhere (probably your Downloads folder)
- Open up a shell, type this in:
mkdir -p ~/bin/Wiz; open ~/bin/Wiz
- Copy all of the files from the folder that was uncompressed into ~/bin/Wiz. It should be the readme, the app directory, wiz and wiz.php.
- Using a text editor, add the following to the .bash_profile in your home directory:
- If you are using Zend Server, you will also need to add the path to PHP 5.2 (since Wiz requires PHP 5.2 at the moment). On OSX, you would add this to your .bash_profile:
To enable bash shell command/TAB completion, put/append the following in
$WIZ_HOME above with the folder location where you extracted Wiz)
Now you can type:
wiz <TAB> to get a list of commands. Futher
Magento Scope Code
By default, Wiz runs inside of the
admin scope. This is great for most operations. However, you may require running Wiz inside of a particular scope.
You can specify the scope Wiz initializes Magento with by specifying the following options:
By leaving off the id or scope, Wiz will use the default store or website (passing in a blank code).
Wiz now supports the ability to change the table output for batch handling:
If passed without a parameter, csv is the default. Examples:
$ wiz devel-config --batch
$ wiz devel-config --batch pipe
$ wiz devel-config --batch tab
You get the idea. Internally, it uses fgetcsv(), so it should treat your data well.
What can it do?
Functionality is being added to Wiz as time allows. Currently, Wiz has the following commands. Please understand that not all of these commands have been tested on every version. Commands that have not been tested or are in beta are noted as such.
Dumps a CSV of all SKUs in the catalog in the first column and the link to the product in the second column. Useful for generating redirects or just plain exporting all product URLs.
Dumps a CSV of all Categories in the catalog in the first column and a link to the product in the second column.
Generates .htaccess compatible 301 redirects. Takes a path to a CSV file as parameter. CSV file will have the old URL and the SKU as column. The command will cycle through each SKU and create redirects from the old URL to the new URL using the SKU.
Takes an XML Sitemap and converts it to CSV. This functionality is not quite finished yet.
admin-createadmin <username> <firstname> <lastname> <email> <password>
Creates an Administrative user in the backend. Has been tested in both CE, PE, and EE. If you don't pass the argument, you will be promtped for them.
Disables an administrative user.
Enables an administrative user.
Lists the name, e-mail address, and status of every admin in the system.
Resets the password of an admin user.
Set the cookie lifetime for admin sessions.
Clears the Magento caches.
- all - Clears Magento's system cache, general caches, js&css, and images caches.
- invalidated - Refreshes all invalidated caches.
- system - Clears Magento's system cache
- images - Clears the images cache
Enables Magento caches.
Disables a Magento cache.
Lists the status of the caches.
Gets a configuration value from the global Magento config.
config-xpath <xpath query>
Runs an XPath query over Magento's configuration object. For more information on what XPath can do, go check out this W3School Article on XPath.
Dumps Magento's config as XML. The default is pretty output, but you can pass the ugly parameter to get no newlines or tabs.
Lists the jobs that are defined to run when the default cron job is execute. An interesting point here: the jobs that are defined and listed here do not actually run when the cron event gets dispatched from cron.php. At least… not directly. Those jobs are actually managed and executed by the default cron listener (which is provided by Mage_Cron).
Lists the event listners that fire when the cron executes.
Runs the cron by firing off the default cron event.
Without any options, this command simply shows you the global status of template hints and template hint blocks. By passing it an option, you can either disable or enable template hints globally. Note that if a site has overridden this value via the system config in the dashboard, it will not have any effect for that site.
Enable, disable, or view the status of Magento's logging.
Added in Magento 184.108.40.206, you can now specify the ability to use symlinks for templates. With this command, you can enable, disable, or view the status of it.
Shows all of the devel configuration path statuses. Useful for just seeing what is enabled.
Enable, disable, or view the status of Magento's profiler.
Enable, disable, or view the status of JS Merging.
Enable, disable, or view the status of CSS Merging.
Returns a list of all of the registered listeners. This will give you a list of observer events and what functions (along with their modules) that will respond to those events.
Outputs a list of models that registered with Magento's runtime. For regular extension model definitions (not rewrites), it will show you the model prefix (e.g. "catalog/*") and the module prefix that will handle it (e.g. "Mage_Catalog_Model_*").
For rewrites, it will show you the overridden model name and the module class that will be used instead.
Shows the current status of all indexes.
Reindexes an index.
Sets the index to update on save.
Set the index to reindex manually.
Displays the status of the logging tables.
Cleans Magento's logging tables.
Display's Magento's version.
Runs a PHP Script after bootstrapping Magento. Useful for testing code or writing scripts that need to run inside of Magento without having to write a full-fledged module or a sandbox.
Shuts down Magento by creating the maintenance flag file.
Allows Magento run by removing the maintenance flag file.
Downloads a Magento connect package. Yes, I know you can use ./mage but this also works.
Lists the available versions of a module that you can download from Magento Connect.
Displays a list of all modules on the system. Shows module name, version, active, output, and code pool.
+------------------------------+------------+--------+----------+-----------+ | Module Name | Version | Active | Output | Code Pool | +------------------------------+------------+--------+----------+-----------+ | Mage_Core | 0.8.26 | Active | Enabled | core | | Mage_Eav | 0.7.15 | Active | Enabled | core | | Mage_Page | 0.7.0 | Active | Enabled | core | | Mage_Install | 0.7.0 | Active | Enabled | core | | ... | ... | ... | ... | ... | +------------------------------+------------+--------+----------+-----------+
module-enable <module> [<module2>, ..., <modulen>]
Enables one or more modules by modifying their config file's active flag.
module-disable <module> [<module2>, ..., <modulen>]
Disables one or more modules by modifying their config file's active flag.
module-enableoutput <module> [<module2>, ..., <modulen>]
Enables output for one or more modules.
module-disableoutput <module> [<module2>, ..., <modulen>]
Disables output for one or more modules.
Shows Magento's SQL configuration.
Launches a MySQL command line session directly to Magento's database.
Executes a query against the Magento database.
Shows a list of stores, groups, and websites. Like a boss.
Lists all of the available commands. This will run by default.
Displays more information about a command. These are pulled from the Docblocks in the source code.
Wiz is licensed under the OSL 3.0.