diff --git a/admin/class-bigbluebutton-admin.php b/admin/class-bigbluebutton-admin.php
index 90dd709..648ca78 100644
--- a/admin/class-bigbluebutton-admin.php
+++ b/admin/class-bigbluebutton-admin.php
@@ -210,9 +210,10 @@ public function bbb_room_custom_columns( $column, $post_id ) {
* @since 3.0.0
*/
public function display_room_server_settings() {
- $change_success = $this->room_server_settings_change();
- $bbb_settings = $this->fetch_room_server_settings();
- $meta_nonce = wp_create_nonce( 'bbb_edit_server_settings_meta_nonce' );
+ $change_success = $this->room_server_settings_change();
+ $bbb_settings = $this->fetch_room_server_settings();
+ $meta_nonce = wp_create_nonce( 'bbb_edit_server_settings_meta_nonce' );
+ $old_rooms_exist = $this->check_old_room_tables();
require_once 'partials/bigbluebutton-settings-display.php';
}
@@ -253,6 +254,18 @@ public function bigbluebutton_show_upgrade_notification( $current_plugin_metadat
}
}
+ /**
+ * Check if old rooms table exists.
+ *
+ * @since 3.0.0
+ */
+ private function check_old_room_tables() {
+ global $wpdb;
+ $old_rooms_table = $wpdb->prefix . 'bigbluebutton';
+ $old_rooms_query = $wpdb->prepare( 'SHOW TABLES LIKE %s;', $wpdb->esc_like( $old_rooms_table ) );
+ return $wpdb->get_var( $old_rooms_query ) === $old_rooms_table;
+ }
+
/**
* Get information about the newest plugin version.
*
diff --git a/admin/css/bigbluebutton-admin.css b/admin/css/bigbluebutton-admin.css
index 69a1357..47e45ae 100644
--- a/admin/css/bigbluebutton-admin.css
+++ b/admin/css/bigbluebutton-admin.css
@@ -55,3 +55,9 @@
margin-top: 2em;
margin-bottom: 2em;
}
+
+.bbb-warning {
+ font-weight: 700;
+ color: red;
+ font-size: 1.2em;
+}
\ No newline at end of file
diff --git a/admin/partials/bigbluebutton-settings-display.php b/admin/partials/bigbluebutton-settings-display.php
index d5f5d1b..3dd6e7b 100644
--- a/admin/partials/bigbluebutton-settings-display.php
+++ b/admin/partials/bigbluebutton-settings-display.php
@@ -1,4 +1,11 @@
+
+
+
diff --git a/includes/class-bigbluebutton-migration.php b/includes/class-bigbluebutton-migration.php
index 41b4e8d..1897f09 100644
--- a/includes/class-bigbluebutton-migration.php
+++ b/includes/class-bigbluebutton-migration.php
@@ -85,10 +85,10 @@ public function migrate() {
*
* @since 3.0.0
*/
- private function import_rooms() {
+ public function import_rooms() {
global $wpdb;
- $old_rooms_table = 'wp_bigbluebutton';
- $old_room_logs_table = 'wp_bigbluebutton_logs';
+ $old_rooms_table = $wpdb->prefix . 'bigbluebutton';
+ $old_room_logs_table = $wpdb->prefix . 'bigbluebutton_logs';
// Import old rooms to new rooms.
$old_rooms_query = $wpdb->prepare( 'SHOW TABLES LIKE %s;', $wpdb->esc_like( $old_rooms_table ) );
@@ -151,6 +151,14 @@ private function import_rooms() {
$wpdb->query( 'DROP TABLE IF EXISTS ' . $old_room_logs_table );
}
}
+
+ // Redirect to rooms page after forced migration.
+ if (isset($_POST['action']) && "bbb_force_migration" == $_POST['action']) {
+ $args = array(
+ 'post_type' => 'bbb-room'
+ );
+ wp_redirect( add_query_arg( $args, admin_url( 'edit.php') ) );
+ }
return true;
}
diff --git a/includes/class-bigbluebutton.php b/includes/class-bigbluebutton.php
index 9426093..64f006c 100644
--- a/includes/class-bigbluebutton.php
+++ b/includes/class-bigbluebutton.php
@@ -236,10 +236,10 @@ private function set_locale() {
* @access private
*/
private function define_admin_hooks() {
-
$plugin_admin = new Bigbluebutton_Admin( $this->get_plugin_name(), $this->get_version() );
$plugin_admin_api = new Bigbluebutton_Admin_Api();
$plugin_admin_register_custom_types = new Bigbluebutton_Register_Custom_Types();
+ $migrator = new Bigbluebutton_Migration( "1.4.6", $this->get_version() );
// Suggest not disabling heartbeat.
$this->loader->add_action( 'admin_notices', $plugin_admin, 'check_for_heartbeat_script' );
@@ -274,6 +274,9 @@ private function define_admin_hooks() {
$this->loader->add_action( 'manage_posts_custom_column', $plugin_admin, 'bbb_room_custom_columns', 10, 2 );
$this->loader->add_filter( 'manage_bbb-room_posts_columns', $plugin_admin, 'add_custom_room_column_to_list' );
+ // Force old rooms migration.
+ $this->loader->add_action( 'admin_post_bbb_force_migration', $migrator, 'import_rooms' );
+
}
/**
diff --git a/languages/bigbluebutton-en_CA.mo b/languages/bigbluebutton-en_CA.mo
index 0c29fbd..3d4bf9f 100644
Binary files a/languages/bigbluebutton-en_CA.mo and b/languages/bigbluebutton-en_CA.mo differ
diff --git a/languages/bigbluebutton-en_CA.po b/languages/bigbluebutton-en_CA.po
index 0cac83e..bbf54b1 100644
--- a/languages/bigbluebutton-en_CA.po
+++ b/languages/bigbluebutton-en_CA.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2019-09-13 10:54-0400\n"
-"PO-Revision-Date: 2019-12-13 18:14-0500\n"
+"PO-Revision-Date: 2020-01-10 16:42-0500\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -56,6 +56,12 @@ msgstr ""
"Error: The server cannot be reached. Are you sure the server is running and your settings "
"are correct?"
+msgid "Force Migration"
+msgstr "Force Migration"
+
+msgid "Please backup your database before migrating old rooms."
+msgstr "Please backup your database before migrating old rooms."
+
# Admin Room settings
msgid "Add New"
msgstr "Add New"
diff --git a/languages/bigbluebutton-en_US.mo b/languages/bigbluebutton-en_US.mo
index 5c7d32c..fc1cc69 100644
Binary files a/languages/bigbluebutton-en_US.mo and b/languages/bigbluebutton-en_US.mo differ
diff --git a/languages/bigbluebutton-en_US.po b/languages/bigbluebutton-en_US.po
index fe7af01..796cc04 100644
--- a/languages/bigbluebutton-en_US.po
+++ b/languages/bigbluebutton-en_US.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2019-09-13 10:54-0400\n"
-"PO-Revision-Date: 2019-12-13 18:15-0500\n"
+"PO-Revision-Date: 2020-01-10 16:42-0500\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -56,6 +56,12 @@ msgstr ""
"Error: The server cannot be reached. Are you sure the server is running and your settings "
"are correct?"
+msgid "Force Migration"
+msgstr "Force Migration"
+
+msgid "Please backup your database before migrating old rooms."
+msgstr "Please backup your database before migrating old rooms."
+
# Admin Room settings
msgid "Add New"
msgstr "Add New"
diff --git a/languages/bigbluebutton.pot b/languages/bigbluebutton.pot
index e757c01..f999057 100644
--- a/languages/bigbluebutton.pot
+++ b/languages/bigbluebutton.pot
@@ -50,6 +50,12 @@ msgstr ""
msgid "Save server settings bad server settings error message."
msgstr ""
+msgid "Force Migration"
+msgstr ""
+
+msgid "Please backup your database before migrating old rooms."
+msgstr ""
+
# Admin Room settings
msgid "Add New"
msgstr ""