memoryCache->proxy($this, 'getAll'); return isset($options[$name]) && $options[$name] !== '' ? $options[$name] : $default_value; } /** * Optimize the Sqlite database * * @access public * @return boolean */ public function optimizeDatabase() { return $this->db->getConnection()->exec('VACUUM'); } /** * Compress the Sqlite database * * @access public * @return string */ public function downloadDatabase() { return gzencode(file_get_contents(DB_FILENAME)); } /** * Replace database file with uploaded one * * @access public * @return boolean */ public function uploadDatabase($file) { $this->db->closeConnection(); $result = file_put_contents(DB_FILENAME, gzdecode(file_get_contents($file))); return $result == false? false: true; } /** * Get the Sqlite database size in bytes * * @access public * @return integer */ public function getDatabaseSize() { return DB_DRIVER === 'sqlite' ? filesize(DB_FILENAME) : 0; } /** * Regenerate a token * * @access public * @param string $option Parameter name * @return boolean */ public function regenerateToken($option) { return $this->save(array($option => Token::getToken())); } /** * Prepare data before save * * @access public * @param array $values * @return array */ public function prepare(array $values) { if (! empty($values['application_url']) && substr($values['application_url'], -1) !== '/') { $values['application_url'] = $values['application_url'].'/'; } return $values; } }