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


PHP Zend_Cache_Backend::getTmpDir方法代码示例

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


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

示例1: getTmpDir

 /**
  * Returns a valid tmp folder depending on the OS used.
  *
  * @return string
  */
 public function getTmpDir()
 {
     // We use a Zend method here, for it already checks the OS.
     require_once 'Zend/Cache/Backend.php';
     $temp = new Zend_Cache_Backend();
     return $temp->getTmpDir();
 }
开发者ID:FTeichmann,项目名称:Erfurt,代码行数:12,代码来源:App.php

示例2: _getHeaderHtml

 protected function _getHeaderHtml($element)
 {
     $headerHtml = parent::_getHeaderHtml($element);
     if ($this->getGroup() && @current($this->getGroup()->data_model) !== false) {
         // Set up cache, using the Magento cache doesn't make sense as it won't cache if cache is disabled
         try {
             $cacheBackend = new Zend_Cache_Backend();
             $cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 43200), array('cache_dir' => $cacheBackend->getTmpDir()));
         } catch (Exception $e) {
             return $headerHtml;
         }
         // Get data model
         $dataModelName = @current($this->getGroup()->data_model);
         $cacheKey = 'info_' . @current(explode("/", $dataModelName));
         if (@current($this->getGroup()->module_name) !== false) {
             $moduleVersion = (string) @Mage::getConfig()->getNode()->modules->{current($this->getGroup()->module_name)}->version;
             if (!empty($moduleVersion)) {
                 $cacheKey .= '_' . str_replace('.', '_', $moduleVersion);
             }
         }
         // Is the response cached?
         $cachedHtml = $cache->load($cacheKey);
         #$cachedHtml = false; // Test: disable cache
         if ($cachedHtml !== false && $cachedHtml !== '') {
             $storeHtml = $cachedHtml;
         } else {
             try {
                 $dataModel = Mage::getSingleton($dataModelName);
                 $dataModel->afterLoad();
                 // Fetch info whether updates for the module are available
                 $url = 'ht' . 'tp://w' . 'ww.' . 'xte' . 'nto.' . 'co' . 'm/li' . 'cense/info/';
                 $version = Mage::getVersion();
                 $extensionVersion = $dataModel->getValue();
                 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                     $storeHtml = file_get_contents($url . '?version=' . $version . '&d=' . $extensionVersion);
                 } else {
                     $client = new Zend_Http_Client($url, array('timeout' => 10));
                     $client->setParameterGet('version', $version);
                     $client->setParameterGet('d', $extensionVersion);
                     $response = $client->request('GET');
                     // Post version
                     /*$client = new Zend_Http_Client($url, array('timeout' => 10));
                       $client->setParameterPost('version', $version);
                       $client->setParameterPost('d', $extensionVersion);
                       $response = $client->request('POST');*/
                     $storeHtml = $response->getBody();
                 }
                 $cache->save($storeHtml, $cacheKey);
             } catch (Exception $e) {
                 return '------------------------------------------------<div style="display:none">Exception: ' . $e->getMessage() . '</div>' . $headerHtml;
             }
         }
         if (preg_match('/There has been an error processing your request/', $storeHtml)) {
             return $headerHtml;
         }
         $headerHtml = str_replace('</div><table cellspacing="0" class="form-list">', $storeHtml . '</div><table cellspacing="0" class="form-list">', $headerHtml);
         // below 1.6
         $headerHtml = str_replace('</span><table cellspacing="0" class="form-list">', $storeHtml . '</span><table cellspacing="0" class="form-list">', $headerHtml);
         // after 1.7
     }
     return $headerHtml;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:62,代码来源:Module.php

示例3: getTmpDir

 /**
  * Determine system TMP directory and detect if we have read access
  *
  * inspired from \Zend_File_Transfer_Adapter_Abstract
  *
  * @return string
  * @throws \Zend_Cache_Exception if unable to determine directory
  */
 public function getTmpDir()
 {
     return $this->_backend->getTmpDir();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:AbstractDecorator.php


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