PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.2
Tiered Pricing Table for WooCommerce v2.2.2
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
← All changes | src/BackgroundProcessing/Updater/Updates/VersionAbstract.php +1 -60 2.0.12.2.2 View file →
@@ -1,10 +1,9 @@
1 1 <?php namespace TierPricingTable\BackgroundProcessing\Updater\Updates;
2 2
3 -use TierPricingTable\BackgroundProcessing\BackgroundTask;
4 3 use TierPricingTable\BackgroundProcessing\Updater\Updater;
5 4
6 -abstract class VersionAbstract extends BackgroundTask {
5 +abstract class VersionAbstract {
7 6
8 7 protected $version;
9 8
10 9 public function getVersion() {
@@ -10,66 +9,8 @@
10 9 public function getVersion() {
11 10 return $this->version;
12 11 }
13 12
14 - protected function getIsCompletedUpdatingKey() {
15 - return 'tiered_price_table_completed_updating_' . $this->getVersion();
16 - }
17 -
18 - protected function getIsUpdatingKey() {
19 - return 'tiered_price_table_updating_' . $this->getVersion();
20 - }
21 -
22 - protected function isUpdating() {
23 - return get_option( $this->getIsUpdatingKey() ) == 'yes';
24 - }
25 -
26 - protected function isCompleted() {
27 - return get_option( $this->getIsCompletedUpdatingKey() ) == 'yes';
28 - }
29 -
30 - protected function begin() {
31 - if ( ! $this->isUpdating() && ! $this->isCompleted() ) {
32 - $this->push_to_queue( 'update_to_' . $this->getVersion() );
33 -
34 - update_option( $this->getIsUpdatingKey(), 'yes' );
35 -
36 - $this->save()->dispatch();
37 - }
38 - }
39 -
40 - protected function complete() {
41 - update_option( $this->getIsUpdatingKey(), 'no' );
42 - update_option( $this->getIsCompletedUpdatingKey(), 'yes' );
43 -
44 - $this->setCurrentDBVersion();
45 - $this->showCompleteUpdatingMessage();
46 -
47 - parent::complete();
48 - }
49 -
50 13 protected function setCurrentDBVersion() {
51 14 update_option( Updater::DB_OPTION, $this->getVersion() );
52 - }
53 -
54 - protected function showUpdatingMessage() {
55 - add_action( 'admin_notices', function () {
56 - ?>
57 - <div class="notice notice-info">
58 - <p><?php _e( 'Tiered Pricing Table is updating database version. It may take a few minutes.',
59 - 'tier-pricing-table' ) ?></p>
60 - </div>
61 - <?php
62 - } );
63 - }
64 -
65 - protected function showCompleteUpdatingMessage() {
66 - add_action( 'admin_notices', function () {
67 - ?>
68 - <div class="notice notice-success">
69 - <p><?php _e( 'Tiered Pricing Table has been completed updating database version.',
70 - 'tier-pricing-table' ) ?></p>
71 - </div>
72 - <?php
73 - } );
74 15 }
75 16 }