PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 111
Lasso Lite – Affiliate Link Manager & Product Displays v111
157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 116 All 56 releases
simple-urls / classes / class-update-db.php

class-update-db.php in Lasso Lite – Affiliate Link Manager & Product Displays 111, at classes/class-update-db.php

60 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Declare class Update_DB
4 *
5 * @package Update_DB
6 */
7
8 namespace LassoLite\Classes;
9
10 use LassoLite\Models\Amazon_Products;
11 use LassoLite\Models\Url_Details;
12 use LassoLite\Models\Revert;
13
14 /**
15 * Update_DB
16 */
17 class Update_DB {
18 /**
19 * Update_DB constructor.
20 */
21 public function __construct() {
22
23 if ( ! get_option( Enum::SWITCH_TO_NEW_UI ) ) {
24 return;
25 }
26 $version = $this->get_version();
27 if ( $version < 108 ) {
28 $this->create_tables();
29 }
30
31 $this->update_version();
32 }
33
34 /**
35 * Get version from database
36 */
37 public function get_version() {
38 $version = Helper::get_option( 'lasso_version', 100 );
39 $version = floatval( $version );
40
41 return $version;
42 }
43
44 /**
45 * Set version and save it to the option table
46 */
47 public function update_version() {
48 Helper::update_option( 'lasso_version', LASSO_LITE_VERSION );
49 }
50
51 /**
52 * Create all Lasso Lite tables
53 */
54 public static function create_tables() {
55 ( new Amazon_Products() )->create_table();
56 ( new Url_Details() )->create_table();
57 ( new Revert() )->create_table();
58 }
59 }
60