function ip2country_update_1 in IP-based Determination of a Visitor's Country 7
Same name and namespace in other branches
- 6 ip2country.install \ip2country_update_1()
Renames tables and variables, cleans up database.
File
- ./
ip2country.install, line 135 - Install, update, and uninstall functions for the ip2country module.
Code
function ip2country_update_1() {
$ret = array();
// Remove all database tables created by this module.
$ret[] = update_sql("ALTER TABLE {uc_ip2country} RENAME TO {ip2country}");
// Rename variables while preserving setting values.
variable_set('ip2country_debug', variable_get('uc_ip2country_debug', FALSE));
variable_set('ip2country_test_type', variable_get('uc_ip2country_test_type', 0));
variable_set('ip2country_test_ip_address', variable_get('uc_ip2country_test_ip_address', ''));
variable_set('ip2country_test_country', variable_get('uc_ip2country_test_country', ''));
variable_set('ip2country_rir', variable_get('uc_ip2country_rir', 'arin'));
variable_set('ip2country_last_update', variable_get('uc_ip2country_last_update', 0));
variable_set('ip2country_update_interval', variable_get('uc_ip2country_update_interval', 604800));
variable_set('ip2country_update_database', variable_get('uc_ip2country_update_database', ''));
variable_set('ip2country_watchdog', variable_get('uc_ip2country_watchdog', 1));
// Remove all old variables from the database.
variable_del('uc_ip2country_debug');
variable_del('uc_ip2country_test_type');
variable_del('uc_ip2country_test_ip_address');
variable_del('uc_ip2country_test_country');
variable_del('uc_ip2country_rir');
variable_del('uc_ip2country_last_update');
variable_del('uc_ip2country_update_interval');
variable_del('uc_ip2country_update_database');
variable_del('uc_ip2country_watchdog');
return $ret;
}