maria-axe / Wiz

Wiz aims to be a CLI counterpart to Magento, allowing developers and admins to create plug-ins and script Magento operations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IMPORTANT NOTICE

Wiz is no longer maintained and may or may not work with current versions of Magento. There are also no plans on porting it to work with Magento 2. It is reccomended that you use n98-magerun as an alternative.

Wiz

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?

  1. Install it (instructions below).
  2. Navigate to a Magento directory.
  3. Run the program by calling wiz.
  4. Optionally, you can set the WIZ_MAGE_ROOT environment 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 wiz1 from any location and it will run inside the context of the site1.

Setup instructions (for the less technical)

  1. Download Wiz and uncompress it somewhere (probably your Downloads folder)
  2. Open up a shell, type this in: mkdir -p ~/bin/Wiz; open ~/bin/Wiz
  3. 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.
  4. Using a text editor, add the following to the .bash_profile in your home directory:
    alias wiz="~/bin/Wiz/wiz"
  5. 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:
    export WIZ_PHP_PATH="/usr/local/zend/bin/php"

Bash Completion

To enable bash shell command/TAB completion, put/append the following in ~/.bash_completion file:

source $WIZ_HOME/wiz.bash_completion.sh

(replace $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:

--store [id|code]

--website [id|code]

By leaving off the id or scope, Wiz will use the default store or website (passing in a blank code).

Output Mode

Wiz now supports the ability to change the table output for batch handling:

--batch [csv|pipe|tab]

If passed without a parameter, csv is the default. Examples:

$ wiz devel-config --batch
Path,Value
dev/debug/profiler,No
dev/js/merge_files,No
.../code>

$ wiz devel-config --batch pipe
Path|Value
dev/debug/profiler|No
dev/js/merge_files|No
...

$ wiz devel-config --batch tab
Path Value
dev/debug/profiler No
dev/js/merge_files No
...

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.

301-urlskumap

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.

301-urlcatmap (BETA)

Dumps a CSV of all Categories in the catalog in the first column and a link to the product in the second column.

301-htgen (BETA)

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.

301-xmlsm2csv (UNSTABLE)

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.

admin-disable <username>

Disables an administrative user.

admin-enable <username>

Enables an administrative user.

admin-list

Lists the name, e-mail address, and status of every admin in the system.

admin-resetpass

Resets the password of an admin user.

admin-timeout

Set the cookie lifetime for admin sessions.

cache-clear [all|invalidated|system|js|css|jscss|images]

Clears the Magento caches.

Optional parameters:

  • all - Clears Magento's system cache, general caches, js&css, and images caches.
  • invalidated - Refreshes all invalidated caches.
  • system - Clears Magento's system cache
  • js, css, jscss - Clears the JavaScript & CSS cache.
  • images - Clears the images cache

cache-enable <name>

Enables Magento caches.

cache-disable <name>

Disables a Magento cache.

cache-status

Lists the status of the caches.

config-get <nodepath>

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.

config-asxml [--ugly]

Dumps Magento's config as XML. The default is pretty output, but you can pass the ugly parameter to get no newlines or tabs.

cron-jobs

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).

cron-listeners

Lists the event listners that fire when the cron executes.

cron-run

Runs the cron by firing off the default cron event.

devel-showhints [true|false|yes|no|1|0|totally|nah]

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.

devel-logging [true|false|yes|no|1|0|totally|nah]

Enable, disable, or view the status of Magento's logging.

devel-allowsymlinks [true|false|yes|no|1|0|totally|nah]

Added in Magento 1.5.1.0, you can now specify the ability to use symlinks for templates. With this command, you can enable, disable, or view the status of it.

devel-config

Shows all of the devel configuration path statuses. Useful for just seeing what is enabled.

devel-profiler [true|false|yes|no|1|0|totally|nah]

Enable, disable, or view the status of Magento's profiler.

devel-mergejs [true|false|yes|no|1|0|totally|nah]

Enable, disable, or view the status of JS Merging.

devel-mergecss [true|false|yes|no|1|0|totally|nah]

Enable, disable, or view the status of CSS Merging.

devel-listeners

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.

devel-models

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.

indexer-status

Shows the current status of all indexes.

indexer-reindex <index>

Reindexes an index.

indexer-realtime <index>

Sets the index to update on save.

indexer-manual <index>

Set the index to reindex manually.

log-status

Displays the status of the logging tables.

log-clean

Cleans Magento's logging tables.

magento-version

Display's Magento's version.

magento-script

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.

magento-shutdown

Shuts down Magento by creating the maintenance flag file.

magento-startup

Allows Magento run by removing the maintenance flag file.

mc-dl

Downloads a Magento connect package. Yes, I know you can use ./mage but this also works.

mc-versions

Lists the available versions of a module that you can download from Magento Connect.

module-list

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.

sql-info

Shows Magento's SQL configuration.

sql-cli

Launches a MySQL command line session directly to Magento's database.

sql-exec <query>

Executes a query against the Magento database.

store-list

Shows a list of stores, groups, and websites. Like a boss.

command-list

Lists all of the available commands. This will run by default.

help

Displays more information about a command. These are pulled from the Docblocks in the source code.

License

Wiz is licensed under the OSL 3.0.

About

Wiz aims to be a CLI counterpart to Magento, allowing developers and admins to create plug-ins and script Magento operations.


Languages

Language:PHP 97.9%Language:Shell 2.1%