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(); } }
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; } } }
/** * 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); }
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()); } }
/** * 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); } }