/** * @inheritdoc * * This is a bug fix for setting up "_includeMage" to false. In this case the Mage class will not included. * But in the parent constructor the factory class Mage_Core_Model_Factory gets initialized which occurs an * error without setup the auto loader. */ public function __construct() { require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'Mage.php'; parent::__construct(); //Display errors to show warnings and strict notices if the error level strict or notice is set ini_set('display_errors', 1); }
/** * Constructor */ public function __construct() { parent::__construct(); // this requires a bit of memory // so, lets set as 512M ini_set('memory_limit', '512M'); }
public function __construct() { parent::__construct(); // Time limit to infinity set_time_limit(0); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); }
protected function _construct() { $this->_initSession('admin', 'p4ssw0rd'); $this->_helper = Mage::helper('pugmore_mageploy'); $this->_io = new PugMoRe_Mageploy_Model_Io_File(); return parent::_construct(); }
public function __construct() { parent::__construct(); if ($this->getArg('run-components')) { $this->_components = array_merge($this->_components, array_map('trim', explode(',', $this->getArg('run-components')))); } }
public function __construct() { parent::__construct(); $this->username = $this->getArg('username'); $this->password = $this->getArg('password'); $this->devMode = $this->getArg('devmode'); }
public function __construct() { parent::__construct(); set_time_limit(0); $this->_precacheBaseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); $this->_precacheProductSuffix = Mage::helper('catalog/product')->getProductUrlSuffix(); $this->_precacheCategorySuffix = Mage::helper('catalog/category')->getCategoryUrlSuffix(); if ($this->getArg('stores')) { $this->_precacheStores = array_merge($this->_precacheStores, array_map('trim', explode(',', $this->getArg('stores')))); } if ($this->getArg('categories')) { $this->_precacheCategories = array_merge($this->_precacheCategories, array_map('trim', explode(',', $this->getArg('categories')))); } if ($this->getArg('catdepth') && intval($this->getArg('catdepth'))) { $this->_precacheMaxCategoryDepth = intval($this->getArg('catdepth')); } if ($this->getArg('prodtype') && in_array(strtolower($this->getArg('prodtype')), $this->_precacheProductTypes)) { $this->_precacheProductType = strtolower($this->getArg('prodtype')); if ($this->_precacheProductType == 'none') { $this->_precacheExcludeProducts = true; } } if ($this->getArg('pages') && intval($this->getArg('pages'))) { $this->_precacheCategoryPages = intval($this->getArg('pages')); } }
protected function _validate() { $errors = []; /** @var Arkade_S3_Helper_Data $helper */ $helper = Mage::helper('arkade_s3'); if (is_null($helper->getAccessKey())) { $errors[] = 'You have not provided an AWS access key ID. You can do so using our config script.'; } if (is_null($helper->getSecretKey())) { $errors[] = 'You have not provided an AWS secret access key. You can do so using our config script.'; } if (is_null($helper->getBucket())) { $errors[] = 'You have not provided an S3 bucket. You can do so using our config script.'; } if (is_null($helper->getRegion())) { $errors[] = 'You have not provided an S3 region. You can do so using our config script.'; } if (!$helper->getClient()->isBucketAvailable($helper->getBucket())) { $errors[] = 'The AWS credentials you provided did not work. Please review your details and try again. You can do so using our config script.'; } if ($this->getArg('dry-run') && $this->getArg('force')) { $errors[] = "You can't use --dry-run and --force at the same time!\n"; } if (empty($errors)) { parent::_validate(); } else { foreach ($errors as $error) { echo $error . "\n"; die; } } }
public function __construct() { parent::__construct(); $this->spending = $this->getArg('add-spending'); $email = $this->getArg('customer-email'); $customerId = $this->getArg('customer-id'); if ($email) { $this->customer = Mage::getModel('customer/customer')->setWebsiteId($this->websiteId)->loadByEmail($email); } elseif ($customerId) { $this->customer = Mage::getModel('customer/customer')->load($customerId); } if (($email || $customerId) && (!$this->customer || !$this->customer->getId())) { die($this->formatError('Customer Not Found!')); } $products = $this->getArg('products'); if ($products) { $products = explode(',', $products); foreach ($products as $productId) { $product = Mage::getModel('catalog/product')->load($productId); if (!$product->getId()) { $message = "No product was foudn with the following id: {$productId}"; die($this->formatError($message)); } $this->products[] = $product; } } else { $this->productsCount = $this->getArg('products-count'); if (!$this->productsCount) { $this->productsCount = rand($this->minimumNumberOfProducts, $this->maximumNumberOfProducts); } } }
protected function _validate() { if (!empty($this->getArg('h')) && !empty($this->getArg('help')) && !empty($this->getArg('list'))) { $errors = []; if ($this->getArg('region')) { /** @var Arkade_S3_Helper_S3 $helper */ $helper = Mage::helper('arkade_s3/s3'); if (!$helper->isValidRegion($this->getArg('region'))) { $errors[] = sprintf('The region "%s" is invalid.', $this->getArg('region')); } } if (!empty($errors)) { foreach ($errors as $error) { echo $error . "\n"; } echo "\nusage: php s3_config.php [options]\n\n"; echo " --list list current AWS credentials\n"; echo " --access-keyid <access-key-id> a valid AWS access key ID\n"; echo " --secret-key <secret-key> a valid AWS secret access key\n"; echo " --bucket <bucket> an S3 bucket name\n"; echo " --region <region> an S3 region, e.g. us-east-1\n"; echo " -h, --help\n\n"; die; } parent::_validate(); } }
public function __construct() { parent::__construct(); $email = $this->getArg('customer-email'); $customerId = $this->getArg('customer-id'); if ($email) { $this->customer = Mage::getModel('customer/customer')->setWebsiteId($this->websiteId)->loadByEmail($email); } elseif ($customerId) { $this->customer = Mage::getModel('customer/customer')->load($customerId); } else { die($this->formatError('No customer specified.')); } if (!$this->customer || !$this->customer->getId()) { die($this->formatError('Customer Not Found!')); } $hasAction = false; foreach ($this->_args as $key => $value) { if (array_key_exists($key, $this->rulesMap)) { $this->rulesMap[$key] = true; $hasAction = true; } } if (!$hasAction) { die($this->formatError('No action specified.')); } }
public function __construct() { parent::__construct(); //Init Ultility Model $this->ultility = Mage::getModel('solrsearch/ultility'); $this->indexer = Mage::getResourceModel('solrsearch/indexer'); }
public function __construct() { parent::__construct(); // unset time limit set_time_limit(0); if ($this->getArg('prepare')) { $this->_prepare = $this->getArg('prepare'); } if ($this->getArg('createmap')) { $this->_createMap = true; } if ($this->getArg('lang')) { $this->_lang = $this->getArg('lang'); } if ($this->getArg('store')) { $this->_storeId = $this->getArg('store'); } if ($this->getArg('oldcat')) { $this->_oldCategories = $this->getArg('oldcat'); } if ($this->getArg('newcat')) { $this->_newCategories = $this->getArg('newcat'); } if ($this->getArg('categoryidmap')) { if (!$this->_lang && !$this->_storeId) { echo "You have to specify language or StoreView id when using a category id map\n"; return false; } $this->_categoryIdMap = $this->parseCategoryIdMap($this->getArg('categoryidmap')); } }
/** * Validate the input parameters * * @return void */ protected function _validate() { parent::_validate(); /** @var Aoe_AttributeConfigurator_Model_Shell _shellModel */ $this->_shellModel = Mage::getModel('aoe_attributeconfigurator/shell'); $this->_shellModel->setIni(['memory_limit' => '20000M']); $this->_shellModel->validate($this); }
public function getArg($name) { $arg = parent::getArg($name); if (false === $arg && isset($_GET[$name])) { $arg = $_GET[$name]; } return $arg; }
/** * Initialize application and parse input parameters */ public function __construct() { $this->_timeStart = (double) microtime(true); $this->_memoryUsageStart = $this->getMemoryUsage(); parent::__construct(); $this->initLog(); $this->log->debug('== Script execution started =='); }
/** * Initializes global area and dispatches an event to trigger autoloader initialization * * @return AutoloaderInitializer */ protected function _construct() { parent::_construct(); Mage::getConfig()->init()->loadEventObservers('global'); Mage::app()->addEventArea('global'); Mage::dispatchEvent('add_spl_autoloader'); return $this; }
/** * Apply PHP settings to shell script * * @return void */ protected function _applyPhpVariables() { parent::_applyPhpVariables(); set_time_limit(0); error_reporting(E_ALL); ini_set('memory_limit', '2G'); ini_set('display_errors', 1); }
public function __construct() { parent::__construct(); Mage::setIsDeveloperMode(true); //always enable developer mode when run through the shell. if ($this->getArg('profiler') == '1') { Varien_Profiler::enable(); } }
public function __construct() { try { return parent::__construct(); } catch (Exception $e) { file_put_contents('php://stderr', "[ERROR] {$e->getMessage()}\n"); exit(1); } }
public function __construct() { parent::__construct(); $collection = Mage::getModel('aoe_scheduler/collection_crons'); $_defaultCronJobs = array(); foreach ($collection->getItems() as $item) { $data = $item->getData(); $this->_defaultCronJobs[$data['id']] = $data['model']; } }
protected function _validate() { parent::_validate(); if (!in_array($this->_action, array('pull', 'push', 'diff'))) { print "Invalid action\n" and die($this->usageHelp()); } if (!is_null($this->_type) and !in_array($this->_type, array('page', 'block'))) { print "Invalid type\n" and die($this->usageHelp()); } }
public function __construct() { parent::__construct(); // Time limit to infinity set_time_limit(0); // Get command line argument named "argname" // Accepts multiple values (comma separated) if ($this->getArg('argname')) { $this->_argname = array_merge($this->_argname, array_map('trim', explode(',', $this->getArg('argname')))); } }
public function __construct() { parent::__construct(); set_time_limit(0); $this->_precacheBaseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); $this->_precacheProductSuffix = Mage::helper('catalog/product')->getProductUrlSuffix(); $this->_precacheCategorySuffix = Mage::helper('catalog/category')->getCategoryUrlSuffix(); if ($this->getArg('stores')) { $this->_precacheStores = array_merge($this->_precacheStores, array_map('trim', explode(',', $this->getArg('stores')))); } if ($this->getArg('categories')) { $this->_precacheCategories = array_merge($this->_precacheCategories, array_map('trim', explode(',', $this->getArg('categories')))); } }
public function __construct() { parent::__construct(); $this->ultility = Mage::getModel('solrsearch/ultility'); $itemsPerCommitConfig = Mage::getStoreConfig('webmods_solrsearch/settings/items_per_commit', 0); if (intval($itemsPerCommitConfig) > 0) { $this->itemsPerCommit = $itemsPerCommitConfig; } $checkInstockConfig = Mage::getStoreConfig('webmods_solrsearch/settings/check_instock', 0); if (intval($checkInstockConfig) > 0) { $this->checkInStock = $checkInstockConfig; } $solr_server_url = Mage::getStoreConfig('webmods_solrsearch/settings/solr_server_url', 0); $this->solrServerUrl = $solr_server_url; }
/** * constructor */ public function __construct() { parent::__construct(); // unset time limit set_time_limit(0); if ($this->getArg('productid')) { $this->_productId = $this->getArg('productid'); } if ($this->getArg('categoryid')) { $this->_categoryId = $this->getArg('categoryid'); } if ($this->getArg('store')) { $this->_storeId = $this->getArg('store'); } }
public function __construct() { parent::__construct(); if (empty($this->_args)) { die($this->usageHelp()); } if ($this->getArg('add-all')) { $this->addAllRules(); } else { foreach ($this->_args as $key => $value) { if (array_key_exists($key, $this->rulesMap)) { $this->rulesMap[$key] = true; } } } }
/** * Simple constructor * * @return Smile_Shell_Mongoify */ public function __construct() { parent::__construct(); /** @var Smile_MongoCatalog_Model_Resource_Override_Catalog_Product $catalogResource */ if (Mage::helper('core')->isModuleEnabled("Smile_MongoCatalog")) { $this->_catalogResource = Mage::getResourceModel("catalog/product"); } else { // If module is not enable, instantiate raw object // This permits to manage some tests without enabling the module $this->_catalogResource = new Smile_MongoCatalog_Model_Resource_Override_Catalog_Product(); } /** @var MongoCollection $_catalogResourceCollection */ $this->_catalogResourceCollection = $this->_getDocumentCollection(); $this->_sqlAttributeCodes = $this->_catalogResource->getSqlAttributesCodes(); $this->_getCurrentStats(); }
public function __construct() { require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'Mage.php'; parent::__construct(); $localXML = $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'local.xml'; $this->_configXml = simplexml_load_string(file_get_contents($localXML)); $this->_snapshotXml = $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'snapshot.xml'; if (!file_exists($this->_snapshotXml)) { die("Your config file is missing. {$this->_snapshotXml}"); } $this->_snapshotXml = simplexml_load_string(file_get_contents($this->_snapshotXml)); $rootpath = $this->_getRootPath(); $this->_snapshot = $rootpath . 'snapshot'; # Create the snapshot directory if not exists if (!file_exists($this->_snapshot)) { mkdir($this->_snapshot); } }
/** * Validate arguments * */ protected function _validate() { parent::_validate(); $domainPassed = true; if (!$this->getArg('domain') || $this->getArg('domain') === true) { $domainPassed = false; } $explainPassed = true; if (!$this->getArg('explain') || $this->getArg('explain') === true) { $explainPassed = false; } if (!$domainPassed && !$explainPassed) { exit($this->usageHelp()); } if (!$domainPassed && $explainPassed) { $this->_explainIds = array_map("trim", explode(',', $this->_args['explain'])); asort($this->_explainIds); } }