diff --git a/htdocs/application/config/database.php b/htdocs/application/config/database.php index 349d79e..5c716d1 100644 --- a/htdocs/application/config/database.php +++ b/htdocs/application/config/database.php @@ -1,4 +1,5 @@ -db->last_query() and profiling of DB queries. +| When you run a query, with this setting set to TRUE (default), +| CodeIgniter will store the SQL statement for debugging purposes. +| However, this may cause high memory usage, especially if you run +| a lot of SQL queries ... disable this to avoid that problem. | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the 'default' group). | -| The $active_record variables lets you determine whether or not to load -| the active record class +| The $query_builder variables lets you determine whether or not to load +| the query builder class. */ $active_group = 'default'; $query_builder = TRUE; +$CI = & get_instance(); -$CI =& get_instance(); - -$db['default']['hostname'] = $CI->config->item('db_hostname'); -$db['default']['username'] = $CI->config->item('db_username'); -$db['default']['password'] = $CI->config->item('db_password'); -$db['default']['database'] = $CI->config->item('db_database'); -$db['default']['dbdriver'] = 'mysqli'; +if ($CI->config->item('db_driver') == 'sqlite') +{ + $db['default']['database'] = $CI->config->item('db_database') . '.db'; + $db['default']['dbdriver'] = 'sqlite3'; +} +else +{ + $db['default']['hostname'] = $CI->config->item('db_hostname'); + $db['default']['username'] = $CI->config->item('db_username'); + $db['default']['password'] = $CI->config->item('db_password'); + $db['default']['database'] = $CI->config->item('db_database'); + $db['default']['dbdriver'] = 'mysqli'; +} $db['default']['dbprefix'] = $CI->config->item('db_prefix'); $db['default']['pconnect'] = FALSE; $db['default']['db_debug'] = TRUE; @@ -66,6 +98,5 @@ $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; - /* End of file database.php */ /* Location: ./application/config/database.php */ diff --git a/htdocs/application/config/stikked.php.dist b/htdocs/application/config/stikked.php.dist index e1f5237..86961ea 100644 --- a/htdocs/application/config/stikked.php.dist +++ b/htdocs/application/config/stikked.php.dist @@ -19,6 +19,7 @@ $config['db_hostname'] = '127.0.0.1'; $config['db_database'] = 'stikked'; $config['db_username'] = 'stikked'; $config['db_password'] = 'stikked'; +//$config['db_driver'] = 'sqlite'; /** * Table prefix diff --git a/htdocs/application/controllers/Main.php b/htdocs/application/controllers/Main.php index 3d773dd..932495d 100644 --- a/htdocs/application/controllers/Main.php +++ b/htdocs/application/controllers/Main.php @@ -266,7 +266,7 @@ class Main extends CI_Controller //ipv6 migration $fields = $this->db->field_data('trending'); - if ($fields[1]->max_length < 45) + if (config_item('db_driver') != 'sqlite' && $fields[1]->max_length < 45) { $db_prefix = config_item('db_prefix'); @@ -275,14 +275,14 @@ class Main extends CI_Controller $this->db->query("ALTER TABLE " . $db_prefix . "trending ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'"); $this->db->query("ALTER TABLE " . $db_prefix . "pastes ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'"); $this->db->query("ALTER TABLE " . $db_prefix . "blocked_ips ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'"); - $this->db->query("ALTER TABLE " . $db_prefix . "ci_sessions ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'"); + $this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN ip_address TYPE VARCHAR(45), ALTER COLUMN ip_address SET NOT NULL, ALTER COLUMN ip_address SET DEFAULT '0'"); } else { $this->db->query("ALTER TABLE " . $db_prefix . "trending CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'"); $this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'"); $this->db->query("ALTER TABLE " . $db_prefix . "blocked_ips CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'"); - $this->db->query("ALTER TABLE " . $db_prefix . "ci_sessions CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'"); + $this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'"); } } @@ -294,7 +294,7 @@ class Main extends CI_Controller if ($field->name == 'title') { - if ($field->max_length < 50) + if (config_item('db_driver') != 'sqlite' && $field->max_length < 50) { $db_prefix = config_item('db_prefix');