当前位置: 首页>>代码示例>>PHP>>正文


PHP tsmConfig::ensureMemoryLimit方法代码示例

本文整理汇总了PHP中tsmConfig::ensureMemoryLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP tsmConfig::ensureMemoryLimit方法的具体用法?PHP tsmConfig::ensureMemoryLimit怎么用?PHP tsmConfig::ensureMemoryLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tsmConfig的用法示例。


在下文中一共展示了tsmConfig::ensureMemoryLimit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Img2Thumb

 /**
 *   Constructor - requires following vars:
 *
 *	@param string $filename			image path
 *
 *	These are additional vars:
 *
 *	@param int $newxsize			new maximum image width
 *	@param int $newysize			new maximum image height
 *	@param string $fileout			output image path
 *	@param int $thumbMaxSize		whether thumbnail should have background fill to make it exactly $newxsize x $newysize
 *	@param int $bgred				0-255 - red color variable for background filler
 *	@param int $bggreen				0-255 - green color variable for background filler
 *	@param int $bgblue				0-255 - blue color variable for background filler
 *
 */
 function Img2Thumb($filename, $newxsize = 60, $newysize = 60, $fileout = '', $thumbMaxSize = 0, $bgred = 0, $bggreen = 0, $bgblue = 0)
 {
     //Some big pictures need that
     tsmConfig::ensureMemoryLimit(128);
     //	New modification - checks color int to be sure within range
     if ($thumbMaxSize) {
         $this->maxSize = true;
     } else {
         $this->maxSize = false;
     }
     if ($bgred >= 0 || $bgred <= 255) {
         $this->bg_red = $bgred;
     } else {
         $this->bg_red = 0;
     }
     if ($bggreen >= 0 || $bggreen <= 255) {
         $this->bg_green = $bggreen;
     } else {
         $this->bg_green = 0;
     }
     if ($bgblue >= 0 || $bgblue <= 255) {
         $this->bg_blue = $bgblue;
     } else {
         $this->bg_blue = 0;
     }
     $this->NewImgCreate($filename, $newxsize, $newysize, $fileout);
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:43,代码来源:img2thumb.php

示例2: __construct

 public function __construct()
 {
     $this->_app = JFactory::getApplication();
     $this->_db = JFactory::getDBO();
     $this->_oldToNew = new stdClass();
     $this->starttime = microtime(true);
     $max_execution_time = tsmConfig::getExecutionTime();
     $jrmax_execution_time = vRequest::getInt('max_execution_time');
     if (!empty($jrmax_execution_time)) {
         // 			vmdebug('$jrmax_execution_time',$jrmax_execution_time);
         if ($max_execution_time != $jrmax_execution_time) {
             @ini_set('max_execution_time', $jrmax_execution_time);
         }
     } else {
         if ($max_execution_time < 60) {
             @ini_set('max_execution_time', 60);
         }
     }
     $this->maxScriptTime = tsmConfig::getExecutionTime() * 0.95 - 3;
     //Lets use 3 seconds of the execution time as reserve to store the progress
     $jrmemory_limit = vRequest::getInt('memory_limit');
     if (!empty($jrmemory_limit)) {
         @ini_set('memory_limit', $jrmemory_limit . 'M');
     } else {
         tsmConfig::ensureMemoryLimit(128);
     }
     $this->maxMemoryLimit = $this->return_bytes(ini_get('memory_limit')) - 14 * 1024 * 1024;
     //Lets use 11MB for joomla
     // 		vmdebug('$this->maxMemoryLimit',$this->maxMemoryLimit); //134217728
     //$this->maxMemoryLimit = $this -> return_bytes('20M');
     // 		ini_set('memory_limit','35M');
     $q = 'SELECT `id` FROM `#__tsmart_migration_oldtonew_ids` ';
     $this->_db->setQuery($q);
     $res = $this->_db->loadResult();
     if (empty($res)) {
         $q = 'INSERT INTO `#__tsmart_migration_oldtonew_ids` (`id`) VALUES ("1")';
         $this->_db->setQuery($q);
         $this->_db->execute();
         $this->_app->enqueueMessage('Start with a new migration process and setup log maxScriptTime ' . $this->maxScriptTime . ' maxMemoryLimit ' . $this->maxMemoryLimit / (1024 * 1024));
     } else {
         $this->_app->enqueueMessage('Found prior migration process, resume migration maxScriptTime ' . $this->maxScriptTime . ' maxMemoryLimit ' . $this->maxMemoryLimit / (1024 * 1024));
     }
     $this->_keepOldProductIds = tsmConfig::get('keepOldProductIds', FALSE);
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:44,代码来源:migrator.php

示例3: __construct

 public function __construct()
 {
     $this->_app = JFactory::getApplication();
     $this->_db = JFactory::getDBO();
     // 		$this->_oldToNew = new stdClass();
     $this->starttime = microtime(true);
     $max_execution_time = tsmConfig::getExecutionTime();
     $jrmax_execution_time = vRequest::getInt('max_execution_time', 300);
     if (!empty($jrmax_execution_time)) {
         // 			vmdebug('$jrmax_execution_time',$jrmax_execution_time);
         if ($max_execution_time !== $jrmax_execution_time) {
             @ini_set('max_execution_time', $jrmax_execution_time);
         }
     }
     $this->maxScriptTime = tsmConfig::getExecutionTime() * 0.9 - 1;
     //Lets use 10% of the execution time as reserve to store the progress
     tsmConfig::ensureMemoryLimit(128);
     $this->maxMemoryLimit = $this->return_bytes(ini_get('memory_limit')) * 0.85;
     $config = JFactory::getConfig();
     $this->_prefix = $config->get('dbprefix');
     $this->reCreaPri = tsmConfig::get('reCreaPri', 0);
     $this->reCreaKey = tsmConfig::get('reCreaKey', 1);
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:23,代码来源:tableupdater.php

示例4: display

 /**
  * Override of display to prevent caching
  *
  * @return  JController  A JController object to support chaining.
  */
 public function display($cachable = false, $urlparams = false)
 {
     $format = vRequest::getCmd('format', 'html');
     $layout = vRequest::getCmd('layout', 'invoice');
     if ($format != 'pdf') {
         $viewName = 'invoice';
         $view = $this->getView($viewName, $format);
         $view->headFooter = true;
         $view->display();
     } else {
         //PDF needs more RAM than usual
         tsmConfig::ensureMemoryLimit(96);
         //PDF needs xhtml links
         $this->useXHTML = true;
         $app = JFactory::getApplication();
         // Create the invoice PDF file on disk and send that back
         $orderDetails = $this->getOrderDetails();
         if (!$orderDetails) {
             $app->redirect(JRoute::_('/index.php?option=com_virtuemart'));
         }
         $fileLocation = $this->getInvoicePDF($orderDetails, 'invoice', $layout);
         if (!$fileLocation) {
             $app->redirect(JRoute::_('/index.php?option=com_virtuemart'), 'Invoice not created');
         }
         $fileName = basename($fileLocation);
         if (file_exists($fileLocation)) {
             $maxSpeed = 200;
             $range = 0;
             $size = filesize($fileLocation);
             $contentType = 'application/pdf';
             header("Cache-Control: public");
             header("Content-Transfer-Encoding: binary\n");
             header('Content-Type: application/pdf');
             $contentDisposition = 'attachment';
             $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
             if (strpos($agent, 'msie') !== FALSE) {
                 $fileName = preg_replace('/\\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
             }
             header("Content-Disposition: {$contentDisposition}; filename=\"{$fileName}\"");
             header("Accept-Ranges: bytes");
             if (isset($_SERVER['HTTP_RANGE'])) {
                 list($a, $range) = explode("=", $_SERVER['HTTP_RANGE']);
                 str_replace($range, "-", $range);
                 $size2 = $size - 1;
                 $new_length = $size - $range;
                 header("HTTP/1.1 206 Partial Content");
                 header("Content-Length: {$new_length}");
                 header("Content-Range: bytes {$range}{$size2}/{$size}");
             } else {
                 $size2 = $size - 1;
                 header("Content-Range: bytes 0-{$size2}/{$size}");
                 header("Content-Length: " . $size);
             }
             if ($size == 0) {
                 die('Zero byte file! Aborting download');
             }
             //	set_magic_quotes_runtime(0);
             $fp = fopen("{$fileLocation}", "rb");
             fseek($fp, $range);
             while (!feof($fp) and connection_status() == 0) {
                 set_time_limit(0);
                 print fread($fp, 1024 * $maxSpeed);
                 flush();
                 ob_flush();
                 sleep(1);
             }
             fclose($fp);
             $app->close();
         } else {
             // TODO: Error message
             // vmError("File $fileName not found!");
         }
     }
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:79,代码来源:invoice.php

示例5: sendVmMail

 /**
  * With this function you can use a view to sent it by email.
  * Just use a task in a controller
  *
  * @param string $view for example user, cart
  * @param string $recipient shopper@whatever.com
  * @param bool $vendor true for notifying vendor of user action (e.g. registration)
  */
 private static function sendVmMail(&$view, $recipient, $noVendorMail = FALSE)
 {
     tsmConfig::ensureMemoryLimit(96);
     tsmConfig::loadJLang('com_virtuemart', true);
     if ($noVendorMail and !empty($view->orderDetails) and !empty($view->orderDetails['details']['BT']->order_language)) {
         tsmConfig::loadJLang('com_virtuemart', true, $view->orderDetails['details']['BT']->order_language);
         tsmConfig::loadJLang('com_virtuemart_shoppers', TRUE, $view->orderDetails['details']['BT']->order_language);
         tsmConfig::loadJLang('com_virtuemart_orders', TRUE, $view->orderDetails['details']['BT']->order_language);
     } else {
         tsmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
         tsmConfig::loadJLang('com_virtuemart_orders', TRUE);
     }
     ob_start();
     $view->renderMailLayout($noVendorMail, $recipient);
     $body = ob_get_contents();
     ob_end_clean();
     $subject = isset($view->subject) ? $view->subject : tsmText::_('COM_VIRTUEMART_DEFAULT_MESSAGE_SUBJECT');
     $mailer = JFactory::getMailer();
     $mailer->addRecipient($recipient);
     $mailer->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mailer->isHTML(tsmConfig::get('order_mail_html', TRUE));
     $mailer->setBody($body);
     if (!$noVendorMail) {
         $replyTo[0] = $view->vendorEmail;
         $replyTo[1] = $view->vendor->vendor_name;
         $mailer->addReplyTo($replyTo);
     } else {
         if (isset($view->orderDetails['details']) and isset($view->orderDetails['details']['BT'])) {
             $replyTo[0] = $view->orderDetails['details']['BT']->email;
             $replyTo[1] = $view->orderDetails['details']['BT']->first_name . ' ' . $view->orderDetails['details']['BT']->last_name;
         } else {
             if (isset($view->user->email) and $view->user->name) {
                 $replyTo[0] = $view->user->email;
                 $replyTo[1] = $view->user->name;
             } else {
                 $replyTo[0] = $view->user['email'];
                 $replyTo[1] = $view->user['name'];
             }
         }
         $mailer->addReplyTo($replyTo);
     }
     if (isset($view->mediaToSend)) {
         foreach ((array) $view->mediaToSend as $media) {
             $mailer->addAttachment($media);
         }
     }
     // set proper sender
     $sender = array();
     if (!empty($view->vendorEmail) and tsmConfig::get('useVendorEmail', 0)) {
         $sender[0] = $view->vendorEmail;
         $sender[1] = $view->vendor->vendor_name;
     } else {
         // use default joomla's mail sender
         $app = JFactory::getApplication();
         $sender[0] = $app->getCfg('mailfrom');
         $sender[1] = $app->getCfg('fromname');
         if (empty($sender[0])) {
             $config = JFactory::getConfig();
             $sender = array($config->get('mailfrom'), $config->get('fromname'));
         }
     }
     $mailer->setSender($sender);
     return $mailer->Send();
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:72,代码来源:shopfunctionsf.php


注:本文中的tsmConfig::ensureMemoryLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。