本文整理汇总了PHP中Mage::setIsDeveloperMode方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::setIsDeveloperMode方法的具体用法?PHP Mage::setIsDeveloperMode怎么用?PHP Mage::setIsDeveloperMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::setIsDeveloperMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
Mage::setIsDeveloperMode(false);
Mage::getConfig()->setNode('default/dev/log/file', 'phpunit.system.log');
$this->mockAdminUserSession();
parent::setUp();
}
示例2: __construct
/**
* Set developer mode if applicable
*/
public function __construct()
{
if (self::isDev()) {
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
}
}
示例3: send
/**
* Send all messages in a queue
*
* @return Mage_Core_Model_Email_Queue
*/
public function send()
{
/** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
$collection = Mage::getModel('core/email_queue')->getCollection()->addOnlyForSendingFilter()->setPageSize(self::MESSAGES_LIMIT_PER_CRON_RUN)->setCurPage(1)->load();
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
/** @var $message Mage_Core_Model_Email_Queue */
foreach ($collection as $message) {
if ($message->getId()) {
$parameters = new Varien_Object($message->getMessageParameters());
if ($parameters->getReturnPathEmail() !== null) {
$mailTransport = new Zend_Mail_Transport_Sendmail("-f" . $parameters->getReturnPathEmail());
Zend_Mail::setDefaultTransport($mailTransport);
}
$mailer = new Zend_Mail('utf-8');
foreach ($message->getRecipients() as $recipient) {
list($email, $name, $type) = $recipient;
switch ($type) {
case self::EMAIL_TYPE_BCC:
$mailer->addBcc($email, '=?utf-8?B?' . base64_encode($name) . '?=');
break;
case self::EMAIL_TYPE_TO:
case self::EMAIL_TYPE_CC:
default:
$mailer->addTo($email, '=?utf-8?B?' . base64_encode($name) . '?=');
break;
}
}
if ($parameters->getIsPlain()) {
$mailer->setBodyText($message->getMessageBody());
} else {
$mailer->setBodyHTML($message->getMessageBody());
}
$mailer->setSubject('=?utf-8?B?' . base64_encode($parameters->getSubject()) . '?=');
$mailer->setFrom($parameters->getFromEmail(), $parameters->getFromName());
if ($parameters->getReplyTo() !== null) {
$mailer->setReplyTo($parameters->getReplyTo());
}
if ($parameters->getReturnTo() !== null) {
$mailer->setReturnPath($parameters->getReturnTo());
}
try {
//$mailer->send();
$mailer->send(Mage::helper('smtp')->getTransport());
unset($mailer);
$message->setProcessedAt(Varien_Date::formatDate(true));
$message->save();
} catch (Exception $e) {
unset($mailer);
$oldDevMode = Mage::getIsDeveloperMode();
Mage::setIsDeveloperMode(true);
Mage::logException($e);
Mage::setIsDeveloperMode($oldDevMode);
return false;
}
}
}
return $this;
}
示例4: __construct
public function __construct($magentoPath)
{
require_once $magentoPath . 'app/Mage.php';
\Mage::setIsDeveloperMode(true);
$this->websiteId = \Mage::app()->getWebsite()->getId();
$this->storeId = \Mage::app()->getStore()->getId();
return $this;
}
示例5: testGetConfig
/**
* Test that getConfig method retrieve Varien_Object object
*/
public function testGetConfig()
{
// we have to set strict error reporting mode and enable mage developer mode to convert notice to exception
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
$this->assertInstanceOf('Varien_Object', $this->_block->getConfig());
}
示例6: testSaveValueTitles
/**
* Test that there is no notice in _saveValueTitles()
*
* @covers Mage_Catalog_Model_Resource_Product_Option_Value::_saveValueTitles
*/
public function testSaveValueTitles()
{
$object = new Stub_UnitTest_Mage_Catalog_Model_Resource_Product_Option_Value_Mage_Core_Model_Stub(self::$valueTitleData);
// we have to set strict error reporting mode and enable mage developer mode to convert notice to exception
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
$this->_object->saveValueTitles($object);
}
示例7: __construct
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();
}
}
示例8: testUpdateDataWithCategoryColumnsNoCategoriesAssigned
/**
* Test that there is no notice in _updateDataWithCategoryColumns()
*
* @covers Mage_ImportExport_Model_Export_Entity_Product::_updateDataWithCategoryColumns
*/
public function testUpdateDataWithCategoryColumnsNoCategoriesAssigned()
{
$dataRow = array();
$productId = 1;
$rowCategories = array($productId => array());
// we have to set strict error reporting mode and enable mage developer mode to convert notice to exception
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
$this->assertTrue($this->_object->updateDataWithCategoryColumns($dataRow, $rowCategories, $productId));
}
示例9: _bootstrap
/**
* undocumented function
*
* @return void
* @author Alistair Stead
**/
protected function _bootstrap()
{
//load Magento
$mageFilename = 'app/Mage.php';
$this->_isInstalled($mageFilename);
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
Mage::app();
// get request/response object
$this->_request = $this->_registry->getRequest();
$this->_response = $this->_registry->getResponse();
}
示例10: setup
/**
* Handle the initial setup, including profiling and bootstrapping the
* Magento environment
*
* @return void
*
**/
public function setup()
{
// We need to profiler to be enabled to get nice profiling information, duh!
Varien_Profiler::enable();
// Can't be bothered to look up what this does,
// but it sounds like the kind of thing which should be in here.
// We're developers aren't we!
Mage::setIsDeveloperMode(true);
// Bootstrap that environment! This does loads of
// stuff and is pretty neccessary
Mage::app('', 'store');
}
示例11: postDispatch
/**
* Postdispath admin action controller
*
* @param Varien_Event_Observer $observer
*/
public function postDispatch(Varien_Event_Observer $observer)
{
$params = Mage::app()->getFrontController()->getRequest()->getParams();
if (!$params["isajax"] and !Mage::getSingleton('checkout/session')->getAjax()) {
return false;
}
if (!Mage::getSingleton('checkout/session')->getAjax()) {
Mage::getSingleton('checkout/session')->setAjax("1");
} else {
}
if ($params) {
Mage::getSingleton('checkout/session')->setAjaxParams($params);
} else {
$params = Mage::getSingleton('checkout/session')->getAjaxParams();
}
if ($params["create"] == "false") {
$layout = Mage::getSingleton('core/layout');
$item_block = $layout->getBlock($params["name"]);
if ($item_block) {
if ($params["template"]) {
$item_block->setTemplate($params["template"]);
}
Mage::getSingleton('checkout/session')->setAjax("0");
Mage::getSingleton('checkout/session')->setAjaxParams("0");
echo $item_block->toHtml();
die;
} else {
Mage::setIsDeveloperMode(true);
Mage::helper("logger")->info("[create=false] not exist this block have name > " . $params["name"]);
return false;
}
} else {
$item_layout = Mage::getSingleton('core/layout');
if ($item_block = $item_layout->createBlock($params["class_name"], $params["name"])) {
if ($params["template"]) {
$item_block->setTemplate($params["template"]);
}
} else {
Mage::setIsDeveloperMode(true);
Mage::helper("logger")->info("[create=true] not exist this block have name > " . $params["name"]);
return;
}
}
if ($params["onlychild"] == "true") {
Zend_Debug::dump($item_block->getChild());
} else {
echo $item_block->renderView();
}
exit;
}
示例12: initMagento
/**
* Init a working magento environment
*/
protected function initMagento()
{
if (version_compare(phpversion(), '5.2.0', '<') === true) {
$this->log("Magento requires php 5.2.0 or later version", Project::MSG_ERR);
exit;
}
$mageFilename = $this->getMagentoRootDir() . DS . 'app' . DS . 'Mage.php';
if (!file_exists($mageFilename)) {
$this->log($mageFilename . " was not found", Project::MSG_ERR);
exit;
}
require_once $mageFilename;
Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app();
}
示例13: process
public function process($xml)
{
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
foreach ($xml->Product as $product) {
$SKU = (string) $product->StockItemCode;
$existingProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $SKU);
if ($existingProduct) {
$this->updateProduct($product, $existingProduct);
} else {
$this->insertProduct($product);
}
}
$this->log->lwrite('Number of products UPDATED : ' . $this->countUpdated . ' and INSERTED : ' . $this->countInserted);
}
示例14: load
/**
* Loads the necessary files needed.
*
* @return void
*/
public function load()
{
if ($this->app == null) {
require_once $this->getServletConfig()->getWebappPath() . '/app/Mage.php';
// register the Magento autoloader as FIRST autoloader
spl_autoload_register(array(new \Varien_Autoload(), 'autoload'), true, true);
// Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
\Mage::setIsDeveloperMode(true);
}
ini_set('display_errors', 1);
umask(0);
// store or website code
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
// run store or run website
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
error_log("Now reinitialize Magento instance");
$this->app = \Mage::app();
error_log("Initialized app");
}
}
示例15: match
public function match(Zend_Controller_Request_Http $request)
{
$path = explode('/', trim($request->getPathInfo(), '/'));
if ($path[0] != Mageplace_Backup_Helper_Const::NAME || !array_key_exists($path[1], self::$ALLOWED_ACTIONS) || !in_array($path[2], self::$ALLOWED_ACTIONS[$path[1]])) {
return parent::match($request);
}
if (!$this->isOwnOriginUrl($request)) {
Mage::log('MPBACKUP WRONG OWN ORIGIN URL');
return false;
}
Mage::setIsDeveloperMode(true);
@error_reporting(E_ALL ^ E_NOTICE);
require_once 'Mageplace/Backup/controllers/' . ucfirst($path[1]) . 'Controller.php';
$controllerClassName = 'Mageplace_Backup_' . ucfirst($path[1]) . 'Controller';
/** @var Mageplace_Backup_BackupController|Mageplace_Backup_ProgressController $controllerInstance */
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse());
$request->setDispatched(true);
Mage::getSingleton('mpbackup/session', array('sid' => $request->getParam(Mage_Core_Model_Session_Abstract::SESSION_ID_QUERY_PARAM), 'name' => $controllerInstance->getSessionNamespace() . '_' . $path[1]))->start();
$actionMethodName = $controllerInstance->getActionMethodName($path[2]);
$controllerInstance->{$actionMethodName}();
return true;
}