Index: Sqlite.php =================================================================== --- Sqlite.php (revision 9003) +++ Sqlite.php (working copy) @@ -83,6 +83,12 @@ Zend_Cache::throwException("Cannot use SQLite storage because the 'sqlite' extension is not loaded in the current PHP environment"); } $this->_getConnection(); + if (!$this->_checkStructureVersion()) { + $this->_buildStructure(); + if (!$this->_checkStructureVersion()) { + Zend_Cache::throwException("Impossible to build cache structure in " . $this->_options['cache_db_complete_path']); + } + } } /** @@ -148,12 +154,6 @@ */ public function save($data, $id, $tags = array(), $specificLifetime = false) { - if (!$this->_checkStructureVersion()) { - $this->_buildStructure(); - if (!$this->_checkStructureVersion()) { - Zend_Cache::throwException("Impossible to build cache structure in " . $this->_options['cache_db_complete_path']); - } - } $lifetime = $this->getLifetime($specificLifetime); $data = @sqlite_escape_string($data); $mktime = time(); @@ -228,11 +228,11 @@ } /** - * Return the connection resource - * + * Return the connection resource + * * If we are not connected, the connection is made * - * @throws Zend_Cache_Exception + * @throws Zend_Cache_Exception * @return resource Connection resource */ private function _getConnection() @@ -245,15 +245,15 @@ Zend_Cache::throwException("Impossible to open " . $this->_options['cache_db_complete_path'] . " cache DB file"); } return $this->_db; - } + } } - + /** * Execute an SQL query silently - * + * * @param string $query SQL query * @return mixed|false query results - */ + */ private function _query($query) { $db = $this->_getConnection(); @@ -263,7 +263,7 @@ return false; } else { return $res; - } + } } return false; }