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


PHP Cache::entryExists方法代码示例

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


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

示例1: getStaticStrings

 /**
  * Loads all the static strings from either the cache or the ini files. Note that ini files in modules are not verified for outdatedness, so if they were updated, just clear all the caches or hard reload a page
  * This method should not be called directly from outsite TranslationPeer except for testing and debugging purposes
  */
 public static function getStaticStrings($sLanguageId)
 {
     if (!isset(self::$STATIC_STRINGS[$sLanguageId])) {
         $oCache = new Cache($sLanguageId, DIRNAME_LANG);
         $aLanguageFiles = ResourceFinder::create()->addPath(DIRNAME_LANG, "{$sLanguageId}.ini")->all()->baseFirst()->find();
         if ($oCache->entryExists() && !$oCache->isOutdated($aLanguageFiles)) {
             self::$STATIC_STRINGS[$sLanguageId] = $oCache->getContentsAsVariable();
         } else {
             self::$STATIC_STRINGS[$sLanguageId] = array();
             //Get default strings
             foreach ($aLanguageFiles as $sLanguageFile) {
                 self::$STATIC_STRINGS[$sLanguageId] = array_merge(self::$STATIC_STRINGS[$sLanguageId], parse_ini_file($sLanguageFile));
             }
             //Get strings for modules
             foreach (ResourceFinder::create()->addExpression(DIRNAME_MODULES, ResourceFinder::ANY_NAME_OR_TYPE_PATTERN, ResourceFinder::ANY_NAME_OR_TYPE_PATTERN, DIRNAME_LANG, "{$sLanguageId}.ini")->all()->baseFirst()->find() as $sLanguageFile) {
                 self::$STATIC_STRINGS[$sLanguageId] = array_merge(self::$STATIC_STRINGS[$sLanguageId], parse_ini_file($sLanguageFile));
             }
             //Fix string encoding
             foreach (self::$STATIC_STRINGS[$sLanguageId] as $sStringKey => $sValue) {
                 self::$STATIC_STRINGS[$sLanguageId][$sStringKey] = StringUtil::encodeForDbFromFile($sValue);
             }
             $oCache->setContents(self::$STATIC_STRINGS[$sLanguageId]);
         }
     }
     return self::$STATIC_STRINGS[$sLanguageId];
 }
开发者ID:rapila,项目名称:cms-base,代码行数:30,代码来源:TranslationPeer.php

示例2: renderFile

 public function renderFile()
 {
     //Send Content-Type
     $sCharset = Settings::getSetting('encoding', 'browser', 'utf-8');
     if ($this->sType === ResourceIncluder::RESOURCE_TYPE_CSS) {
         header("Content-Type: text/css;charset={$sCharset}");
     } else {
         if ($this->sType === ResourceIncluder::RESOURCE_TYPE_JS) {
             header("Content-Type: text/javascript;charset={$sCharset}");
         }
     }
     //Find consolidated resources
     $aKeys = array();
     while (Manager::hasNextPathItem()) {
         $aKeys[] = Manager::usePath();
     }
     $sKey = 'consolidated-output-' . $this->sType . '-' . implode('|', $aKeys);
     $oCachingStrategy = clone CachingStrategy::fromConfig('file');
     $oCache = new Cache($sKey, 'resource', $oCachingStrategy);
     $oItemCachingStrategy = clone $oCachingStrategy;
     $oItemCachingStrategy->init(array('key_encode' => null));
     $oCache->sendCacheControlHeaders();
     if (!$oCache->entryExists(false)) {
         foreach ($aKeys as $sItemKey) {
             $oItemCache = new Cache($sItemKey, DIRNAME_PRELOAD, $oItemCachingStrategy);
             if (!$oItemCache->entryExists(false)) {
                 throw new Exception("Consolidated resource {$sItemKey} does not exist.");
             }
             $oCache->setContents($oItemCache->getContentsAsString() . "\n", false, true);
         }
     }
     $oCache->sendCacheControlHeaders();
     $oCache->passContents(true);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:34,代码来源:ConsolidatedResourceFileModule.php

示例3: cachedFrontend

 public function cachedFrontend($bIsPreview = false)
 {
     $oCacheKey = $this->cacheKey();
     $oCache = null;
     if ($oCacheKey !== null && !$bIsPreview) {
         $sPrefix = 'frontend_module_' . $this->getModuleName() . '_' . ($this->oLanguageObject ? $this->oLanguageObject->getPKString() : 'data_' . $this->oData);
         $oCache = new Cache($oCacheKey->render($sPrefix), DIRNAME_FULL_PAGE);
         $bIsCached = $oCache->entryExists();
         $bIsOutdated = false;
         if ($bIsCached) {
             if ($this->oLanguageObject) {
                 $bIsOutdated = $oCache->isOlderThan($this->oLanguageObject);
             }
             if (!$bIsOutdated) {
                 return $oCache->getContentsAsString();
             }
         }
     }
     $sResult = $this->renderFrontend();
     if ($sResult instanceof Template) {
         $sResult = $sResult->render();
     }
     if ($oCache) {
         $oCache->setContents($sResult);
     }
     return $sResult;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:27,代码来源:FrontendModule.php

示例4: processCSSContent

 public static function processCSSContent($sContent, $oFile)
 {
     $oCache = new Cache('preview_css' . $oFile->getInternalPath(), DIRNAME_TEMPLATES);
     header("Content-Type: text/css;charset=" . Settings::getSetting('encoding', 'browser', 'utf-8'));
     if ($oCache->entryExists() && !$oCache->isOutdated($oFile->getFullPath())) {
         $oCache->sendCacheControlHeaders();
         $oCache->passContents();
         exit;
     }
     $oParser = new Sabberworm\CSS\Parser($sContent, Sabberworm\CSS\Settings::create()->withDefaultCharset(Settings::getSetting('encoding', 'browser', 'utf-8')));
     $oCssContents = $oParser->parse();
     //Make all rules important
     // foreach($oCssContents->getAllRuleSets() as $oCssRuleSet) {
     //	foreach($oCssRuleSet->getRules() as $oRule) {
     //		$oRule->setIsImportant(true);
     //	}
     // }
     //Multiply all rules and prepend specific strings
     $aPrependages = array('#rapila_admin_menu', '.filled-container.editing', '.ui-dialog', '.cke_dialog_contents', '#widget-notifications', '.cke_reset', 'body > .cke_reset_all', '.tag_panel');
     foreach ($oCssContents->getAllDeclarationBlocks() as $oBlock) {
         $aNewSelector = array();
         foreach ($oBlock->getSelectors() as $iKey => $oSelector) {
             $sSelector = $oSelector->getSelector();
             if (StringUtil::startsWith($sSelector, "body ") || StringUtil::startsWith($sSelector, "html ")) {
                 $aNewSelector[] = $sSelector;
             } else {
                 foreach ($aPrependages as $sPrependage) {
                     if (StringUtil::startsWith($sSelector, "{$sPrependage} ") || StringUtil::startsWith($sSelector, "{$sPrependage}.") || $sSelector === $sPrependage) {
                         $aNewSelector[] = $sSelector;
                     } else {
                         $aNewSelector[] = "{$sPrependage} {$sSelector}";
                     }
                 }
             }
         }
         $oBlock->setSelector($aNewSelector);
     }
     //Absolutize all URLs
     foreach ($oCssContents->getAllValues() as $oValue) {
         if ($oValue instanceof Sabberworm\CSS\Value\URL) {
             $sURL = $oValue->getURL()->getString();
             if (!StringUtil::startsWith($sURL, '/') && !preg_match('/^\\w+:/', $sURL)) {
                 $sURL = $oFile->getFrontendDirectoryPath() . DIRECTORY_SEPARATOR . $sURL;
             }
             $oValue->setURL(new Sabberworm\CSS\Value\CSSString($sURL));
         }
     }
     $sContents = $oCssContents->render(Sabberworm\CSS\OutputFormat::createCompact());
     $oCache->setContents($sContents);
     $oCache->sendCacheControlHeaders();
     print $sContents;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:52,代码来源:NamespacedPreviewCssFileModule.php

示例5: getFilters

 public static function getFilters()
 {
     if (self::$FILTERS === null) {
         $oCache = new Cache("preconfigured_filter_handlers", DIRNAME_PRELOAD);
         if ($oCache->entryExists()) {
             self::$FILTERS = $oCache->getContentsAsVariable();
         } else {
             self::$FILTERS = new Filters();
             $oCache->setContents(self::$FILTERS);
         }
     }
     return self::$FILTERS;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:13,代码来源:FilterModule.php

示例6: dataForPart

 public static function dataForPart($sDocumentationPart, $sLanguageId)
 {
     $oCache = new Cache("documentation_content_{$sLanguageId}:{$sDocumentationPart}", DIRNAME_CONFIG);
     $oSettingsCache = new Cache(Settings::createCacheKey('documentation'), DIRNAME_CONFIG);
     if ($oCache->entryExists() && !$oCache->isOlderThan($oSettingsCache->getModificationDate())) {
         return $oCache->getContentsAsVariable();
     }
     $aMetadata = self::completeMetaData();
     if (!isset($aMetadata[$sDocumentationPart]) || !isset($aMetadata[$sDocumentationPart][$sLanguageId])) {
         $aMetadata = null;
     } else {
         $aMetadata = $aMetadata[$sDocumentationPart][$sLanguageId];
         $aMetadata['content'] = self::providerInstance($aMetadata['provider'])->contentForPart($sDocumentationPart, $sLanguageId);
     }
     $oCache->setContents($aMetadata);
     return $aMetadata;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:17,代码来源:DocumentationProviderTypeModule.php

示例7: renderFile

 public function renderFile()
 {
     $oCache = new Cache(implode('/', Manager::getUsedPath()), 'versioned');
     header("Content-Type: text/javascript;charset=utf-8");
     if ($oCache->entryExists()) {
         $oCache->sendCacheControlHeaders();
         $oCache->passContents();
         exit;
     }
     $oIncluder = new ResourceIncluder();
     // Don’t use SSL for downloads
     // Don’t include dependencies either
     $oIncluder->addJavaScriptLibrary($this->aLibraryName, $this->aVersion, $this->bUseCompression, false, false, ResourceIncluder::PRIORITY_NORMAL, false);
     $sContents = self::getResourceIncluderContents($oIncluder);
     $oCache->setContents($sContents);
     $oCache->sendCacheControlHeaders();
     print $sContents;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:18,代码来源:LocalJsLibraryFileModule.php

示例8: renderFile

 public function renderFile()
 {
     $oCache = new Cache('license_' . $this->sLicense, DIRNAME_IMAGES);
     $sExtension = substr($this->sURL, strrpos($this->sURL, '.') + 1);
     $oDocumentType = DocumentTypePeer::getDocumentTypeByExtension($sExtension);
     $sMimeType = 'image/' . $sExtension;
     if ($oDocumentType !== null) {
         $sMimeType = $oDocumentType->getMimetype();
     }
     header('Content-Type: ' . $sMimeType);
     if ($oCache->entryExists()) {
         $oCache->sendCacheControlHeaders();
         $oCache->passContents(true);
     } else {
         $sImage = file_get_contents($this->sURL);
         $oCache->setContents($sImage);
         $oCache->sendCacheControlHeaders();
         header("Content-Length: " . strlen($sImage));
         print $sImage;
     }
 }
开发者ID:rapila,项目名称:cms-base,代码行数:21,代码来源:LicenseImageFileModule.php

示例9: renderFile

 public function renderFile()
 {
     $iTemplateFlags = 0;
     $oResourceFinder = ResourceFinder::create(array(DIRNAME_MODULES, $this->sModuleType, $this->sModuleName, DIRNAME_TEMPLATES))->returnObjects();
     $sFileName = "{$this->sModuleName}.{$this->sModuleType}.{$this->sResourceType}";
     $oResourceFinder->addPath($sFileName . Template::$SUFFIX);
     if ($this->sResourceType === ResourceIncluder::RESOURCE_TYPE_CSS) {
         header("Content-Type: text/css;charset=utf-8");
         $oResourceFinder->all();
     } else {
         if ($this->sResourceType === ResourceIncluder::RESOURCE_TYPE_JS) {
             header("Content-Type: text/javascript;charset=utf-8");
             $iTemplateFlags = Template::ESCAPE | Template::NO_HTML_ESCAPE;
         } else {
             header("Content-Type: text/html;charset=utf-8");
         }
     }
     $oCache = new Cache('template_resource-' . $sFileName . '-' . Session::language(), 'resource');
     $oTemplate = null;
     if ($oCache->entryExists() && !$oCache->isOutdated($oResourceFinder)) {
         $oCache->sendCacheControlHeaders();
         $oTemplate = $oCache->getContentsAsVariable();
     } else {
         $oTemplate = new Template(TemplateIdentifier::constructIdentifier('contents'), null, true, false, null, $sFileName);
         $aResources = $oResourceFinder->find();
         if (!$aResources) {
             $aResources = array();
         }
         if ($aResources instanceof FileResource) {
             $aResources = array($aResources);
         }
         foreach ($aResources as $oResource) {
             $oSubTemplate = new Template($oResource, null, false, false, null, null, $iTemplateFlags);
             $oTemplate->replaceIdentifierMultiple('contents', $oSubTemplate, null, Template::LEAVE_IDENTIFIERS);
         }
         $oCache->setContents($oTemplate);
         $oCache->sendCacheControlHeaders();
     }
     print $oTemplate->render();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:40,代码来源:TemplateResourceFileModule.php

示例10: prepareChildren

 private function prepareChildren()
 {
     if ($this->aCustomChildren !== null) {
         return;
     }
     $sCacheKey = Session::language() . '/' . $this->getId();
     $oCache = new Cache("{$sCacheKey}/custom-children", 'navigation');
     if ($oCache->entryExists()) {
         // Not setting validators will result in the cache being always up-to-date
         $bIsOutdated = false;
         FilterModule::getFilters()->handleNavigationItemChildrenCacheDetectOutdated($this, $oCache, array(&$bIsOutdated));
         if (!$bIsOutdated) {
             $this->aCustomChildren = $oCache->getContentsAsVariable();
             foreach ($this->aCustomChildren as $oChildNavigationItem) {
                 $oChildNavigationItem->oParent = $this;
             }
             return;
         }
     }
     $this->aCustomChildren = array();
     FilterModule::getFilters()->handleNavigationItemChildrenRequested($this);
     $oCache->setContents($this->aCustomChildren, true);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:23,代码来源:NavigationItem.php

示例11: getModuleMetadataByTypeAndName

 /**
  * Fetches all module metadata (including module info obtained from the info.yml files) and stores it into a static field, returns it
  */
 public static function getModuleMetadataByTypeAndName($sType, $sName)
 {
     $aModuleMetadata = @self::$MODULES_METADATA_LIST[$sType][$sName];
     if ($aModuleMetadata !== null) {
         return $aModuleMetadata;
     }
     $oInfoFileFinder = ResourceFinder::create(array(DIRNAME_MODULES, $sType, $sName, self::INFO_FILE))->all();
     $oCache = new Cache("module_md_{$sType}-{$sName}", DIRNAME_PRELOAD);
     if ($oCache->entryExists() && !$oCache->isOutdated($oInfoFileFinder)) {
         $aModuleMetadata = $oCache->getContentsAsVariable();
     } else {
         //Module exists?
         $aModulePath = array(DIRNAME_MODULES, $sType, $sName);
         if (ResourceFinder::findResource($aModulePath) === null) {
             $aModuleMetadata = null;
             return null;
         }
         $aModuleMetadata = array();
         //General info
         $aModuleMetadata['path'] = $aModulePath;
         $aModuleMetadata['type'] = $sType;
         $aModuleMetadata['name'] = $sName;
         //Folders
         $aModuleMetadata['folders'] = array();
         $aFolders = ResourceFinder::findResourceObjectsByExpressions(array(DIRNAME_MODULES, $sType, $sName, ResourceFinder::ANY_NAME_OR_TYPE_PATTERN));
         foreach ($aFolders as $oFolder) {
             $aModuleMetadata['folders'][] = $oFolder->getFileName();
         }
         //Module-info
         $aModuleInfo = array();
         require_once "spyc/Spyc.php";
         foreach ($oInfoFileFinder->find() as $sPath) {
             $aModuleInfo = array_merge($aModuleInfo, Spyc::YAMLLoad($sPath));
         }
         if (!isset($aModuleInfo['enabled'])) {
             $aModuleInfo['enabled'] = true;
         }
         $aModuleMetadata['module_info'] = $aModuleInfo;
         if (!isset(self::$MODULES_METADATA_LIST[$sType])) {
             self::$MODULES_METADATA_LIST[$sType] = array();
         }
         $oCache->setContents($aModuleMetadata);
     }
     self::$MODULES_METADATA_LIST[$sType][$sName] = $aModuleMetadata;
     return $aModuleMetadata;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:49,代码来源:Module.php

示例12: getInstance

 public static function getInstance($sFile = null)
 {
     if ($sFile === null) {
         $sFile = "config";
     }
     $sCacheKey = self::createCacheKey($sFile);
     $sFileName = "{$sFile}.yml";
     if (!isset(self::$INSTANCES[$sCacheKey])) {
         $oCache = new Cache($sCacheKey, DIRNAME_CONFIG, CachingStrategyFile::create());
         $oFinder = ResourceFinder::create(array(DIRNAME_CONFIG))->addOptionalPath(ErrorHandler::getEnvironment())->addPath($sFileName)->byExpressions()->searchBaseFirst()->all();
         if ($oCache->entryExists() && !$oCache->isOutdated($oFinder)) {
             self::$INSTANCES[$sCacheKey] = $oCache->getContentsAsVariable();
         } else {
             self::$INSTANCES[$sCacheKey] = new Settings($oFinder, $sFile);
             $oCache->setContents(self::$INSTANCES[$sCacheKey]);
         }
     }
     return self::$INSTANCES[$sCacheKey];
 }
开发者ID:rapila,项目名称:cms-base,代码行数:19,代码来源:Settings.php

示例13: __construct

 /**
  * @param string $sTemplateName template name
  * @param string|array $mPath template dir path
  * @param boolean $bTemplateIsTextOnly template is text only (name will be used as content, path can be used to decide origin [null=filesystem, "db"=database, "browser"=request])
  * @param boolean $bDirectOutput template will output directly to stream? only one the main template should have set this to true
  * @param string $sTargetEncoding target encoding. usually the browser encoding. text will be converted from the source encoding (default is utf-8, at the moment only changed when using text-only templates) into the target encoding
  * @param string $sRootTemplateName root template name, used internally when including subtemplates, default=null
  * @param int $iDefaultFlags default flags, will be ORed to the flags you provide when calling {@link replaceIdentifier()} and {@link replaceIdentifierMultiple()}
  */
 public function __construct($sTemplateName, $mPath = null, $bTemplateIsTextOnly = false, $bDirectOutput = false, $sTargetEncoding = null, $sRootTemplateName = null, $iDefaultFlags = 0)
 {
     if ($sTargetEncoding === null) {
         $sTargetEncoding = Settings::getSetting("encoding", "browser", "utf-8");
     }
     if ($mPath === "db") {
         $this->sEncoding = Settings::getSetting("encoding", "db", "utf-8");
     } else {
         if ($mPath === "browser") {
             $this->sEncoding = Settings::getSetting("encoding", "browser", "utf-8");
         }
     }
     if ($mPath === null || $mPath === "db" || $mPath === "browser") {
         $mPath = DIRNAME_TEMPLATES;
     }
     $sTemplateText = "";
     $this->aTemplateContents = array();
     $oCache = null;
     $bCacheIsCurrent = false;
     if ($bTemplateIsTextOnly) {
         $sTemplateText = $sTemplateName;
         $sTemplateName = $sRootTemplateName;
     } else {
         if ($sTemplateName instanceof FileResource) {
             $oPath = $sTemplateName;
             $aPath = explode('/', $oPath->getRelativePath());
             $sTemplateName = $oPath->getFileName(self::$SUFFIX);
         } else {
             $aPath = ResourceFinder::parsePathArguments(null, $mPath, $sTemplateName . self::$SUFFIX);
             $oPath = ResourceFinder::findResourceObject($aPath);
         }
         if ($oPath === null) {
             throw new Exception("Error in Template construct: Template file " . implode("/", $aPath + array($sTemplateName . self::$SUFFIX)) . " does not exist");
         }
         if (Settings::getSetting('general', 'template_caching', false)) {
             $oCache = new Cache($oPath->getFullPath() . "_" . LocaleUtil::getLocaleId() . "_" . $sTargetEncoding . "_" . $sRootTemplateName, DIRNAME_TEMPLATES);
             $bCacheIsCurrent = $oCache->entryExists() && !$oCache->isOutdated($oPath->getFullPath());
         }
         if (!$bCacheIsCurrent) {
             $sTemplateText = file_get_contents($oPath->getFullPath());
         }
         $mPath = $aPath;
         array_pop($mPath);
     }
     if ($sRootTemplateName === null && !$bTemplateIsTextOnly) {
         $sRootTemplateName = $sTemplateName;
     }
     if ($sRootTemplateName === null) {
         $sRootTemplateName = '';
     }
     $this->sTemplateName = $sRootTemplateName;
     if (StringUtil::startsWith($sTemplateName, 'e_mail_') || StringUtil::startsWith($sTemplateName, 'email_')) {
         $iDefaultFlags |= self::NO_HTML_ESCAPE;
     } else {
         if (StringUtil::endsWith($sTemplateName, '.js') || StringUtil::endsWith($sTemplateName, '.css')) {
             $iDefaultFlags |= self::NO_HTML_ESCAPE | self::ESCAPE;
         } else {
             if (StringUtil::endsWith($this->sTemplateName, '.js') || StringUtil::endsWith($this->sTemplateName, '.css')) {
                 //I’m not a js template but my parent is
                 $iDefaultFlags &= ~(self::NO_HTML_ESCAPE | self::ESCAPE);
             }
         }
     }
     $this->mPath = $mPath;
     $this->oSpecialTemplateIdentifierActions = new SpecialTemplateIdentifierActions($this);
     $this->iDefaultFlags = $iDefaultFlags;
     if ($bCacheIsCurrent) {
         $this->aTemplateContents = $oCache->getContentsAsVariable();
         foreach ($this->aTemplateContents as &$mContent) {
             if ($mContent instanceof TemplatePart) {
                 $mContent->setTemplate($this);
             }
         }
     } else {
         if (is_array($sTemplateText)) {
             $this->aTemplateContents = $sTemplateText;
         } else {
             $sTemplateText = StringUtil::encode($sTemplateText, $this->sEncoding, $sTargetEncoding);
             $this->aTemplateContents = self::templateContentsFromText($sTemplateText, $this);
             $this->replaceConditionals(true);
             $this->renderDirectOutput();
         }
         $this->replaceSpecialIdentifiersOnStart();
         if ($oCache !== null) {
             $oCache->setContents($this->aTemplateContents);
         }
     }
     $this->sEncoding = $sTargetEncoding;
     $this->bDirectOutput = $bDirectOutput;
     $this->replaceConditionals(true);
     $this->renderDirectOutput();
//.........这里部分代码省略.........
开发者ID:rapila,项目名称:cms-base,代码行数:101,代码来源:Template.php

示例14: allParts

 public static function allParts()
 {
     $oCache = new Cache("system_parts", DIRNAME_CONFIG, CachingStrategyFile::create());
     if ($oCache->entryExists()) {
         return $oCache->getContentsAsVariable();
     }
     $oBasePart = new BasePart();
     $oSitePart = new SitePart();
     $aParts = array(DIRNAME_BASE => $oBasePart);
     // Get all plugins
     foreach (ResourceFinder::pluginFinder()->returnObjects()->find() as $oPath) {
         $oPluginPart = SystemPart::getPart($oPath->getRelativePath());
         // Plugins depend on base implicitly
         $oPluginPart->dependOn($oBasePart);
         // Site depends on plugins implicitly
         $oSitePart->dependOn($oPluginPart);
         $aParts[$oPath->getRelativePath()] = $oPluginPart;
     }
     $oSitePart->dependOn($oBasePart);
     $aParts[DIRNAME_SITE] = $oSitePart;
     // Add dependencies from info
     foreach ($aParts as $oPart) {
         $aInfo = $oPart->getInfo();
         foreach ($aInfo['dependencies'] as $sDependencyPrefix => $sVersion) {
             if (isset($aParts[$sDependencyPrefix])) {
                 $oPart->dependOn($aParts[$sDependencyPrefix]);
             } else {
                 throw new Exception("Dependency of {$oPart->getPrefix()} on {$sDependencyPrefix} can not be satisfied");
             }
         }
         foreach ($aInfo['optional_dependencies'] as $sDependencyPrefix => $sVersion) {
             if (isset($aParts[$sDependencyPrefix])) {
                 $oPart->dependOn($aParts[$sDependencyPrefix]);
             }
         }
     }
     // Order list by dependencies
     $aParts = self::orderedParts($aParts);
     // Cache ordered list
     $oCache->setContents($aParts);
     return $aParts;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:42,代码来源:SystemPart.php

示例15: 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;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:20,代码来源:ResourceFinder.php


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