Changeset 3216397
- Timestamp:
- 01/03/2025 10:29:00 AM (15 months ago)
- Location:
- svea-checkout-for-woocommerce
- Files:
-
- 6 edited
- 1 copied
-
tags/3.1.4 (copied) (copied from svea-checkout-for-woocommerce/trunk)
-
tags/3.1.4/inc/Session_Table.php (modified) (2 diffs)
-
tags/3.1.4/readme.txt (modified) (3 diffs)
-
tags/3.1.4/svea-checkout-for-woocommerce.php (modified) (4 diffs)
-
trunk/inc/Session_Table.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/svea-checkout-for-woocommerce.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
svea-checkout-for-woocommerce/tags/3.1.4/inc/Session_Table.php
r3172745 r3216397 229 229 $version = get_option( self::DB_VERSION_KEY, '0.0.0' ); 230 230 231 if ( version_compare( $version, ' 1.0.0', '<' ) ) {232 $this->update_database_ 1();233 $version = ' 1.0.0';231 if ( version_compare( $version, '2.0.0', '<' ) ) { 232 $this->update_database_2(); 233 $version = '2.0.0'; 234 234 update_option( self::DB_VERSION_KEY, $version ); 235 235 } … … 244 244 245 245 /** 246 * Update to version 1.0.0 247 * 248 * @return void 249 */ 250 public function update_database_1() { 251 global $wpdb; 252 253 $table_name = $wpdb->prefix . self::$table; 254 $charset_collate = $wpdb->get_charset_collate(); 255 256 // Setup new table if not already exists 257 if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) { 258 $sql = "CREATE TABLE $table_name ( 259 id bigint(20) NOT NULL AUTO_INCREMENT, 260 sco_session_token varchar(255) NOT NULL, 261 wc_session_key varchar(255) NOT NULL, 262 expires varchar(255) NOT NULL, 263 PRIMARY KEY (id), 264 INDEX sco_session_token (sco_session_token), 265 INDEX wc_session_key (wc_session_key) 266 ) $charset_collate;"; 267 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 268 dbDelta( $sql ); 269 } 270 271 // Add cron to delete older entries 272 if ( ! wp_next_scheduled( self::CRON_NAME ) ) { 273 wp_schedule_event( time(), 'daily', self::CRON_NAME ); 246 * Update version to 2.0.0 247 * This is a temporary fix to handle orders that are affected by the bug introduced in 3.1.1 248 * 249 * @return void 250 */ 251 public function update_database_2() { 252 global $wpdb; 253 254 // Find all orders with the "awaiting-svea" status without wc-prefix 255 $order_ids = $wpdb->get_col( 256 $wpdb->prepare( 257 "SELECT id FROM %i WHERE status = 'awaiting-svea'", 258 $wpdb->prefix . 'wc_orders' 259 ) 260 ); 261 262 foreach ( $order_ids as $order_id ) { 263 $wc_order = wc_get_order( $order_id ); 264 265 if ( ! $wc_order ) { 266 continue; 267 } 268 269 $svea_order_id = $wc_order->get_meta( '_svea_co_order_id' ); 270 271 if ( ! $svea_order_id ) { 272 continue; 273 } 274 275 $wpdb->update( 276 $wpdb->prefix . 'wc_orders', 277 [ 'status' => 'wc-awaiting-svea' ], 278 [ 'id' => $order_id ] 279 ); 280 281 WC_Gateway_Svea_Checkout::log( 282 sprintf( 'Found order with "awaiting-svea" status, scheduling a check. WC ID: %s, Svea ID: %s', $order_id, $svea_order_id ) 283 ); 284 285 wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'sco_check_pa_order_status', [ $svea_order_id ] ); 274 286 } 275 287 } -
svea-checkout-for-woocommerce/tags/3.1.4/readme.txt
r3206818 r3216397 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3.1. 312 Stable tag: 3.1.4 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 86 86 == Upgrade Notice == 87 87 88 = 3.1.4 = 89 3.1.4 is a patch release 90 91 = 3.1.3 = 92 3.1.3 is a patch release 93 88 94 = 3.1.2 = 89 95 3.1.2 is a patch release … … 352 358 353 359 == Changelog == 360 361 = 3.1.4 2024-01-03 = 362 - Change priority of post status registration to fix issues where "Awaiting Svea" would be registered in WooCommerce but not as a WP post status. 354 363 355 364 = 3.1.3 2024-12-12 = -
svea-checkout-for-woocommerce/tags/3.1.4/svea-checkout-for-woocommerce.php
r3206818 r3216397 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3.1. 316 * Version: 3.1.4 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 49 const VERSION = '3.1. 3';49 const VERSION = '3.1.4'; 50 50 51 51 /** … … 249 249 add_action( 'plugins_loaded', [ $this, 'init_gateways' ] ); 250 250 add_filter( 'woocommerce_shipping_methods', [ $this, 'init_shipping_methods' ] ); 251 add_action( 'init', [ $this, 'init_admin' ] );251 add_action( 'init', [ $this, 'init_admin' ], 1 ); 252 252 add_action( 'admin_init', [ $this, 'check_compatibility' ] ); 253 253 add_action( 'admin_notices', [ $this, 'display_admin_notices' ] ); … … 288 288 $this->instore = new Instore(); 289 289 $this->instore->init(); 290 291 $this->session_table = new Session_Table(); 292 $this->session_table->init(); 290 293 } 291 294 -
svea-checkout-for-woocommerce/trunk/inc/Session_Table.php
r3172745 r3216397 229 229 $version = get_option( self::DB_VERSION_KEY, '0.0.0' ); 230 230 231 if ( version_compare( $version, ' 1.0.0', '<' ) ) {232 $this->update_database_ 1();233 $version = ' 1.0.0';231 if ( version_compare( $version, '2.0.0', '<' ) ) { 232 $this->update_database_2(); 233 $version = '2.0.0'; 234 234 update_option( self::DB_VERSION_KEY, $version ); 235 235 } … … 244 244 245 245 /** 246 * Update to version 1.0.0 247 * 248 * @return void 249 */ 250 public function update_database_1() { 251 global $wpdb; 252 253 $table_name = $wpdb->prefix . self::$table; 254 $charset_collate = $wpdb->get_charset_collate(); 255 256 // Setup new table if not already exists 257 if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) { 258 $sql = "CREATE TABLE $table_name ( 259 id bigint(20) NOT NULL AUTO_INCREMENT, 260 sco_session_token varchar(255) NOT NULL, 261 wc_session_key varchar(255) NOT NULL, 262 expires varchar(255) NOT NULL, 263 PRIMARY KEY (id), 264 INDEX sco_session_token (sco_session_token), 265 INDEX wc_session_key (wc_session_key) 266 ) $charset_collate;"; 267 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 268 dbDelta( $sql ); 269 } 270 271 // Add cron to delete older entries 272 if ( ! wp_next_scheduled( self::CRON_NAME ) ) { 273 wp_schedule_event( time(), 'daily', self::CRON_NAME ); 246 * Update version to 2.0.0 247 * This is a temporary fix to handle orders that are affected by the bug introduced in 3.1.1 248 * 249 * @return void 250 */ 251 public function update_database_2() { 252 global $wpdb; 253 254 // Find all orders with the "awaiting-svea" status without wc-prefix 255 $order_ids = $wpdb->get_col( 256 $wpdb->prepare( 257 "SELECT id FROM %i WHERE status = 'awaiting-svea'", 258 $wpdb->prefix . 'wc_orders' 259 ) 260 ); 261 262 foreach ( $order_ids as $order_id ) { 263 $wc_order = wc_get_order( $order_id ); 264 265 if ( ! $wc_order ) { 266 continue; 267 } 268 269 $svea_order_id = $wc_order->get_meta( '_svea_co_order_id' ); 270 271 if ( ! $svea_order_id ) { 272 continue; 273 } 274 275 $wpdb->update( 276 $wpdb->prefix . 'wc_orders', 277 [ 'status' => 'wc-awaiting-svea' ], 278 [ 'id' => $order_id ] 279 ); 280 281 WC_Gateway_Svea_Checkout::log( 282 sprintf( 'Found order with "awaiting-svea" status, scheduling a check. WC ID: %s, Svea ID: %s', $order_id, $svea_order_id ) 283 ); 284 285 wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'sco_check_pa_order_status', [ $svea_order_id ] ); 274 286 } 275 287 } -
svea-checkout-for-woocommerce/trunk/readme.txt
r3206818 r3216397 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3.1. 312 Stable tag: 3.1.4 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 86 86 == Upgrade Notice == 87 87 88 = 3.1.4 = 89 3.1.4 is a patch release 90 91 = 3.1.3 = 92 3.1.3 is a patch release 93 88 94 = 3.1.2 = 89 95 3.1.2 is a patch release … … 352 358 353 359 == Changelog == 360 361 = 3.1.4 2024-01-03 = 362 - Change priority of post status registration to fix issues where "Awaiting Svea" would be registered in WooCommerce but not as a WP post status. 354 363 355 364 = 3.1.3 2024-12-12 = -
svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php
r3206818 r3216397 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3.1. 316 * Version: 3.1.4 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 49 const VERSION = '3.1. 3';49 const VERSION = '3.1.4'; 50 50 51 51 /** … … 249 249 add_action( 'plugins_loaded', [ $this, 'init_gateways' ] ); 250 250 add_filter( 'woocommerce_shipping_methods', [ $this, 'init_shipping_methods' ] ); 251 add_action( 'init', [ $this, 'init_admin' ] );251 add_action( 'init', [ $this, 'init_admin' ], 1 ); 252 252 add_action( 'admin_init', [ $this, 'check_compatibility' ] ); 253 253 add_action( 'admin_notices', [ $this, 'display_admin_notices' ] ); … … 288 288 $this->instore = new Instore(); 289 289 $this->instore->init(); 290 291 $this->session_table = new Session_Table(); 292 $this->session_table->init(); 290 293 } 291 294
Note: See TracChangeset
for help on using the changeset viewer.