Skip to content

Instantly share code, notes, and snippets.

@benmarks
Last active April 5, 2016 15:07
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmarks/4532434 to your computer and use it in GitHub Desktop.
Save benmarks/4532434 to your computer and use it in GitHub Desktop.
Magento workbench script with full error output.
<?php
/**
* Working with Magento outside of the normal routing dispatch
* flow of Mage::run()? Mage::app(); is the way to go. This
* workbench script can be a quick way to check on various
* parts of the app, including configuration, which can be
* handy when verifying custom modules.
*/
//set some PHP params for ease of debugging
ini_set('display_errors',true);
error_reporting(E_ALL | E_STRICT);
//process bootstrap & application hub class
require 'app/Mage.php';
//set developer mode
Mage::setIsDeveloperMode(true);
//the standard filemask for server-written files
umask(0);
/**
* Initialize the app and config with the default store scope
* (based on configuration data). Note that not all parts of
* the configuration are loaded, meaning that frontend- and
* adminhtml-configured event observers are not added to the
* observer lists. This can be remedied by calling
* Mage::app()->loadArea() / ->loadAreaPart() with the
* appropriate params. Note also that sessions must be
* invoked manually as well.
*/
Mage::app();
/**
* Now it's possible to play around / test things. For example:
*
* $product = Mage::getModel('catalog/product');
*
* will load an instance of Mage_Catalog_Model_Product, just as
* would take place in a normally-dispatched application flow.
*
* Have fun!
* Ben Marks, Blue Acorn
* http://benmarks.github.com/
* @benmarks
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment