Se tem uma ferramenta que se tornou indispensável pra mim no desenvolvimento para Magento, é a Wiz. Trata-se de uma aplicação de linha de comando, que permite que façamos diversas operações no magento direto pelo terminal usando apenas linhas de comando simples dentro de qualquer pasta de uma loja magento.
Tem várias utilidades, como por exemplo:
- Habilitar/desabilitar os templates hints – wiz devel-showhints [true/false]
- Resetar senha de um usuário do admin – wiz admin-resetpass [usuario]
- Verificar status do cache – wiz status-cache
- Desativar o cache – wiz cache-disable
- Reindexar tudo – wiz indexer-reindex all
E há uma dezena de outros comandos que podem ser vistos digitando:
$ wiz command-list Available commands: 301-urlskumap Generates a CSV-compatible SKU to URL mapping output. 301-urlcatmap Outputs a list of category to URL mappings. 301-htgen Generates htaccess 301 redirects for the current magento site. 301-xmlsm2csv Converts a Google Sitemap XML file to a CSV File. admin-disable Disable an administrative user. admin-enable Enable an administrative user. admin-list Lists the backend users in Magento. admin-resetpass Resets an admin user's password. admin-createadmin Creates an admin user in the Magento backend. admin-timeout Sets or displays the admin session timeout value. admin-resources Displays a full list of resources that are defined by modules in Magento. cache-clear Clear the Magento caches. cache-enable Enables all caches if "all" or no params are passed. cache-disable Disables caches by name. cache-status Returns the status of all or named caches. config-get Returns the value stored in Magento for the given config path. config-storeget Retrieve a single store configuration node path. config-xpath Performs an Xpath query over the Magento configuration structure and returns the config-asxml Returns the entire Magento config as nicely formatted XML to stdout. cron-jobs Returns a list of registered crontab jobs. cron-listeners Lists the event listeners that will execute when cron runs. cron-run Runs the cron. database-export Dumps the store database into a file. devel-showhints Enables, disables, or displays the value of template hints. devel-logging Enables, disables, or displays the status of logging in Magento. devel-allowsymlinks Enables, disables, or displays the value of symlinks allowed for templates. devel-config Dumps a set of useful devel configuration values. devel-profiler Enables, disables, or displays the status of the profiler. devel-mergejs Enables, disables, or displays the status of JS Merging. devel-mergecss Enables, disables, or displays the status of CSS Merging. devel-listeners Returns a list of registered event observers. devel-models Returns a list of model names to class maps. devel-events Attempts to output a list of dispatched Magento Events. indexer-status Displays the status of the specified indexing processes. indexer-reindex Reindexes the specified processes. indexer-realtime Changes the status of the indexing processes to "Update on Save". indexer-manual Changes the status of the indexing processes to "Manual". log-status Displays statistics for each log table. log-clean Cleans Magento's database logs. magento-version Returns the version of Magento that Wiz is currently pointing to. magento-script Executes PHP file after bootstrapping Magento. magento-shutdown Shuts down Magento by creating the Maintenance flag. magento-start Removes the maintenance flag, allowing Magento to run. mc-dl Downloads a Magento Connect package. mc-versions Get the versions that are available on Magento connect for a given Magento Connect key. module-list Lists all of the modules that are currently installed on the Magento installation, module-enable Enables a module. module-disable You can pass a module name or a list of module names seperated module-enableoutput Enables output for a module. module-disableoutput Disables output for a module. sql-info Returns information about the database resource connection. sql-cli Opens up a shell command directly to the the database server. sql-exec Executes a query against the database. store-list Lists all of the stores, store codes, and websites on the magento installation. command-list List all available actions that Wiz can perform. help Gives you help on a command.
Como instalar
Pra instalar o Wiz é bastante simples.
Faça download (ou git clone) da ferramenta no github (https://github.com/classyllama/Wiz) e salve na pasta de sua preferência.
No Mac/Linux
Abra seu arquivo ~/.bash_profile ou ~/.bashrc (linux) e acrescente a seguinte linha:
export WIZ_PHP_PATH="/caminho/pro/seu/php/bin/php" source /caminho/do/wiz/Wiz/wiz.bash_completion.sh alias wiz="/caminho/do/wiz/Wiz/wiz"
No Windows
No windows, como não temos um terminal decente, usei o git-bash para configurar o alias.
A diferença no windows, é que preciamos criar duas variáveis de ambiente:
- WIZ_PHP_PATH – apontando pro caminho do seu php.exe. Ex: c:\xampp\php\bin\php.exe
- WIZ_HOME_PATH – apontando pro diretorio do seu Wiz
- E adicionar o caminho da pasta do seu php.exe na variável Path (caso já não esteja lá) – ex: c:\xampp\php\bin
As variáveis de ambiente são criadas dentro de Painel de Controle->Sistema->Propriedades do sistema, como mostra a imagem abaixo.
Feito isso, crie um arquivo na raíz do seu usuário chamado .bash_profile (vi ~/.bash_profile) e adicione a linha abaixo.
alias wiz="/c/caminho/do/seu/Wiz/wiz"
Feche e abra novamente seu git-bash e teste com “wiz command-list”.
Nota: não consegui fazer o autocomplete funcionar no windows. Se você conseguir, me conta que eu adiciono aqui.
Bug conhecido
Em alguns casos, ao acionar o wiz devel-showhints ele habilita os hints no admin, ao invés de habilitar na loja. Se isso acontecer com você, a forma mais rápido de resolver, é baixando o Wiz do Kevin Kirchner em https://github.com/kevinkirchner/Wiz/ e substituir o seu.
2 comentários