本文整理汇总了PHP中ErrorHandler::isProduction方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::isProduction方法的具体用法?PHP ErrorHandler::isProduction怎么用?PHP ErrorHandler::isProduction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::isProduction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isOutdated
/**
* Looks if the cached contents are older than the modified dates of any of the given files
* Pass a ResourceFinder instance rather than an array to prevent the (potentially expensive) call to ResourceFinder->find() in production.
* @param string|array|ResourceFinder $mOriginalFilePath
*/
public function isOutdated($mOriginalFilePath)
{
if (ErrorHandler::isProduction()) {
//Files are never out of date in production (clear the cache manually when deploying)… no need to check
return false;
}
if ($mOriginalFilePath instanceof ResourceFinder) {
$mOriginalFilePath = $mOriginalFilePath->find();
}
if ($mOriginalFilePath === null) {
return false;
}
if (!is_array($mOriginalFilePath)) {
$mOriginalFilePath = array($mOriginalFilePath);
}
foreach ($mOriginalFilePath as $sOriginalFilePath) {
if ($sOriginalFilePath instanceof FileResource) {
$sOriginalFilePath = $sOriginalFilePath->getFullPath();
}
$iFileModDate = 0;
if (file_exists($sOriginalFilePath)) {
$iFileModDate = filemtime($sOriginalFilePath);
}
if ($this->isOlderThan($iFileModDate)) {
return true;
}
}
return false;
}
示例2: find
/**
* @return bool|string|FileResource|array the matched path(s)
*/
public function find()
{
if ($this->mResult === false) {
if (!$this->bNoCache && ErrorHandler::isProduction()) {
$oCache = new Cache(serialize($this), 'resource_finder', CachingStrategyFile::create());
if ($oCache->entryExists()) {
$this->mResult = $oCache->getContentsAsVariable();
} else {
$this->mResult = $this->doFind();
$oCache->setContents($this->mResult, true);
}
} else {
$this->mResult = $this->doFind();
}
}
return $this->mResult;
}