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


PHP eZSys::cacheDirectory方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $http = eZHTTPTool::instance();
     //  @todo change hasVariable to hasPostVariable
     if (!$http->hasVariable('key') || !$http->hasVariable('image_id') || !$http->hasVariable('image_version') || !$http->hasVariable('history_version')) {
         //  @todo manage errors
         return;
     }
     $this->key = $http->variable('key');
     $this->image_id = $http->variable('image_id');
     $this->image_version = $http->variable('image_version');
     $this->history_version = $http->variable('history_version');
     // retieve the attribute image
     $this->original_image = eZContentObjectAttribute::fetch($this->image_id, $this->image_version)->attribute('content');
     if ($this->original_image === null) {
         //  @todo manage error (the image_id does not match any existing image)
         return;
     }
     // we could store the images in var/xxx/cache/public
     $this->working_folder = eZSys::cacheDirectory() . "/public/ezie/" . $this->key;
     $this->image_path = $this->working_folder . "/" . $this->history_version . "-" . $this->original_image->attributeFromOriginal('filename');
     // check if file exists (that will mean the data sent is correct)
     $absolute_image_path = eZSys::rootDir() . "/" . $this->image_path;
     $handler = eZClusterFileHandler::instance();
     if (!$handler->fileExists($this->image_path)) {
         // @todo manage error
         return;
     }
     $this->prepare_region();
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:33,代码来源:image_pre_action.php

示例2: __construct

 public function __construct()
 {
     $this->cacheSettings = array('path' => eZSys::cacheDirectory() . '/' . static::$cacheDirectory . '/', 'ttl' => 60);
     $this->debugAccumulatorGroup = 'nxc_social_networks_feed_';
     $this->debugAccumulatorGroup .= strtolower(str_replace(__CLASS__, '', get_called_class()));
     eZDebug::createAccumulatorGroup($this->debugAccumulatorGroup, static::$debugMessagesGroup);
 }
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:7,代码来源:feed.php

示例3: eZMutex

 function eZMutex($name)
 {
     $this->Name = md5($name);
     $mutexPath = eZDir::path(array(eZSys::cacheDirectory(), 'ezmutex'));
     eZDir::mkdir($mutexPath, false, true);
     $this->FileName = eZDir::path(array($mutexPath, $this->Name));
     $this->MetaFileName = eZDir::path(array($mutexPath, $this->Name . '_meta'));
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:8,代码来源:ezmutex.php

示例4: __construct

 /**
  * Constructor
  */
 function __construct()
 {
     $this->Timestamps = array();
     $this->IsModified = false;
     $cacheDirectory = eZSys::cacheDirectory();
     $this->CacheFile = eZClusterFileHandler::instance($cacheDirectory . '/' . 'expiry.php');
     $this->restore();
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:11,代码来源:ezexpiryhandler.php

示例5: dailyValue

    /**
     * @param string $name
     * @param mixed $value
     * @param string $cacheFileName
     * @return mixed|null
     */
    public static function dailyValue( $name, $value = null, $cacheFileName = null )
    {
        if ( $value === null && isset($memoryCache[$name]) && $cacheFileName === null )
        {
            return self::$memoryCache[$name];
        }
        else
        {
            if (is_null($cacheFileName))
            {
                $cacheFileName = self::DAILY_CACHE_FILE . '_' . ClusterTool::clusterIdentifier();
            }

            $cache = new eZPHPCreator(
                eZSys::cacheDirectory(),
                $cacheFileName . '.php',
                '',
                array()
            );

            $expiryTime = time() - 24 * 3600;

            // reading
            if ($cache->canRestore($expiryTime))
            {
                $values = $cache->restore(array('cacheTable' => 'cacheTable'));

                if (is_null($value))
                {
                    if (isset($values['cacheTable'][$name]))
                    {
                        return $values['cacheTable'][$name];
                    }
                    else
                    {
                        return null;
                    }
                }
            }
            else
            {
                $values = array('cacheTable' => array());
            }

            $values['cacheTable'][$name] = $value;
            if ( $cacheFileName == self::DAILY_CACHE_FILE . '_' . ClusterTool::clusterIdentifier() )
                self::$memoryCache = $values['cacheTable'];

            // writing
            $cache->addVariable('cacheTable', $values['cacheTable']);
            $cache->store(true);
            $cache->close();
        }

        return null;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:62,代码来源:cacheTool.php

示例6: __construct

 /**
  * Creates a new cache storage for a given location through eZ Publish cluster mechanism
  * Options can contain the 'ttl' ( Time-To-Life ). This is per default set
  * to 1 day.
  *
  * @param string $location Path to the cache location inside the cluster
  * @param array(string=>string) $options Options for the cache.
  */
 public function __construct($location, $options = array())
 {
     $path = eZSys::cacheDirectory() . '/rest/' . $location;
     if (!file_exists($path)) {
         if (!eZDir::mkdir($path, false, true)) {
             throw new ezcBaseFilePermissionException($path, ezcBaseFileException::WRITE, 'Cache location is not writeable.');
         }
     }
     parent::__construct($path);
     $this->properties['options'] = new ezpCacheStorageClusterOptions($options);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:19,代码来源:cluster.php

示例7: save_token

 public static function save_token($SettingsBlock, $Token, $TokenSuffix = false)
 {
     $ngpush_cache = eZSys::cacheDirectory() . (self::ngpush_cache_dir ? '/' . self::ngpush_cache_dir : '');
     $token_file = $ngpush_cache . '/' . (self::token_prefix ? '_' . self::token_prefix : '') . $SettingsBlock . ($TokenSuffix ? '_' . $TokenSuffix : '') . '.txt';
     $fileHandler = eZClusterFileHandler::instance($token_file);
     $fileHandler->storeContents($Token);
     $storedToken = $fileHandler->fetchContents();
     if ($storedToken !== false) {
         return true;
     }
     return false;
 }
开发者ID:Nick-lion-22,项目名称:parsing,代码行数:12,代码来源:follow.php

示例8: testFetchListWithBlankCacheFile

 /**
  * Regression test for issue #18613 :
  * Empty ezcontentlanguage_cache.php not being regenerated.
  * This cache file should always exist, but if for some reason it's empty (lost sync with cluster for instance),
  * it should be at least properly regenerated
  *
  * @link http://issues.ez.no/18613
  * @group issue18613
  */
 public function testFetchListWithBlankCacheFile()
 {
     // First simulate a problem generating the language cache file (make it blank)
     $cachePath = eZSys::cacheDirectory() . '/ezcontentlanguage_cache.php';
     $clusterFileHandler = eZClusterFileHandler::instance($cachePath);
     $clusterFileHandler->storeContents('', 'content', 'php');
     unset($GLOBALS['eZContentLanguageList']);
     // Language list should never be empty
     self::assertNotEmpty(eZContentLanguage::fetchList());
     // Remove the test language cache file
     $clusterFileHandler->delete();
     $clusterFileHandler->purge();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:22,代码来源:ezcontentlanguage_regression.php

示例9: handleFile

 function handleFile(&$upload, &$result, $filePath, $originalFilename, $mimeinfo, $location, $existingNode)
 {
     $tmpDir = getcwd() . "/" . eZSys::cacheDirectory();
     $originalFilename = basename($originalFilename);
     $tmpFile = $tmpDir . "/" . $originalFilename;
     copy($filePath, $tmpFile);
     $import = new eZOOImport();
     $tmpResult = $import->import($tmpFile, $location, $originalFilename, 'import', $upload);
     $result['contentobject'] = $tmpResult['Object'];
     $result['contentobject_main_node'] = $tmpResult['MainNode'];
     unlink($tmpFile);
     return true;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:13,代码来源:ezopenofficeuploadhandler.php

示例10: testCanRestore

 /**
  * Test scenario for issue #014897: Object/class name pattern and cache issues [patch]
  *
  * @result $phpCache->canRestore() returns true
  * @expected $phpCache->canRestore() should return false
  *
  * @link http://issues.ez.no/14897
  */
 public function testCanRestore()
 {
     $db = eZDB::instance();
     $dbName = md5($db->DB);
     $cacheDir = eZSys::cacheDirectory();
     $phpCache = new eZPHPCreator($cacheDir, 'classidentifiers_' . $dbName . '.php', '', array('clustering' => 'classidentifiers'));
     $handler = eZExpiryHandler::instance();
     $expiryTime = 0;
     if ($handler->hasTimestamp('class-identifier-cache')) {
         $expiryTime = $handler->timestamp('class-identifier-cache');
     }
     $this->assertFalse($phpCache->canRestore($expiryTime));
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:21,代码来源:ezphpcreator_regression.php

示例11: dailyValue

    /**
     * @param string $name
     * @param mixed $value
     * @return array
     */
    public static function dailyValue( $name, $value = null)
    {
        if ( $value === null && isset($memoryCache[$name]) )
        {
            return self::$memoryCache[$name];
        }
        else
        {
            $cache = new eZPHPCreator(
                eZSys::cacheDirectory(),
                self::GLOBAL_CACHE_FILE . '.php',
                '',
                array() // removed clustering
            );

            $expiryTime = time() - 24 * 3600;

            // reading
            if ($cache->canRestore($expiryTime))
            {
                $values = $cache->restore(array('cacheTable' => 'cacheTable'));
                self::$memoryCache = $values['cacheTable'];

                if (is_null($value))
                {
                    if (isset($values['cacheTable'][$name]))
                    {
                        return $values['cacheTable'][$name];
                    }
                    else
                    {
                        return null;
                    }
                }
            }
            else
            {
                $values = array('cacheTable' => array());
            }

            if ( !is_null($value) )
            {
                $values['cacheTable'][$name] = $value;
                $cache->addVariable('cacheTable', $values['cacheTable']);
                $cache->store(true);
                $cache->close();
            }
        }

        return null;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:56,代码来源:globalCacheTool.php

示例12: getCssFilePath

    /**
     * @return mixed
     */
    public function getCssFilePath()
    {
        if ( is_null($this->_cssFilePath) )
        {
            $cssDirectory = eZSys::cacheDirectory() . '/css';
            $this->_cssFilePath = $cssDirectory .'/' . md5( $this->getLessFilePath() ) . '.css';
            if ( !file_exists( $cssDirectory ))
            {
                eZDir::mkdir( $cssDirectory );
            }
        }

        return $this->_cssFilePath;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:17,代码来源:KLessFile.php

示例13: parseFile

 function parseFile($fileName)
 {
     if (!$fileName) {
         eZDebug::writeError("eztika cannot find the file {$fileName}; skipping", 'eztika class eZMultiParser');
         return false;
     }
     $originalFileSize = filesize($fileName);
     $this->writeEzTikaLog('[START] eZMultiParser for File: ' . round($originalFileSize / 1024, 2) . ' KByte ' . $fileName);
     $binaryINI = eZINI::instance('binaryfile.ini');
     $textExtractionTool = $binaryINI->variable('MultiHandlerSettings', 'TextExtractionTool');
     $startTime = mktime();
     $tmpName = eZSys::cacheDirectory() . eZSys::fileSeparator() . 'eztika_' . md5($startTime) . '.txt';
     $handle = fopen($tmpName, "w");
     fclose($handle);
     chmod($tmpName, 0777);
     $cmd = "{$textExtractionTool} {$fileName} > {$tmpName}";
     $this->writeEzTikaLog('exec: ' . $cmd);
     // perform eztika command
     exec($cmd, $returnArray, $returnCode);
     $this->writeEzTikaLog("exec returnCode: {$returnCode}");
     $metaData = '';
     if (file_exists($tmpName)) {
         $fp = fopen($tmpName, 'r');
         $fileSize = filesize($tmpName);
         $metaData = fread($fp, $fileSize);
         fclose($fp);
         // keep tempfile in debugmode
         if ($this->DebugKeepTempFiles === true) {
             $this->writeEzTikaLog('keep tempfile for debugging extracted metadata: ' . $tmpName);
         } else {
             $this->writeEzTikaLog('unlink tempfile: ' . $tmpName);
             unlink($tmpName);
         }
         if ($fileSize === false || $fileSize === 0) {
             $this->writeEzTikaLog("[ERROR] no metadata was extracted! Check if eztika is working correctly");
         } else {
             $this->writeEzTikaLog('metadata read from tempfile ' . round($fileSize / 1024, 2) . ' KByte');
         }
     } else {
         $this->writeEzTikaLog("[ERROR] no tempfile '{$tmpName}' for eztika output exists,\n                check if eztika command is working,\n                check if eztika is executeable");
     }
     // write an error message to error.log if no data could be extracted
     if ($metaData == '' && $originalFileSize > 0) {
         eZDebug::writeError("eztika can not extract content from binaryfile for searchindex \nexec( {$cmd} )", 'eztika class eZMultiParser');
     }
     $endTime = mktime();
     $seconds = $endTime - $startTime;
     $this->writeEzTikaLog("[END] after {$seconds} s");
     return $metaData;
 }
开发者ID:kaliop-uk,项目名称:eztika,代码行数:50,代码来源:ezmultiparser.php

示例14: store

 /**
  * Stores the current timestamps values to cache
  **/
 function store()
 {
     if ($this->IsModified) {
         $cacheDirectory = eZSys::cacheDirectory();
         $storeString = "<?php\n\$Timestamps = array( ";
         $i = 0;
         foreach ($this->Timestamps as $key => $value) {
             if ($i > 0) {
                 $storeString .= ",\n" . str_repeat(' ', 21);
             }
             $storeString .= "'{$key}' => {$value}";
             ++$i;
         }
         $storeString .= " );\n?>";
         $this->CacheFile->storeContents($storeString, 'expirycache', false, true);
         $this->IsModified = false;
     }
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:21,代码来源:ezexpiryhandler.php

示例15: clearCache

 public static function clearCache()
 {
     eZDebug::writeNotice("Clear calendar taxonomy cache", __METHOD__);
     $ini = eZINI::instance();
     if ($ini->hasVariable('SiteAccessSettings', 'RelatedSiteAccessList') && ($relatedSiteAccessList = $ini->variable('SiteAccessSettings', 'RelatedSiteAccessList'))) {
         if (!is_array($relatedSiteAccessList)) {
             $relatedSiteAccessList = array($relatedSiteAccessList);
         }
         $relatedSiteAccessList[] = $GLOBALS['eZCurrentAccess']['name'];
         $siteAccesses = array_unique($relatedSiteAccessList);
     } else {
         $siteAccesses = $ini->variable('SiteAccessSettings', 'AvailableSiteAccessList');
     }
     $cacheBaseDir = eZDir::path(array(eZSys::cacheDirectory(), self::cacheDirectory()));
     $fileHandler = eZClusterFileHandler::instance();
     $fileHandler->fileDeleteByDirList($siteAccesses, $cacheBaseDir, '');
     $fileHandler = eZClusterFileHandler::instance($cacheBaseDir);
     $fileHandler->purge();
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:19,代码来源:occalendarsearchtaxonomy.php


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