public function init($config)
{
if (!function_exists('sqlite_open')) {
throw new TConfigurationException('sqlitecache_extension_required');
}
if ($this->_file === null) {
$this->_file = $this->getApplication()->getRuntimePath() . '/sqlite.cache';
}
$error = '';
if (($this->_db = new \SQLiteDatabase($this->_file, 0666, $error)) === false) {
throw new TConfigurationException('sqlitecache_connection_failed', $error);
}
if (@$this->_db->query('DELETE FROM ' . self::CACHE_TABLE . ' WHERE expire<>0 AND expire<' . time()) === false) {
if ($this->_db->query('CREATE TABLE ' . self::CACHE_TABLE . ' (key CHAR(128) PRIMARY KEY, value BLOB, expire INT)') === false) {
throw new TConfigurationException('sqlitecache_table_creation_failed', sqlite_error_string(sqlite_last_error()));
}
}
$this->_initialized = true;
parent::init($config);
}