本文整理汇总了PHP中Mage::logException方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::logException方法的具体用法?PHP Mage::logException怎么用?PHP Mage::logException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::logException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _handleScopeRow
/**
* Handle scope row data
*
* @param string $type
* @param array $row
* @param EcomDev_PHPUnit_Model_FixtureInterface $fixture
* @return boolean|Mage_Core_Model_Abstract
*/
protected function _handleScopeRow($type, $row, EcomDev_PHPUnit_Model_FixtureInterface $fixture)
{
$previousScope = array();
if ($fixture->isScopeLocal() && $fixture->getStorageData(self::STORAGE_KEY, EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_SHARED) !== null) {
$previousScope = $fixture->getStorageData(self::STORAGE_KEY, EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_SHARED);
}
if (isset($previousScope[$type][$row[$type . '_id']])) {
return false;
}
$scopeModel = Mage::getModel($this->modelByType[$type]);
$scopeModel->setData($row);
// Change property for saving new objects with specified ids
EcomDev_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_isPkAutoIncrement' => false));
try {
$scopeModel->isObjectNew(true);
$scopeModel->save();
} catch (Exception $e) {
Mage::logException($e);
// Skip duplicated key violation, since it might be a problem
// of previous run with fatal error
// Revert changed property
EcomDev_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_isPkAutoIncrement' => true));
// Load to make possible deletion
$scopeModel->load($row[$type . '_id']);
}
// Revert changed property
EcomDev_Utils_Reflection::setRestrictedPropertyValues($scopeModel->getResource(), array('_isPkAutoIncrement' => true));
return $scopeModel;
}
示例2: getPayoneInvoicePdf
/**
* @return array
*/
public function getPayoneInvoicePdf()
{
/**
* @var $invoice Mage_Sales_Model_Order_Invoice
*/
$invoice = Mage::registry('current_invoice');
$order = $invoice->getOrder();
$data = array('label' => $this->helperConfig()->__('Download PAYONE-Invoice'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getDownloadInvoiceUrl() . '\')');
$disabled = false;
try {
$configPayment = $this->helperConfig()->getConfigPaymentMethodByOrder($order);
if (!$configPayment || !$configPayment->isInvoiceTransmitEnabled() || $this->isAllowedAction('download_payone_invoice') === false) {
$disabled = true;
}
} catch (Payone_Core_Exception_PaymentMethodConfigNotFound $e) {
$disabled = true;
} catch (Exception $e) {
Mage::logException($e);
$disabled = true;
}
if ($disabled) {
$data['disabled'] = 1;
}
return $data;
}
示例3: remainingSerialsReport
/**
* @return ICC_Ecodes_Model_Downloadable
*/
public function remainingSerialsReport()
{
/** added for log tracking by anil 28 jul **/
$currDate = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
$fileName = date("Y-m-d", Mage::getModel('core/date')->timestamp(time()));
Mage::log("Controller Name : Ecode/Downloadable , Action Name : remainingSerialsReport , Start Time : {$currDate}", null, $fileName);
/** end **/
$threshold = Mage::getStoreConfig(self::XML_PATH_REPORT_THRESHOLD);
$errors = array();
if (!is_numeric($threshold) || $threshold < 0) {
$error = "Threshold was not a positive integer.";
$errors[] = $error;
Mage::log("Error while attempting to run " . __METHOD__ . ". " . $error);
} else {
$notifications = $this->getCollection()->prepareForRemainingReport($threshold);
if ($notifications->count()) {
try {
$this->sendNotificationEmail($notifications);
} catch (Exception $e) {
Mage::logException($e);
}
}
}
/** added for log tracking by anil 28 jul start **/
$currDate = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
Mage::log("Controller Name : Ecode/Downloadable , Action Name : remainingSerialsReport , End Time : {$currDate}", null, $fileName);
/** end **/
return $this;
}
示例4: cron
public function cron()
{
if ($files = Mage::helper('cachewarm')->getMaps()) {
Mage::helper('cachewarm')->unsMaps();
foreach ($files as $file) {
if (file_exists($file)) {
$xml = simplexml_load_file($file);
foreach ($xml as $sectionName => $sectionData) {
if ($sectionName == "url") {
try {
Mage::log($sectionData->loc, null, 'cachewarm.log', true);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, (string) $sectionData->loc);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
} catch (Exception $e) {
Mage::logException($e);
Mage::log('error: ' . $e->getMessage(), null, 'cachewarm.log', true);
}
}
}
}
}
}
}
示例5: scheduledBackup
/**
* Create Backup
*
* @return Mage_Log_Model_Cron
*/
public function scheduledBackup()
{
if (!Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_ENABLED)) {
return $this;
}
if (Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) {
Mage::helper('backup')->turnOnMaintenanceMode();
}
$type = Mage::getStoreConfig(self::XML_PATH_BACKUP_TYPE);
$this->_errors = array();
try {
$backupManager = Mage_Backup::getBackupInstance($type)->setBackupExtension(Mage::helper('backup')->getExtensionByType($type))->setTime(time())->setBackupsDir(Mage::helper('backup')->getBackupsDir());
Mage::register('backup_manager', $backupManager);
if ($type != Mage_Backup_Helper_Data::TYPE_DB) {
$backupManager->setRootDir(Mage::getBaseDir())->addIgnorePaths(Mage::helper('backup')->getBackupIgnorePaths());
}
$backupManager->create();
Mage::log(Mage::helper('backup')->getCreateSuccessMessageByType($type));
} catch (Exception $e) {
$this->_errors[] = $e->getMessage();
$this->_errors[] = $e->getTrace();
Mage::log($e->getMessage(), Zend_Log::ERR);
Mage::logException($e);
}
if (Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) {
Mage::helper('backup')->turnOffMaintenanceMode();
}
return $this;
}
示例6: _initVendor
/**
* Initialize requested vendor object
*
* @return Ced_CsMarketplace_Model_Vendor
*/
protected function _initVendor()
{
Mage::dispatchEvent('csmarketplace_controller_vshops_init_before', array('controller_action' => $this));
if (!Mage::helper('csmarketplace/acl')->isEnabled()) {
return false;
}
$shopUrl = Mage::getModel('csmarketplace/vendor')->getShopUrlKey($this->getRequest()->getParam('shop_url', ''));
if (!strlen($shopUrl)) {
return false;
}
$vendor = Mage::getModel('csmarketplace/vendor')->setStoreId(Mage::app()->getStore()->getId())->loadByAttribute('shop_url', $shopUrl);
if (!Mage::helper('csmarketplace')->canShow($vendor)) {
return false;
} else {
if (!Mage::helper('csmarketplace')->isShopEnabled($vendor)) {
return false;
}
}
//Mage::getSingleton('catalog/session')->setLastVisitedCategoryId($category->getId());
Mage::register('current_vendor', $vendor);
//Mage::register('current_entity_key', $category->getPath());
try {
Mage::dispatchEvent('csmarketplace_controller_vshops_init_after', array('vendor' => $vendor, 'controller_action' => $this));
} catch (Mage_Core_Exception $e) {
Mage::logException($e);
return false;
}
return $vendor;
}
示例7: uploadPostAction
public function uploadPostAction()
{
try {
if (!isset($_FILES['template'])) {
throw new Mage_Exception($this->__("No template file selected"));
}
$file = $_FILES['template'];
if ($file['error']['file'] !== UPLOAD_ERR_OK) {
throw new Mage_Exception($this->__("Error when uploading template (#%s)", $file['error']['file']));
}
$template = $this->_initTemplate();
$template->loadFromFile($file['tmp_name']['file']);
$template->save();
if (version_compare($template->getVersion(), Mage::helper('mzax_emarketing')->getVersion()) < 0) {
$this->_getSession()->addWarning($this->__("The template you just uploaded was made with version %s, you only have version %s of Mzax Emarketing. This might cause an issue."));
}
$this->_getSession()->addSuccess($this->__("Template successfully uploaded."));
$this->_redirect('*/*/edit', array('id' => $template->getId()));
return;
} catch (Mage_Exception $e) {
$this->_getSession()->addError($e->getMessage());
} catch (Exception $e) {
if (Mage::getIsDeveloperMode()) {
throw $e;
}
Mage::logException($e);
$this->_getSession()->addError($this->__("There was an error uploading the template."));
}
$this->_redirect('*/*/index');
}
示例8: sendFeedNotification
/**
* @param $store
* @param $items
* @param $tplSuccess
* @param $tplError
* @return $this
*/
public function sendFeedNotification($store, $items, $tplSuccess, $tplError)
{
$body = '';
$hasError = false;
$allowedKeys = array('entity_name', 'store_name', 'error_message');
foreach ($items as $item) {
if ($item['successfully']) {
$itemMsg = $this->__($tplSuccess);
} else {
$itemMsg = $this->__($tplError);
$hasError = true;
}
foreach ($allowedKeys as $key) {
$value = isset($item[$key]) ? $item[$key] : '';
$itemMsg = str_replace("{{$key}}", $value, $itemMsg);
}
$body .= $itemMsg . PHP_EOL;
}
$email = $this->_getConfig()->getNotificationRecipientEmail($store);
$subject = $this->_getConfig()->getNotificationSubject();
$subject .= $hasError ? $this->__('Failure') : $this->__('Success');
$mail = new Zend_Mail();
$mail->setFrom($this->_getConfig()->getDefaultSenderEmail(), $this->_getConfig()->getDefaultSenderName());
$mail->addTo($email);
$mail->setSubject($subject);
$mail->setBodyHtml(nl2br($body));
try {
$mail->send();
} catch (Exception $e) {
Mage::logException($e);
}
return $this;
}
示例9: saveAction
public function saveAction()
{
if ($this->getRequest()->getPost()) {
try {
$data = $this->getRequest()->getPost();
$id = $this->getRequest()->getParam('id');
$respricedate = Mage::getModel('payperrentals/reservationpricesdates');
if ($id) {
$respricedate->load($id);
} else {
unset($data['id']);
}
if ($data) {
if (array_key_exists('repeat_days', $data)) {
$data['repeat_days'] = implode(',', $data['repeat_days']);
}
$respricedate->setData($data);
$respricedate->save();
}
Mage::getSingleton('adminhtml/session')->addSuccess('Saved');
Mage::getSingleton('adminhtml/session')->setFormData(false);
$this->_redirect('*/*/index');
} catch (Exception $e) {
$this->_getSession()->addError(Mage::helper('payperrentals')->__('An error occurred while saving the data. Please review the log and try again.'));
Mage::logException($e);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return $this;
}
}
}
示例10: afterSave
/**
* This methods overwrites Mage_Eav_Model_Entity_Attribute_Backend_Abstract::afterSave
* in a bad way, just because the "$uploader = new class".
*
* @param type $object
* @return type
*/
public function afterSave($object)
{
if (!Mage::helper('magefm_cdn')->isEnabled()) {
return parent::afterSave($object);
}
$value = $object->getData($this->getAttribute()->getName());
if (is_array($value) && !empty($value['delete'])) {
$object->setData($this->getAttribute()->getName(), '');
$this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
return;
}
$path = 'catalog' . DS . 'category';
try {
$uploader = new MageFM_CDN_Model_Uploader($this->getAttribute()->getName());
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
$uploader->setAllowRenameFiles(true);
$result = $uploader->save($path);
$object->setData($this->getAttribute()->getName(), $result['file']);
$this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
} catch (Exception $e) {
if ($e->getCode() != Mage_Core_Model_File_Uploader::TMP_NAME_EMPTY) {
Mage::logException($e);
}
/** @TODO ??? */
return;
}
}
示例11: responseAction
/**
* Response action.
* Action for Authorize.net SIM Relay Request.
*/
public function responseAction()
{
$data = $this->getRequest()->getPost();
/* @var $paymentMethod Mage_Authorizenet_Model_DirectPost */
$paymentMethod = Mage::getModel('authorizenet/directpost');
$result = array();
if (!empty($data['x_invoice_num'])) {
$result['x_invoice_num'] = $data['x_invoice_num'];
}
try {
if (!empty($data['store_id'])) {
$paymentMethod->setStore($data['store_id']);
}
$paymentMethod->process($data);
$result['success'] = 1;
} catch (Mage_Core_Exception $e) {
Mage::logException($e);
$result['success'] = 0;
$result['error_msg'] = $e->getMessage();
} catch (Exception $e) {
Mage::logException($e);
$result['success'] = 0;
$result['error_msg'] = $this->__('There was an error processing your order. Please contact us or try again later.');
}
if (!empty($data['controller_action_name'])) {
if (!empty($data['key'])) {
$result['key'] = $data['key'];
}
$result['controller_action_name'] = $data['controller_action_name'];
$result['is_secure'] = isset($data['is_secure']) ? $data['is_secure'] : false;
$params['redirect'] = Mage::helper('authorizenet')->getRedirectIframeUrl($result);
}
$block = $this->_getIframeBlock()->setParams($params);
$this->getResponse()->setBody($block->toHtml());
}
示例12: getExtensions
public function getExtensions()
{
$data = array();
try {
$file = 'http://d52ndf1ixk2tu.cloudfront.net/media/featured_product.csv';
/* https does not work */
$content = $this->urlGetContents($file);
if ($content == false) {
$file = 'https://www.iwdagency.com/extensions/media/featured_product.csv';
$content = $this->urlGetContents($file);
if ($content == false) {
return "";
}
}
$path = Mage::getBaseDir('media') . DS . 'import' . DS . 'featured_product.csv';
if (!file_exists(Mage::getBaseDir('media') . DS . 'import')) {
mkdir(Mage::getBaseDir('media') . DS . 'import');
}
file_put_contents($path, $content);
$csv = new Varien_File_Csv();
$data = $csv->getData($path);
@unlink($path);
} catch (Exception $e) {
Mage::logException($e);
}
return $data;
}
示例13: updateRegistryData
public function updateRegistryData($data)
{
try {
if (!empty($data)) {
$description = $data['msg2'];
$link = 'Apply';
$title = 'Item Drop Notification';
$linkurl = '[[pdurl]]';
$coupon = implode(" ", $data['coupons']);
$theme = $data['theme'];
$NotificationId = Mage::helper('webengage_coup')->NotificationCreate($title, $description, $link, $linkurl, $theme);
if ($NotificationId !== null) {
$this->setTitle($title);
$this->setDescription($description);
$this->setLink($link);
$this->setCoupon($coupon);
$this->setLinkurl($linkurl);
$this->setTheme($theme);
$this->setIdd($NotificationId);
return 1;
} else {
throw new Exception("Error Processing Request: Insufficient Data Provided");
}
}
} catch (Exception $e) {
Mage::logException($e);
return 0;
}
}
示例14: authenticate
public function authenticate()
{
$state = $this->getOAuthState();
$consumer = $this->_getOAuthConsumer();
try {
switch ($state) {
case self::OAUTH_STATE_NO_TOKEN:
$requestToken = $this->getRequestToken();
$this->setOAuthState(self::OAUTH_STATE_REQUEST_TOKEN);
$consumer->redirect();
return self::OAUTH_STATE_REQUEST_TOKEN;
break;
case self::OAUTH_STATE_REQUEST_TOKEN:
$accessToken = $this->getAccessToken($this->getRequestToken());
$this->setAuthorizedToken($accessToken);
$this->setOAuthState(self::OAUTH_STATE_ACCESS_TOKEN);
return self::OAUTH_STATE_ACCESS_TOKEN;
break;
case self::OAUTH_STATE_ACCESS_TOKEN:
return self::OAUTH_STATE_ACCESS_TOKEN;
default:
$this->resetSessionParams();
return self::OAUTH_STATE_NO_TOKEN;
return;
break;
}
} catch (Zend_Oauth_Exception $e) {
$this->resetSessionParams();
Mage::logException($e);
} catch (Exception $e) {
Mage::logException($e);
}
return self::OAUTH_STATE_NO_TOKEN;
}
示例15: _getRewriter
protected function _getRewriter($code, $config)
{
if (!isset($this->_rewriters[$code])) {
if (!isset($config['model'])) {
return false;
}
try {
$rewriter = Mage::getModel($config['model']);
} catch (Exception $e) {
Mage::logException($e);
return false;
}
$rewriter->setId($code)->setPriority(isset($config['priority']) ? intval($config['priority']) : 0)->setDisplayErrors(isset($config['display_errors']) ? (bool) $config['display_errors'] : false)->setLogErrors(isset($config['log_errors']) ? (bool) $config['log_errors'] : false);
if ($rewriter->getDisplayErrors()) {
$rewriter->setDisplayErrorsIfSuccess(isset($config['display_errors_if_success']) ? (bool) $config['display_errors_if_success'] : false);
} else {
$rewriter->setDisplayErrorsIfSuccess(false);
}
if ($rewriter->getLogErrors()) {
$rewriter->setLogErrorsIfSuccess(isset($config['log_errors_if_success']) ? (bool) $config['log_errors_if_success'] : false);
} else {
$rewriter->setLogErrorsIfSuccess(false);
}
$this->_rewriters[$code] = $rewriter;
}
return $this->_rewriters[$code];
}