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/VersionTwoDotZero.php +9 -23 2.0.12.2.2 View file →
@@ -22,29 +22,17 @@
22 22 /**
23 23 * Main method to run updating. Version 2.0
24 24 */
25 25 public function run() {
26 - add_action( 'init', function () {
27 - $this->begin();
28 - $this->showUpdatingMessage();
29 - } );
26 + add_action( 'init', [ $this, 'update' ] );
30 27 }
31 28
32 29 /**
33 - * @param mixed $item
34 - *
35 - * @return bool|mixed
30 + * Update
36 31 */
37 - protected function task( $item ) {
38 - $postsToUpdate = $this->getProductsToUpdate( 10 );
32 + public function update() {
33 + $postsToUpdate = $this->getProductsToUpdate();
39 34
40 - if ( empty( $postsToUpdate ) ) {
41 - $this->complete();
42 -
43 - return false;
44 - }
45 -
46 -
47 35 // Single post
48 36 if ( $postsToUpdate instanceof \WP_Post ) {
49 37 $this->updatePost( $postsToUpdate->ID );
50 38 }
@@ -52,9 +40,9 @@
52 40 foreach ( $postsToUpdate as $postId ) {
53 41 $this->updatePost( $postId );
54 42 }
55 43
56 - return $item;
44 + $this->complete();
57 45 }
58 46
59 47 /**
60 48 * @param int $postId
@@ -76,22 +64,20 @@
76 64 protected function complete() {
77 65 delete_post_meta_by_key( '_price_rules_updated' );
78 66 delete_post_meta_by_key( '_price_rules' );
79 67
80 - parent::complete();
68 + $this->setCurrentDBVersion();
81 69 }
82 70
83 71 /**
84 72 * Get list of products to update.
85 73 *
86 - * @param $count
87 - *
88 74 * @return array
89 75 */
90 - protected function getProductsToUpdate( $count ) {
76 + protected function getProductsToUpdate() {
91 77 $args = array(
92 - 'post_type' => ['product', 'product_variation'],
93 - 'posts_per_page' => $count,
78 + 'post_type' => [ 'product', 'product_variation' ],
79 + 'posts_per_page' => - 1,
94 80
95 81 'meta_query' => array(
96 82 'relation' => 'AND',
97 83 array(