Skip to content

Commit

Permalink
improved the update method in admin class
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Jan 15, 2014
1 parent 6a4fcc0 commit 31b7d9a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions admin/class-wc-payment-discounts-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function init() {
}

// Plugin need update.
if ( ! get_option( 'woocommerce_payment_discounts_version' ) ) {
if ( ! version_compare( get_option( 'woocommerce_payment_discounts_version' ), WC_Payment_Discounts::VERSION, '>=' ) ) {
add_action( 'admin_notices', array( $this, 'needs_update' ) );
$this->update();
}
Expand All @@ -89,8 +89,8 @@ protected function init() {
*/
protected function update() {
if ( isset( $_GET['wc-payment-discounts-update'] ) && '1' == $_GET['wc-payment-discounts-update'] ) {
add_option( 'woocommerce_payment_discounts', array() );
add_option( 'woocommerce_payment_discounts_version', WC_Payment_Discounts::VERSION );
update_option( 'woocommerce_payment_discounts', array() );
update_option( 'woocommerce_payment_discounts_version', WC_Payment_Discounts::VERSION );
delete_option( 'wcpaydisc_settings' );
delete_option( 'wcpaydisc_gateways' );
}
Expand Down

0 comments on commit 31b7d9a

Please sign in to comment.