/** * Create and/or upgrade the plugin's database tables. * * @return bool */ public static function upgrade_database() { global $wpdb, $blclog; $conf = blc_get_configuration(); $current = $conf->options['current_db_version']; if ($current != 0 && $current < 4) { //The 4th DB version makes a lot of backwards-incompatible changes to the main //BLC tables, so instead of upgrading we just throw them away and recreate. if (!blcDatabaseUpgrader::drop_tables()) { return false; } $current = 0; } //Create/update the plugin's tables if (!blcDatabaseUpgrader::make_schema_current()) { return false; } if ($current != 0) { if ($current < 5) { blcDatabaseUpgrader::upgrade_095(); } } $conf->options['current_db_version'] = BLC_DATABASE_VERSION; $conf->save_options(); $blclog->info('Database successfully upgraded.'); return true; }