| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +use LearnPress\Databases\DataBase; | |
| 4 | + | |
| 3 | 5 | /** |
| 4 | 6 | * Class LP_Updater |
| 5 | 7 | * |
| 6 | 8 | * Update helper class providing update functions |
| @@ -25,8 +27,9 @@ | ||
| 25 | 27 | 'lp/upgrade/db/map_version', |
| 26 | 28 | array( |
| 27 | 29 | '3' => 4, // DB v3 need up DB v4 |
| 28 | 30 | '4' => 5, // DB v4 need up DB v5 |
| 31 | + '5' => 6, // DB v4 need up DB v6 | |
| 29 | 32 | ) |
| 30 | 33 | ); |
| 31 | 34 | } |
| 32 | 35 | |
| @@ -33,11 +36,12 @@ | ||
| 33 | 36 | /** |
| 34 | 37 | * Check LP Database need upgrade. |
| 35 | 38 | * |
| 36 | 39 | * @return bool|int |
| 37 | - * @author tungnx | |
| 40 | + * @throws Exception | |
| 38 | 41 | * @version 1.0.1 |
| 39 | 42 | * @since 4.0.0 |
| 43 | + * @author tungnx | |
| 40 | 44 | */ |
| 41 | 45 | public function check_lp_db_need_upgrade() { |
| 42 | 46 | if ( ! current_user_can( 'administrator' ) ) { |
| 43 | 47 | return false; |
| @@ -60,9 +64,9 @@ | ||
| 60 | 64 | /** |
| 61 | 65 | * For case not have key "learnpress_db_version" on DB, still have columns of learnpress. |
| 62 | 66 | * After a long time, need remove fix fast |
| 63 | 67 | */ |
| 64 | - $lp_db = LP_Database::getInstance(); | |
| 68 | + $lp_db = DataBase::getInstance(); | |
| 65 | 69 | $check_tb_lp_order_items_exists = $lp_db->check_table_exists( $lp_db->tb_lp_order_items ); |
| 66 | 70 | $check_tb_lp_user_item_results_exists = $lp_db->check_table_exists( $lp_db->tb_lp_user_item_results ); |
| 67 | 71 | $check_col_item_id_on_lp_order_items = $lp_db->check_col_table( $lp_db->tb_lp_order_items, 'item_id' ); |
| 68 | 72 | |
| @@ -111,10 +115,9 @@ | ||
| 111 | 115 | * |
| 112 | 116 | * @return bool|LP_Updater |
| 113 | 117 | */ |
| 114 | 118 | public static function instance() { |
| 115 | - static $instance = null; | |
| 116 | - | |
| 119 | + static $instance; | |
| 117 | 120 | if ( is_null( $instance ) ) { |
| 118 | 121 | $instance = new self(); |
| 119 | 122 | } |
| 120 | 123 | |