Vildulv
1/14/2013 - 7:07 PM

Magento workbench script with full error output.

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
     */