コード例 #1
0
ファイル: BxDolPFM.php プロジェクト: Arvindvi/dolphin
 function createCache()
 {
     // clear page blocks cache for join and search form blocks
     bx_import('BxDolPageViewAdmin');
     // for clear caching abilities
     $oPageViewCacher = new BxDolPageViewCacher('', '');
     $oCacheBlocks = $oPageViewCacher->getBlocksCacheObject();
     $aBlockIds = array(4, 146, 147, 156);
     $aKeys = array(true . 'tab' . false, false . 'tab' . false, true . 'popup' . false, false . 'popup' . false, true . 'tab' . true, false . 'tab' . true, true . 'popup' . true, false . 'popup' . true);
     foreach ($aBlockIds as $iBlockId) {
         foreach ($aKeys as $sKey) {
             $oCacheBlocks->delData($oPageViewCacher->genBlocksCacheKey($iBlockId . $sKey));
         }
     }
     $sCacheString = "// cache of Profile Fields\n\nreturn array(\n  //areas\n";
     // get areas
     foreach ($this->aAreasProps as $iAreaID => $aArea) {
         $oArea = new BxDolProfileFieldsArea($iAreaID, $this);
         $sCacheString .= $oArea->getCacheString();
     }
     $sCacheString .= ");\n";
     $aCacheArray = eval($sCacheString);
     $oCache = $GLOBALS['MySQL']->getDbCacheObject();
     return $oCache->setData($GLOBALS['MySQL']->genDbCacheKey('sys_profile_fields'), $aCacheArray);
 }
コード例 #2
0
 function createCache()
 {
     $rCacheFile = @fopen($this->sCacheFile, 'w');
     if (!$rCacheFile) {
         echo '<br /><b>Warning!</b> Cannot open Profile Fields cache file (' . $this->sCacheFile . ') for write.';
         return false;
     }
     $sCacheString = "// cache of Profile Fields\n\nreturn array(\n  //areas\n";
     // get areas
     foreach ($this->aAreasProps as $iAreaID => $aArea) {
         $oArea = new BxDolProfileFieldsArea($iAreaID, $this);
         $sCacheString .= $oArea->getCacheString();
     }
     $sCacheString .= ");\n";
     $iRes = fwrite($rCacheFile, $sCacheString);
     fclose($rCacheFile);
     if ($iRes === false) {
         echo '<br /><b>Warning!</b> Cannot write to Profile Fields cache file (' . $this->sCacheFile . ').';
         return false;
     }
     return true;
 }