本文整理汇总了PHP中Mage::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::log方法的具体用法?PHP Mage::log怎么用?PHP Mage::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
/**
* Load XML response from Correios
*
* @param string $number Tracking Code
*
* @throws Zend_Http_Client_Adapter_Exception
*
* @link http://www.correios.com.br/para-voce/correios-de-a-a-z/pdf/rastreamento-de-objetos/
* Manual_SROXML_28fev14.pdf
*
* @return SimpleXMLElement
*/
public function request($number)
{
$client = new Zend_Http_Client($this->getConfigData("url_sro_correios"));
$client->setParameterPost('Usuario', $this->getConfigData('sro_username'));
$client->setParameterPost('Senha', $this->getConfigData('sro_password'));
$client->setParameterPost('Tipo', $this->getConfigData('sro_type'));
$client->setParameterPost('Resultado', $this->getConfigData('sro_result'));
$client->setParameterPost('Objetos', $number);
try {
$response = $client->request(Zend_Http_Client::POST)->getBody();
if (empty($response)) {
throw new Zend_Http_Client_Adapter_Exception("Empty response");
}
libxml_use_internal_errors(true);
$this->_xml = simplexml_load_string($response);
if (!$this->_xml || !isset($this->_xml->objeto)) {
throw new Zend_Http_Client_Adapter_Exception("Invalid XML");
}
} catch (Zend_Http_Exception $e) {
Mage::log("{$e->getMessage()}");
Mage::log("TRACKING: {$number}");
Mage::log("RESPONSE: {$response}");
return false;
}
return $this;
}
示例2: processPearUninstall
/**
* Attempts to uninstall Pear
*
* @param $moduleName
*/
protected function processPearUninstall($moduleName)
{
Mage::log("facebook foo");
$command = 'uninstall';
$params[] = 'community';
$params[] = $moduleName;
Mage_Connect_Command_Install::registerCommands();
// needed for init
$pear = new Mage_Connect_Command_Install();
// we need a config obj
/* @var $config Hackathon_MageTrashApp_Model_PearWrapper */
$config = Mage::getModel('magetrashapp/pearWrapper');
$bla = $config->getConfig();
/*$config = new Mage_Connect_Config();
$ftp=$config->__get('remote_config');
if(!empty($ftp)){
$packager = new Mage_Connect_Packager();
list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
$config;
}
$config->magento_root = dirname(dirname(__FILE__)).DS.'..';DS.'..';
*/
$pear->setConfigObject($bla);
$result = $pear->doUninstall($command, array(), $params);
$bla = 'dfdf';
}
示例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: sendHeaders
/**
* Fixes CGI only one Status header allowed bug
*
* @link http://bugs.php.net/bug.php?id=36705
*
* @return Mage_Core_Controller_Response_Http
*/
public function sendHeaders()
{
if (!$this->canSendHeaders()) {
Mage::log('HEADERS ALREADY SENT: ' . mageDebugBacktrace(true, true, true));
return $this;
}
if (substr(php_sapi_name(), 0, 3) == 'cgi') {
$statusSent = false;
foreach ($this->_headersRaw as $i => $header) {
if (stripos($header, 'status:') === 0) {
if ($statusSent) {
unset($this->_headersRaw[$i]);
} else {
$statusSent = true;
}
}
}
foreach ($this->_headers as $i => $header) {
if (strcasecmp($header['name'], 'status') === 0) {
if ($statusSent) {
unset($this->_headers[$i]);
} else {
$statusSent = true;
}
}
}
}
return parent::sendHeaders();
}
示例5: 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);
}
}
}
}
}
}
}
示例6: process
public function process(array $csvData, $cid, $imageDir)
{
$cnt = count($csvData);
$importDir = Mage::getBaseDir() . DS . 'media' . DS . 'marketplace' . DS . $cid . DS . $imageDir . DS;
if ($cnt > 1) {
for ($i = 1; $i < $cnt; $i++) {
try {
$sku = $csvData[$i][0];
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
$fileName = trim($csvData[$i][11]);
$filePath = $importDir . $fileName;
if (file_exists($filePath) && $fileName != '') {
$types = array('image', 'small_image', 'thumbnail');
foreach ($types as $type) {
$product->addImageToMediaGallery($filePath, array($type), false);
}
$mediaGallery = $product->getMediaGallery();
if (isset($mediaGallery['images'])) {
foreach ($mediaGallery['images'] as $key => $image) {
Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->getId()), array($types[$key] => $image['file']), 0);
}
}
$product->save();
unlink($filePath);
} else {
$message = 'Image does not exist for sku ' . $sku;
Mage::log($message, null, 'sellerimages_debug.log', true);
}
} catch (Exception $e) {
Mage::logException($e);
}
}
}
return true;
}
示例7: sync_specific_payment
public function sync_specific_payment($payment_method)
{
$response = array();
$helper = Mage::helper('magerpsync/connection');
if ($payment_method) {
$context = $helper->getOdooContext();
$client = $helper->getClientConnect();
$userId = Mage::getSingleton('adminhtml/session')->getUserId();
$payment_array = $arrayVal = array('name' => new xmlrpcval($payment_method, "string"), 'type' => new xmlrpcval('cash', "string"));
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($helper::$odoo_db, "string"));
$msg->addParam(new xmlrpcval($userId, "int"));
$msg->addParam(new xmlrpcval($helper::$odoo_pwd, "string"));
$msg->addParam(new xmlrpcval("bridge.backbone", "string"));
$msg->addParam(new xmlrpcval("create_payment_method", "string"));
$msg->addParam(new xmlrpcval($payment_array, "struct"));
$msg->addParam(new xmlrpcval($context, "struct"));
$resp = $client->send($msg);
if ($resp->faultCode()) {
$error = "Payment " . $payment_method . " >>" . $resp->faultString();
$response['odoo_id'] = 0;
$response['error'] = $error;
Mage::log($error, null, 'odoo_connector.log');
} else {
$odoo_id = $resp->value()->me["int"];
if ($odoo_id > 0) {
$mapping_data = array('mage_payment_id' => $payment_method, 'erp_payment_id' => $odoo_id, 'created_by' => $helper::$mage_user);
$this->createMapping($mapping_data);
$response['odoo_id'] = $odoo_id;
}
}
}
return $response;
}
示例8: log
public function log($message, $level, $data = null)
{
if (!is_null($data)) {
$message .= ' ' . json_encode($data);
}
Mage::log($message, $level, 'solr.log');
}
示例9: export
public function export($schedule)
{
try {
if (!Mage::helper('xtento_orderexport')->getModuleEnabled() || !Mage::helper('xtento_orderexport')->isModuleProperlyInstalled()) {
return;
}
if (!$schedule) {
return;
}
$jobCode = $schedule->getJobCode();
preg_match('/xtento_orderexport_profile_(\\d+)/', $jobCode, $jobMatch);
if (!isset($jobMatch[1])) {
Mage::throwException(Mage::helper('xtento_orderexport/export')->__('No profile ID found in job_code.'));
}
$profileId = $jobMatch[1];
$profile = Mage::getModel('xtento_orderexport/profile')->load($profileId);
if (!$profile->getId()) {
Mage::throwException(Mage::helper('xtento_orderexport/export')->__('Profile ID %d does not seem to exist anymore.', $profileId));
}
if (!$profile->getEnabled()) {
return;
// Profile not enabled
}
if (!$profile->getCronjobEnabled()) {
return;
// Cronjob not enabled
}
$exportModel = Mage::getModel('xtento_orderexport/export', array('profile' => $profile));
$filters = $this->addProfileFilters($profile);
$exportModel->cronExport($filters);
} catch (Exception $e) {
Mage::log('Cronjob exception for job_code ' . $jobCode . ': ' . $e->getMessage(), null, 'xtento_orderexport_cron.log', true);
return;
}
}
示例10: salesOrderCreditmemoSaveCommitAfter
/**
* Disable package access when order is refunded
*
* @param Varien_Event_Observer $observer
*/
public function salesOrderCreditmemoSaveCommitAfter(Varien_Event_Observer $observer)
{
$event = $observer->getEvent();
/** @var Mage_Sales_Model_Order_Creditmemo $creditmemo */
$creditmemo = $event->getCreditmemo();
/** @var Mage_Sales_Model_Order $order */
$order = $creditmemo->getOrder();
$customerId = $order->getCustomerId();
$productIds = [];
foreach ($creditmemo->getItemsCollection() as $item) {
$productIds[] = $item->getProductId();
}
$packageIds = Mage::getResourceModel('genmato_composerrepo/packages_collection')->addFielToFilter('product_id', array('in' => $productIds))->getAllIds();
$collection = Mage::getResourceModel('genmato_composerrepo/customer_packages_collection')->addFieldToFilter('status', array('eq' => 1))->addFieldToFilter('customer_id', array('eq' => $customerId))->addFieldToFilter('order_id', array('eq' => $order->getId()))->addFieldToFilter('package_id', array('in' => $packageIds));
foreach ($collection as $item) {
$item->setStatus(0);
}
try {
$collection->save();
} catch (Exception $ex) {
Mage::log($ex->getMessage());
}
$cleanTags = [];
$cleanTags[] = Genmato_ComposerRepo_Model_Customer_Auth::CACHE_TAG . $customerId;
Mage::app()->getCache()->clean('matchingTag', $cleanTags);
}
示例11: log
public function log($m)
{
$storeId = Mage::app()->getStore()->getId();
if (Mage::getStoreConfig(Ebizmarts_Mandrill_Model_System_Config::ENABLE_LOG, $storeId)) {
Mage::log($m, Zend_Log::INFO, 'Mandrill.log');
}
}
示例12: getSimilarItems
/**
* Gets the similar items of the product
* @return Array of Mage_Catalog_Model_Product
*/
public function getSimilarItems()
{
if (empty($this->_collection)) {
$return = array();
Mage::log("getting similar items");
//if(!parent::isCacheEnabled() || $this->loadFromCache("similaritems")==null){
$recs = $this->getSimilar();
if (!empty($json_items)) {
$count = 0;
foreach ($recs as $rec) {
if ($count >= parent::getNumberItems()) {
break;
}
if (!empty($rec['item']['permalink'])) {
$itemid = $rec['item']['permalink'];
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $itemid);
if (!empty($product)) {
$return[] = $product;
$count++;
}
}
}
}
//}
//else{
//$return = $this->loadFromCache("similaritems");
//age::log("loaded from cache");
//}
$this->_collection = $return;
return $return;
}
return $this->_collection;
}
示例13: log
public function log($data, $level = Zend_Log::DEBUG, $filename = 'api.log')
{
if ($this->getDebugEnabled()) {
$filename = 'connector_' . $filename;
Mage::log($data, $level, $filename, $force = true);
}
}
示例14: sendAction
/**
* send a js error to the backend
*/
public function sendAction()
{
$request = $this->getRequest();
$errorMessage = 'MESSAGE|' . $request->getParam('message') . "\n";
$errorMessage = 'URL|' . $request->getParam('url');
Mage::log($errorMessage, ZEND_LOG::ERR);
}
示例15: addToDebug
/**
* Add to Debug Log
* @param string $message
* @param string $order_id
*/
public function addToDebug($message = '', $order_id = '')
{
if (!empty($order_id)) {
$message .= ' OrderId: ' . $order_id;
}
Mage::log($message, null, 'payment_payexbankdebit.log');
}