PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/updates/learnpress-upgrade-4.php +6 -54 4.2.0 → 4.4.8 View file →
@@ -1253,62 +1253,20 @@
1253 1253 protected function convert_question_type_fill_in_blank( array $data = array() ): LP_Step {
1254 1254 $response = new LP_Step( __FUNCTION__, '' );
1255 1255 $lp_db = LP_Database::getInstance();
1256 1256 $wpdb = $lp_db->wpdb;
1257 - $page = 0;
1258 - $offset = 0;
1259 - $limit = 100;
1260 - $total_row = 0;
1261 1257
1262 1258 try {
1263 - if ( empty( $data ) ) {
1264 - // Check total rows.
1265 - $query = $lp_db->wpdb->prepare(
1266 - "
1267 - SELECT COUNT(meta_id) FROM $lp_db->tb_postmeta
1268 - WHERE meta_key = %s
1269 - AND meta_value = %s
1270 - ",
1271 - 'lp_type',
1272 - 'fill_in_blank'
1273 - );
1274 -
1275 - $total_row = $response->data->total_rows = (int) $lp_db->wpdb->get_var( $query );
1276 - } else {
1277 - $page = $data['p'];
1278 - $offset = $limit * $page;
1279 - $total_row = $data['total_rows'];
1280 - }
1281 -
1282 - $query_get_question_ids = $wpdb->prepare(
1283 - "
1284 - SELECT meta_id
1285 - FROM {$lp_db->tb_postmeta}
1286 - WHERE meta_key = %s
1287 - AND meta_value = %s
1288 - LIMIT %d, %d
1289 - ",
1290 - '_lp_type',
1291 - 'fill_in_blank',
1292 - $offset,
1293 - $limit
1294 - );
1295 -
1296 - $question_ids = $lp_db->wpdb->get_col( $query_get_question_ids );
1297 -
1298 - if ( empty( $question_ids ) ) {
1299 - return $this->finish_step( $response, __FUNCTION__ . ' finished' );
1300 - }
1301 -
1302 - $question_ids_str = implode( ',', $question_ids );
1303 -
1304 1259 $query = $wpdb->prepare(
1305 1260 "
1306 1261 UPDATE {$lp_db->tb_postmeta}
1307 1262 SET meta_value = %s
1308 - WHERE meta_id IN ($question_ids_str)
1263 + WHERE meta_key = %s
1264 + AND meta_value = %s
1309 1265 ",
1310 - 'fill_in_blanks'
1266 + 'fill_in_blanks',
1267 + '_lp_type',
1268 + 'fill_in_blank'
1311 1269 );
1312 1270 $lp_db->wpdb->query( $query );
1313 1271
1314 1272 if ( $lp_db->wpdb->last_error ) {
@@ -1314,15 +1272,9 @@
1314 1272 if ( $lp_db->wpdb->last_error ) {
1315 1273 throw new Exception( $lp_db->wpdb->last_error );
1316 1274 }
1317 1275
1318 - $percent = LP_Helper::progress_percent( $offset, $limit, $total_row );
1319 -
1320 - $response->status = 'success';
1321 - $response->message = 'Convert question FIB success';
1322 - $response->percent = $percent;
1323 - $response->data->p = ++ $page;
1324 - $response->data->total_rows = $total_row;
1276 + return $this->finish_step( $response, __FUNCTION__ . ' finished' );
1325 1277 } catch ( Exception $e ) {
1326 1278 $response->message = $this->error_step( $response->name, $e->getMessage() );
1327 1279 }
1328 1280