Esempio n. 1
0
 /**
  * Support method for _getSearchSpecs() -- load the specs from cache or disk.
  *
  * @return void
  * @access private
  */
 private function _loadSearchSpecs()
 {
     // Generate cache key:
     $key = md5(basename($this->searchSpecsFile) . '-' . filemtime($this->searchSpecsFile));
     // Load cache manager:
     $cache = new VuFindCache($this->_specCache, 'searchspecs');
     // Generate data if not found in cache:
     if (!($results = $cache->load($key))) {
         $results = Horde_Yaml::load(file_get_contents($this->searchSpecsFile));
         $cache->save($results, $key);
     }
     $this->_searchSpecs = $results;
 }
Esempio n. 2
0
 /**
  * Support method for _getSearchSpecs() -- load the specs from cache or disk.
  *
  * @return void
  * @access private
  */
 private function _loadSearchSpecs()
 {
     global $configArray;
     // Turn relative path into absolute path:
     $fullPath = $configArray['Site']['local'] . '/' . $this->searchSpecsFile;
     // Check for a local override file:
     $local = str_replace('.yaml', '.local.yaml', $fullPath);
     $local = file_exists($local) ? $local : false;
     // Generate cache key:
     $key = basename($fullPath) . '-' . filemtime($fullPath);
     if ($local) {
         $key .= '-' . basename($local) . '-' . filemtime($local);
     }
     $key = md5($key);
     // Load cache manager:
     $cache = new VuFindCache($this->_specCache, 'searchspecs');
     // Generate data if not found in cache:
     if (!($results = $cache->load($key))) {
         $results = Horde_Yaml::load(file_get_contents($fullPath));
         if ($local) {
             $localResults = Horde_Yaml::load(file_get_contents($local));
             foreach ($localResults as $key => $value) {
                 $results[$key] = $value;
             }
         }
         $cache->save($results, $key);
     }
     $this->_searchSpecs = $results;
 }