public function populate($current_cache = array())
 {
     $enabled = true;
     if (isset($current_cache['frontend']['core']['caching'])) {
         $enabled = $current_cache['frontend']['core']['caching'];
     }
     $this->getElement('enable')->setValue($enabled);
     $backend = Engine_Cache::getDefaultBackend();
     if (isset($current_cache['backend'])) {
         $backend = array_keys($current_cache['backend']);
         $backend = $backend[0];
     }
     $this->getElement('type')->setValue($backend);
     $file_path = $current_cache['default_file_path'];
     if (isset($current_cache['backend']['File']['cache_dir'])) {
         $file_path = $current_cache['backend']['File']['cache_dir'];
     }
     $this->getElement('file_path')->setValue($file_path);
     $file_locking = 1;
     if (isset($current_cache['backend']['File']['file_locking'])) {
         $file_locking = $current_cache['backend']['File']['file_locking'];
     }
     $this->getElement('file_locking')->setValue($file_locking);
     if (isset($current_cache['frontend']['core']['lifetime'])) {
         $lifetime = $current_cache['frontend']['core']['lifetime'];
     } else {
         $lifetime = 300;
         // 5 minutes
     }
     if (isset($current_cache['frontend']['core']['options']['lifetime'])) {
         $lifetime = $current_cache['frontend']['core']['options']['lifetime'];
     }
     $this->getElement('lifetime')->setValue($lifetime);
     $memcache_host = '127.0.0.1';
     $memcache_port = '11211';
     if (isset($current_cache['backend']['Memcache']['servers'][0]['host'])) {
         $memcache_host = $current_cache['backend']['Memcached']['servers'][0]['host'];
     }
     if (isset($current_cache["backend"]["Memcached"]["servers"][0]["port"])) {
         $memcache_port = $current_cache["backend"]["Memcached"]["servers"][0]["port"];
     }
     $this->getElement('memcache_host')->setValue($memcache_host);
     $this->getElement('memcache_port')->setValue($memcache_port);
     // Set Existing Value for Translation Performance checkbox
     $db = Engine_Db_Table::getDefaultAdapter();
     $initialTranslateAdapter = $db->select()->from('engine4_core_settings', 'value')->where('`name` = ?', 'core.translate.adapter')->query()->fetchColumn();
     if ($initialTranslateAdapter == 'array') {
         $translate_array = 1;
     } else {
         $translate_array = 0;
     }
     $this->getElement('translate_array')->setValue($translate_array);
     // Set Value for HTML Compression
     $gzip = FALSE;
     if (isset($current_cache['frontend']['core']['gzip'])) {
         $gzip = $current_cache['frontend']['core']['gzip'];
     }
     $this->getElement('gzip_html')->setValue($gzip);
 }
Example #2
0
 public function populate($current_cache = array())
 {
     $enabled = true;
     if (isset($current_cache['frontend']['core']['caching'])) {
         $enabled = $current_cache['frontend']['core']['caching'];
     }
     $this->getElement('enable')->setValue($enabled);
     $backend = Engine_Cache::getDefaultBackend();
     if (isset($current_cache['backend'])) {
         $backend = array_keys($current_cache['backend']);
         $backend = $backend[0];
     }
     $this->getElement('type')->setValue($backend);
     $file_path = $current_cache['default_file_path'];
     if (isset($current_cache['backend']['File']['cache_dir'])) {
         $file_path = $current_cache['backend']['File']['cache_dir'];
     }
     $this->getElement('file_path')->setValue($file_path);
     $file_locking = 1;
     if (isset($current_cache['backend']['File']['file_locking'])) {
         $file_locking = $current_cache['backend']['File']['file_locking'];
     }
     $this->getElement('file_locking')->setValue($file_locking);
     $lifetime = 300;
     // 5 minutes
     if (isset($current_cache['frontend']['core']['options']['lifetime'])) {
         $lifetime = $current_cache['frontend']['core']['options']['lifetime'];
     }
     $this->getElement('lifetime')->setValue($lifetime);
     $memcache_host = '127.0.0.1';
     $memcache_port = '11211';
     if (isset($current_cache['backend']['Memcache']['servers'][0]['host'])) {
         $memcache_host = $current_cache['backend']['Memcache']['servers'][0]['host'];
     }
     if (isset($current_cache['backend']['Memcache']['servers'][0]['port'])) {
         $memcache_port = $current_cache['backend']['Memcache']['servers'][0]['port'];
     }
     $this->getElement('memcache_host')->setValue($memcache_host);
     $this->getElement('memcache_port')->setValue($memcache_port);
 }