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/admin/class-lp-updater.php +7 -19 4.1.74.4.8 View file →
@@ -25,25 +25,14 @@
25 25 'lp/upgrade/db/map_version',
26 26 array(
27 27 '3' => 4, // DB v3 need up DB v4
28 28 '4' => 5, // DB v4 need up DB v5
29 + '5' => 6, // DB v4 need up DB v6
29 30 )
30 31 );
31 - add_action( 'admin_notices', array( $this, 'check_update_database_message' ), 0 );
32 32 }
33 33
34 34 /**
35 - * Show message needs upgrades database compatible with LP version current.
36 - */
37 - public function check_update_database_message() {
38 - if ( ! $this->check_lp_db_need_upgrade() ) {
39 - return;
40 - }
41 -
42 - learn_press_admin_view( 'updates/html-update-message' );
43 - }
44 -
45 - /**
46 35 * Check LP Database need upgrade.
47 36 *
48 37 * @return bool|int
49 38 * @author tungnx
@@ -54,20 +43,20 @@
54 43 if ( ! current_user_can( 'administrator' ) ) {
55 44 return false;
56 45 }
57 46
58 - $db_current_version = (int) get_option( LP_KEY_DB_VERSION, false );
59 - if ( ! $db_current_version ) {
47 + $db_current_version = (int) get_option( LP_KEY_DB_VERSION, 0 );
48 + /*if ( ! $db_current_version ) {
60 49 return false;
61 - }
50 + }*/
62 51
63 52 $db_require_version = LearnPress::instance()->db_version;
64 - if ( $db_require_version <= $db_current_version ) {
53 + if ( version_compare( $db_require_version, $db_current_version, '<=' ) ) {
65 54 return false;
66 55 }
67 56
68 57 if ( array_key_exists( $db_current_version, $this->db_map_version ) ) {
69 - return $this->db_map_version[ $db_current_version ];
58 + return $this->db_map_version[ $db_current_version . '' ];
70 59 }
71 60
72 61 /**
73 62 * For case not have key "learnpress_db_version" on DB, still have columns of learnpress.
@@ -123,10 +112,9 @@
123 112 *
124 113 * @return bool|LP_Updater
125 114 */
126 115 public static function instance() {
127 - static $instance = null;
128 -
116 + static $instance;
129 117 if ( is_null( $instance ) ) {
130 118 $instance = new self();
131 119 }
132 120