本文整理汇总了PHP中VmConfig::getMemoryLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP VmConfig::getMemoryLimit方法的具体用法?PHP VmConfig::getMemoryLimit怎么用?PHP VmConfig::getMemoryLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VmConfig
的用法示例。
在下文中一共展示了VmConfig::getMemoryLimit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* constructs a VmModel
* setMainTable defines the maintable of the model
*
* @author Max Milbers
*/
function __construct()
{
parent::__construct('virtuemart_product_id');
$this->setMainTable('products');
$this->starttime = microtime(TRUE);
$this->maxScriptTime = VmConfig::getExecutionTime() * 0.95 - 1;
$this->memory_limit = VmConfig::getMemoryLimit() - 4;
// $this->addvalidOrderingFieldName(array('m.mf_name','pp.product_price'));
$app = JFactory::getApplication();
if ($app->isSite()) {
$this->_validOrderingFieldName = array();
$browseOrderByFields = VmConfig::get('browse_orderby_fields', array('product_sku', 'category_name', 'mf_name', 'product_name'));
} else {
if (!class_exists('shopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$browseOrderByFields = ShopFunctions::getValidProductFilterArray();
$this->addvalidOrderingFieldName(array('product_price', 'product_sales'));
//$this->addvalidOrderingFieldName (array('product_price'));
// vmdebug('$browseOrderByFields',$browseOrderByFields);
}
$this->addvalidOrderingFieldName((array) $browseOrderByFields);
$this->removevalidOrderingFieldName('virtuemart_product_id');
//$this->removevalidOrderingFieldName ('product_sales');
//unset($this->_validOrderingFieldName[0]);//virtuemart_product_id
array_unshift($this->_validOrderingFieldName, 'p.virtuemart_product_id');
$this->_selectedOrdering = VmConfig::get('browse_orderby_field', '`p`.virtuemart_product_id');
$this->setToggleName('product_special');
$this->initialiseRequests();
//This is just done now for the moment for developing, the idea is of course todo this only when needed.
$this->updateRequests();
}
示例2: ensureMemoryLimit
/**
* Ensures a certain Memory limit for php (if server supports it)
* @author Max Milbers
* @param int $minMemory
*/
static function ensureMemoryLimit($minMemory = 0)
{
if ($minMemory === 0) {
$minMemory = VmConfig::get('minMemory', '128M');
}
$memory_limit = VmConfig::getMemoryLimit();
if ($memory_limit < $minMemory) {
@ini_set('memory_limit', $minMemory . 'M');
}
}