本文整理汇总了PHP中eZPackage::cacheDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPackage::cacheDirectory方法的具体用法?PHP eZPackage::cacheDirectory怎么用?PHP eZPackage::cacheDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPackage
的用法示例。
在下文中一共展示了eZPackage::cacheDirectory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchPackages
static function fetchPackages($parameters = array(), $filterArray = array())
{
$packageRepositories = eZPackage::packageRepositories($parameters);
$packages = array();
$requiredType = null;
$requiredPriority = null;
$requiredVendor = null;
$requiredExtension = null;
if (isset($filterArray['type'])) {
$requiredType = $filterArray['type'];
}
if (isset($filterArray['priority'])) {
$requiredPriority = $filterArray['priority'];
}
if (isset($filterArray['vendor'])) {
$requiredVendor = $filterArray['vendor'];
}
if (isset($filterArray['extension'])) {
$requiredExtension = $filterArray['extension'];
}
$repositoryID = false;
if (isset($parameters['repository_id'])) {
$repositoryID = $parameters['repository_id'];
}
$dbAvailable = true;
if (isset($parameters['db_available'])) {
$dbAvailable = $parameters['db_available'];
}
foreach ($packageRepositories as $packageRepository) {
if (strlen($repositoryID) == 0 or $repositoryID == $packageRepository['id']) {
$path = $packageRepository['path'];
if (file_exists($path)) {
$fileList = array();
$dir = opendir($path);
while (($file = readdir($dir)) !== false) {
if ($file == '.' or $file == '..') {
continue;
}
$fileList[] = $file;
}
closedir($dir);
sort($fileList);
foreach ($fileList as $file) {
$dirPath = $path . '/' . $file;
if (!is_dir($dirPath)) {
continue;
}
$filePath = $dirPath . '/' . eZPackage::definitionFilename();
if (file_exists($filePath)) {
$fileModification = filemtime($filePath);
$name = $file;
$packageCachePath = $dirPath . '/' . eZPackage::cacheDirectory() . '/package.php';
unset($package);
$package = false;
$cacheExpired = false;
if (eZPackage::useCache()) {
$package = eZPackage::fetchFromCache($dirPath, $fileModification, $cacheExpired);
}
if (!$package) {
$package = eZPackage::fetchFromFile($filePath);
if ($package and $cacheExpired and eZPackage::useCache()) {
$package->storeCache($dirPath . '/' . eZPackage::cacheDirectory());
}
}
if (!$package) {
continue;
}
if ($dbAvailable) {
$package->getInstallState();
}
if ($requiredType !== null) {
$type = $package->attribute('type');
if ($type != $requiredType) {
continue;
}
}
if ($requiredPriority !== null) {
$priority = $package->attribute('priority');
if ($priority != $requiredPriority) {
continue;
}
}
if ($requiredExtension !== null) {
$extension = $package->attribute('extension');
if ($extension != $requiredExtension) {
continue;
}
}
if ($requiredVendor !== null) {
$vendor = $package->attribute('vendor');
if ($vendor != $requiredVendor) {
continue;
}
}
$package->setCurrentRepositoryInformation($packageRepository);
$packages[] =& $package;
}
}
}
}
//.........这里部分代码省略.........