diff --git a/php/admin/functions.php b/php/admin/functions.php
index bcec60938..c84ae5dd0 100644
--- a/php/admin/functions.php
+++ b/php/admin/functions.php
@@ -55,12 +55,12 @@ function link_featured_image( $quiz_id ) {
*/
function qsm_add_author_column_in_db() {
global $mlwQuizMasterNext;
-
+
// return if sqlite db
if ( $mlwQuizMasterNext->is_sqlite_db() ) {
return;
}
-
+
if ( 1 !== intval( get_option( 'qsm_update_db_column', '' ) ) ) {
global $wpdb;
@@ -84,7 +84,7 @@ function qsm_add_author_column_in_db() {
);
if ( empty( $table_col_obj ) ) {
- $wpdb->query( 'ALTER TABLE ' . $table . ' ADD ' . $col_name . ' ' . $col_def );
+ $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $table . ' ADD ' . $col_name . ' ' . $col_def );
}
}
}
@@ -251,7 +251,7 @@ function qsm_add_author_column_in_db() {
foreach ( $tables_to_convert as $table ) {
$query = "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;";
- $result = $wpdb->query($query);
+ $result = $mlwQuizMasterNext->wpdb_alter_table_query($query);
if ( ! $result ) {
$success = false;
diff --git a/php/classes/class-qsm-install.php b/php/classes/class-qsm-install.php
index 16556ec34..1d3055c3d 100644
--- a/php/classes/class-qsm-install.php
+++ b/php/classes/class-qsm-install.php
@@ -1628,11 +1628,11 @@ public function update() {
// Update 0.5
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'comment_section'" ) != 'comment_section' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD comment_field_text TEXT NOT NULL AFTER phone_field_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$sql = 'ALTER TABLE ' . $table_name . ' ADD comment_section INT NOT NULL AFTER admin_email';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$sql = 'ALTER TABLE ' . $table_name . ' ADD message_comment TEXT NOT NULL AFTER message_after';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET comment_field_text='Comments', comment_section=1, message_comment='Enter You Text Here'";
$results = $wpdb->query( $update_sql );
}
@@ -1640,7 +1640,7 @@ public function update() {
// Update 0.9.4
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'randomness_order'" ) != 'randomness_order' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD randomness_order INT NOT NULL AFTER system';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . ' SET randomness_order=0';
$results = $wpdb->query( $update_sql );
}
@@ -1648,7 +1648,7 @@ public function update() {
// Update 0.9.5
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_answer_template'" ) != 'question_answer_template' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_answer_template TEXT NOT NULL AFTER comment_field_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$mlw_question_answer_default = '%QUESTION%
Answer Provided: %USER_ANSWER%
Correct Answer: %CORRECT_ANSWER%
Comments Entered: %USER_COMMENTS%
';
$update_sql = 'UPDATE ' . $table_name . " SET question_answer_template='" . $mlw_question_answer_default . "'";
$results = $wpdb->query( $update_sql );
@@ -1657,7 +1657,7 @@ public function update() {
// Update 0.9.6
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'contact_info_location'" ) != 'contact_info_location' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD contact_info_location INT NOT NULL AFTER send_admin_email';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . ' SET contact_info_location=0';
$results = $wpdb->query( $update_sql );
}
@@ -1665,7 +1665,7 @@ public function update() {
// Update 1.0
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'email_from_text'" ) != 'email_from_text' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD email_from_text TEXT NOT NULL AFTER comment_field_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET email_from_text='Wordpress'";
$results = $wpdb->query( $update_sql );
}
@@ -1673,7 +1673,7 @@ public function update() {
// Update 1.3.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'loggedin_user_contact'" ) != 'loggedin_user_contact' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD loggedin_user_contact INT NOT NULL AFTER randomness_order';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . ' SET loggedin_user_contact=0';
$results = $wpdb->query( $update_sql );
}
@@ -1681,7 +1681,7 @@ public function update() {
// Update 1.5.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_from_total'" ) != 'question_from_total' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_from_total INT NOT NULL AFTER comment_section';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . ' SET question_from_total=0';
$results = $wpdb->query( $update_sql );
}
@@ -1689,13 +1689,13 @@ public function update() {
// Update 1.6.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'total_user_tries'" ) != 'total_user_tries' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD total_user_tries INT NOT NULL AFTER question_from_total';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . ' SET total_user_tries=0';
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'total_user_tries_text'" ) != 'total_user_tries_text' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD total_user_tries_text TEXT NOT NULL AFTER total_user_tries';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET total_user_tries_text='Enter Your Text Here'";
$results = $wpdb->query( $update_sql );
}
@@ -1703,13 +1703,13 @@ public function update() {
// Update 1.8.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'message_end_template'" ) != 'message_end_template' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD message_end_template TEXT NOT NULL AFTER message_comment';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET message_end_template=''";
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'certificate_template'" ) != 'certificate_template' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD certificate_template TEXT NOT NULL AFTER total_user_tries_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET certificate_template='Enter your text here!'";
$results = $wpdb->query( $update_sql );
}
@@ -1717,31 +1717,31 @@ public function update() {
// Update 1.9.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'social_media'" ) != 'social_media' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD social_media INT NOT NULL AFTER certificate_template';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET social_media='0'";
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'social_media_text'" ) != 'social_media_text' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD social_media_text TEXT NOT NULL AFTER social_media';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET social_media_text='I just score a %CORRECT_SCORE%% on %QUIZ_NAME%!'";
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'pagination'" ) != 'pagination' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD pagination INT NOT NULL AFTER social_media_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . ' SET pagination=0';
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'pagination_text'" ) != 'pagination_text' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD pagination_text TEXT NOT NULL AFTER pagination';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET pagination_text='Next'";
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'timer_limit'" ) != 'timer_limit' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD timer_limit INT NOT NULL AFTER pagination_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . ' SET timer_limit=0';
$results = $wpdb->query( $update_sql );
}
@@ -1749,7 +1749,7 @@ public function update() {
// Update 2.1.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'quiz_stye'" ) != 'quiz_stye' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD quiz_stye TEXT NOT NULL AFTER timer_limit';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$mlw_style_default = '
div.mlw_qmn_quiz input[type=radio],
div.mlw_qmn_quiz input[type=submit],
@@ -1799,7 +1799,7 @@ public function update() {
// Update 2.2.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_numbering'" ) != 'question_numbering' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_numbering INT NOT NULL AFTER quiz_stye';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET question_numbering='0'";
$results = $wpdb->query( $update_sql );
}
@@ -1807,7 +1807,7 @@ public function update() {
// Update 2.8.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'quiz_settings'" ) != 'quiz_settings' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD quiz_settings TEXT NOT NULL AFTER question_numbering';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET quiz_settings=''";
$results = $wpdb->query( $update_sql );
}
@@ -1815,7 +1815,7 @@ public function update() {
// Update 3.0.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'theme_selected'" ) != 'theme_selected' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD theme_selected TEXT NOT NULL AFTER quiz_settings';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET theme_selected='default'";
$results = $wpdb->query( $update_sql );
}
@@ -1823,7 +1823,7 @@ public function update() {
// Update 3.3.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'last_activity'" ) != 'last_activity' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD last_activity DATETIME NOT NULL AFTER theme_selected';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET last_activity='%s'", gmdate( 'Y-m-d H:i:s' ) );
$results = $wpdb->query( $update_sql );
}
@@ -1831,25 +1831,25 @@ public function update() {
// Update 3.5.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'require_log_in'" ) != 'require_log_in' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD require_log_in INT NOT NULL AFTER last_activity';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET require_log_in='%d'", '0' );
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'require_log_in_text'" ) != 'require_log_in_text' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD require_log_in_text TEXT NOT NULL AFTER require_log_in';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( 'UPDATE ' . $table_name . " SET require_log_in_text='%s'", 'Enter Text Here' );
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'limit_total_entries'" ) != 'limit_total_entries' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD limit_total_entries INT NOT NULL AFTER require_log_in_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET limit_total_entries='%d'", '0' );
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'limit_total_entries_text'" ) != 'limit_total_entries_text' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD limit_total_entries_text TEXT NOT NULL AFTER limit_total_entries';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET limit_total_entries_text='%s'", 'Enter Text Here' );
$results = $wpdb->query( $update_sql );
}
@@ -1857,19 +1857,19 @@ public function update() {
// Update 7.3.8
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'quiz_author_id'" ) != 'quiz_author_id' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD quiz_author_id TEXT NOT NULL AFTER deleted';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
}
// Update 3.7.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'scheduled_timeframe'" ) != 'scheduled_timeframe' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD scheduled_timeframe TEXT NOT NULL AFTER limit_total_entries_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET scheduled_timeframe=''";
$results = $wpdb->query( stripslashes( esc_sql( $update_sql ) ) );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'scheduled_timeframe_text'" ) != 'scheduled_timeframe_text' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD scheduled_timeframe_text TEXT NOT NULL AFTER scheduled_timeframe';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET scheduled_timeframe_text='%s'", 'Enter Text Here' );
$results = $wpdb->query( $update_sql );
}
@@ -1877,13 +1877,13 @@ public function update() {
// Update 4.3.0
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'disable_answer_onselect'" ) != 'disable_answer_onselect' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD disable_answer_onselect INT NOT NULL AFTER scheduled_timeframe_text';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET disable_answer_onselect=%d", '0' );
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'ajax_show_correct'" ) != 'ajax_show_correct' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD ajax_show_correct INT NOT NULL AFTER disable_answer_onselect';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET ajax_show_correct=%d", '0' );
$results = $wpdb->query( $update_sql );
}
@@ -1893,23 +1893,23 @@ public function update() {
// Update 0.5
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'comments'" ) != 'comments' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD comments INT NOT NULL AFTER correct_answer';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$sql = 'ALTER TABLE ' . $table_name . ' ADD hints TEXT NOT NULL AFTER comments';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET comments=%d, hints=''", '1' );
$results = $wpdb->query( $update_sql );
}
// Update 0.8
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_order'" ) != 'question_order' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_order INT NOT NULL AFTER hints';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET question_order=%d", '0' );
$results = $wpdb->query( $update_sql );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_type'" ) != 'question_type' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_type INT NOT NULL AFTER question_order';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET question_type=%d", '0' );
$results = $wpdb->query( $update_sql );
}
@@ -1917,7 +1917,7 @@ public function update() {
// Update 1.1.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_answer_info'" ) != 'question_answer_info' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_answer_info TEXT NOT NULL AFTER correct_answer';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET question_answer_info=''";
$results = $wpdb->query( stripslashes( esc_sql( $update_sql ) ) );
}
@@ -1925,7 +1925,7 @@ public function update() {
// Update 2.5.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'answer_array'" ) != 'answer_array' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD answer_array TEXT NOT NULL AFTER question_name';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET answer_array=''";
$results = $wpdb->query( stripslashes( esc_sql( $update_sql ) ) );
}
@@ -1933,7 +1933,7 @@ public function update() {
// Update 3.1.1
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_settings'" ) != 'question_settings' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_settings TEXT NOT NULL AFTER question_type';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET question_settings=''";
$results = $wpdb->query( stripslashes( esc_sql( $update_sql ) ) );
}
@@ -1941,7 +1941,7 @@ public function update() {
// Update 4.0.0
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'category'" ) != 'category' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD category TEXT NOT NULL AFTER question_settings';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = 'UPDATE ' . $table_name . " SET category=''";
$results = $wpdb->query( stripslashes( esc_sql( $update_sql ) ) );
}
@@ -1949,7 +1949,7 @@ public function update() {
// Update 4.0.0
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'question_type_new'" ) != 'question_type_new' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD question_type_new TEXT NOT NULL AFTER question_type';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET question_type_new=%s", 'question_type' );
$results = $wpdb->query( $update_sql );
}
@@ -1958,21 +1958,21 @@ public function update() {
$user_email_template_data = $wpdb->get_row( 'SHOW COLUMNS FROM ' . $wpdb->prefix . "mlw_quizzes LIKE 'user_email_template'" );
if ( 'text' === $user_email_template_data->Type ) {
$sql = 'ALTER TABLE ' . $wpdb->prefix . 'mlw_quizzes MODIFY user_email_template LONGTEXT';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
}
// Update 7.3.11
$user_message_after_data = $wpdb->get_row( 'SHOW COLUMNS FROM ' . $wpdb->prefix . "mlw_quizzes LIKE 'message_after'" );
if ( 'text' === $user_message_after_data->Type ) {
$sql = 'ALTER TABLE ' . $wpdb->prefix . 'mlw_quizzes MODIFY message_after LONGTEXT';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
}
// Update 2.6.1
- $results = $wpdb->query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' );
- $results = $wpdb->query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_questions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
- $results = $wpdb->query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_quizzes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
- $results = $wpdb->query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_results CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_qm_audit_trail CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_questions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_quizzes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_results CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' );
global $wpdb;
$table_name = $wpdb->prefix . 'mlw_results';
@@ -1981,7 +1981,7 @@ public function update() {
// Update 2.6.4
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $table_name . " LIKE 'user'" ) != 'user' ) {
$sql = 'ALTER TABLE ' . $table_name . ' ADD user INT NOT NULL AFTER phone';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET user=%d", '0' );
$results = $wpdb->query( $update_sql );
}
@@ -1989,23 +1989,23 @@ public function update() {
// Update 4.7.0
if ( $wpdb->get_var( "SHOW COLUMNS FROM $table_name LIKE 'user_ip'" ) != 'user_ip' ) {
$sql = "ALTER TABLE $table_name ADD user_ip TEXT NOT NULL AFTER user";
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$update_sql = $wpdb->prepare( "UPDATE {$table_name} SET user_ip='%s'", 'Unknown' );
$results = $wpdb->query( $update_sql );
}
// Update 7.1.11
$user_message_after_data = $wpdb->get_row( 'SHOW COLUMNS FROM ' . $wpdb->prefix . "mlw_results LIKE 'point_score'" );
if ( 'FLOAT' != $user_message_after_data->Type ) {
- $results = $wpdb->query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_results MODIFY point_score FLOAT NOT NULL;' );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( 'ALTER TABLE ' . $wpdb->prefix . 'mlw_results MODIFY point_score FLOAT NOT NULL;' );
}
if ( $wpdb->get_var( 'SHOW COLUMNS FROM ' . $audit_table . " LIKE 'quiz_id'" ) != 'quiz_id' ) {
$sql = 'ALTER TABLE ' . $audit_table . ' ADD quiz_id TEXT NOT NULL AFTER action';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$sql = 'ALTER TABLE ' . $audit_table . ' ADD quiz_name TEXT NOT NULL AFTER quiz_id';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
$sql = 'ALTER TABLE ' . $audit_table . ' ADD form_data TEXT NOT NULL AFTER quiz_name';
- $results = $wpdb->query( $sql );
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query( $sql );
}
// Update 5.0.0
@@ -2028,7 +2028,7 @@ public function update() {
// Update 8.1.14
if ( ! $wpdb->query("SHOW KEYS FROM {$results_table_name} WHERE Key_name = 'unique_id_unique'" ) ) {
- $results = $wpdb->query("ALTER TABLE {$results_table_name} ADD UNIQUE (unique_id)");
+ $results = $mlwQuizMasterNext->wpdb_alter_table_query("ALTER TABLE {$results_table_name} ADD UNIQUE (unique_id)");
}
// Update 8.0.3