/**
  * Initialize application and parse input parameters
  */
 public function __construct()
 {
     if ($this->_includeMage) {
         require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
         require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'MultiClient.php';
         $file = $_SERVER['PWD'] . DS . $_SERVER['PHP_SELF'];
         $bits = explode('/', $file);
         Mage::app($this->_appCode, $this->_appType, MultiClient::getRunOptions($bits[count($bits) - 2]));
         $this->initLog();
     }
     $this->_factory = new Mage_Core_Model_Factory();
     $this->_applyPhpVariables();
     $this->_parseArgs();
     $this->_construct();
     $this->_validate();
     $this->_showHelp();
 }
示例#2
0
<?php

error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', __DIR__ . DIRECTORY_SEPARATOR . '..');
if (file_exists('maintenance.flag')) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require_once MAGENTO_ROOT . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
require_once MAGENTO_ROOT . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'MultiClient.php';
umask(0);
// aws load balancers are dumb
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;
}
Mage::run(MultiClient::getRunCode(), MultiClient::getRunType(), MultiClient::getRunOptions());
示例#3
0
chdir(dirname(__FILE__));
require 'app/Mage.php';
require 'app/MultiClient.php';
if (!isset($argv[1])) {
    Mage::throwException('Error: CLIENT_CODE not specified');
}
$code = $argv[1];
if (!Mage::isInstalled()) {
    echo "Application is not installed yet, please complete install wizard first.";
    exit;
}
// Only for urls
// Don't remove this
$_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
$_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);
Mage::app('admin', 'store', MultiClient::getRunOptions($code))->setUseSessionInUrl(false);
umask(0);
$disabledFuncs = explode(',', ini_get('disable_functions'));
$isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true;
$isShellDisabled = stripos(PHP_OS, 'win') === false ? $isShellDisabled : true;
try {
    if (stripos(PHP_OS, 'win') === false) {
        if (isset($argv[2])) {
            switch ($argv[2]) {
                case 'always':
                case 'default':
                    $cronMode = $argv[2];
                    break;
                default:
                    Mage::throwException('Unrecognized cron mode was defined');
            }