PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.0
Tiered Pricing Table for WooCommerce v2.2.0
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / src / BackgroundProcessing / Updater / Updater.php

Updater.php in Tiered Pricing Table for WooCommerce 2.2.0, at src/BackgroundProcessing/Updater/Updater.php

37 lines 846 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\BackgroundProcessing\Updater;
2
3 use TierPricingTable\TierPricingTablePlugin;
4 use TierPricingTable\BackgroundProcessing\Updater\Updates\VersionTwoDotZero;
5
6 class Updater {
7
8 const DB_OPTION = 'tiered_price_table_version';
9
10 public function checkForUpdates() {
11 return $this->compare( TierPricingTablePlugin::DB_VERSION );
12 }
13
14 private function compare( $version ) {
15 $dbVersion = get_option( self::DB_OPTION, '1.1' );
16
17 return version_compare( $dbVersion, $version, '<' );
18 }
19
20 public function update() {
21 foreach ( $this->getUpdates() as $version => $callback ) {
22 if ( $this->compare( $version ) ) {
23 call_user_func( $callback );
24 }
25 }
26 }
27
28 public function getUpdates() {
29 return [
30 '2.0' => [ $this, 'update2_0' ],
31 ];
32 }
33
34 public function update2_0() {
35 ( new VersionTwoDotZero() )->run();
36 }
37 }