Certificated magento

Q.2.1) How and when is the include path set up and the auto loader registered?

The include path is set soon after the /app/Mage.php file is called from the /index.php file. The autoloader is registered soon after: 

 

// app/Mage.php

define('DS', DIRECTORY_SEPARATOR);

define('PS', PATH_SEPARATOR);

define('BP', dirname(dirname(__FILE__)));

 

Mage::register('original_include_path', get_include_path());

 

if (defined('COMPILER_INCLUDE_PATH')) {

    $appPath = COMPILER_INCLUDE_PATH;

    set_include_path($appPath . PS . Mage::registry('original_include_path'));

    include_once COMPILER_INCLUDE_PATH . DS . "Mage_Core_functions.php";

    include_once COMPILER_INCLUDE_PATH . DS . "Varien_Autoload.php";

} else {

    /**

     * Set include path

     */

    $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local';

    $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';

    $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';

    $paths[] = BP . DS . 'lib';

 

    $appPath = implode(PS, $paths);

    set_include_path($appPath . PS . Mage::registry('original_include_path'));

    include_once "Mage/Core/functions.php";

    include_once "Varien/Autoload.php";

}

 

Varien_Autoload::register();

0 Bình luận

Trở về
  • 1.12) Set up a cron job
  • 1.12) Set up a cron job

    Let’s start with server setup.   As any complex system, Magento has a lot of tasks that need to be executed...