public function getDbConnection() { if (!BgPlugin::$con) { BgPlugin::$con = new CDbConnection('sqlite:' . dirname(__FILE__) . '/../runtime/bukget.sqlite'); BgPlugin::$con->createCommand('create table if not exists `updated`' . ' (`name` text primary key not null, `time` integer not null)')->execute(); BgPlugin::$con->createCommand('create table if not exists `category_plugin`' . ' (`category` text, `plugin` text, unique(`category`,`plugin`))')->execute(); BgPlugin::$con->createCommand('create table if not exists `category` (`name` text, unique(`name`))')->execute(); BgPlugin::$con->createCommand('create table if not exists `plugin`' . ' (`name` text primary key, `plugin_name` text, `status` text, `link` text,' . ' `desc` text, `categories` text, unique(`name`))')->execute(); } return BgPlugin::$con; }