# tier-pricing-table/2.1.1/src/BackgroundProcessing/Updater/Updater.php

Tiered Pricing Table for WooCommerce, version 2.1.1. 37 lines.

- Page: https://pluginprobe.com/plugins/tier-pricing-table/2.1.1/code/src/BackgroundProcessing/Updater/Updater.php
- Raw: https://pluginprobe.com/plugins/tier-pricing-table/2.1.1/raw/src/BackgroundProcessing/Updater/Updater.php
- Modified: 2019-03-26T15:40:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tier-pricing-table/2.1.1/code/src/BackgroundProcessing/Updater/Updater.php#L10-L20`.

```php
<?php namespace TierPricingTable\BackgroundProcessing\Updater;

use TierPricingTable\TierPricingTablePlugin;
use TierPricingTable\BackgroundProcessing\Updater\Updates\VersionTwoDotZero;

class Updater {

	const DB_OPTION = 'tiered_price_table_version';

	public function checkForUpdates() {
		return $this->compare( TierPricingTablePlugin::DB_VERSION );
	}

	private function compare( $version ) {
		$dbVersion = get_option( self::DB_OPTION, '1.1' );

		return version_compare( $dbVersion, $version, '<' );
	}

	public function update() {
		foreach ( $this->getUpdates() as $version => $callback ) {
			if ( $this->compare( $version ) ) {
				call_user_func( $callback );
			}
		}
	}

	public function getUpdates() {
		return [
			'2.0' => [ $this, 'update2_0' ],
		];
	}

	public function update2_0() {
		( new VersionTwoDotZero() )->run();
	}
}
```
