Skip to content

Commit 68754f8

Browse files
committed
fix: address WordPress.org plugin review feedback
- Prefix the session transaction queue transient with the plugin's graphql_woocommerce_ namespace instead of the generic "woo_" word, to avoid collisions (Plugin Directory: prefix data storage). - Declare the WooCommerce dependency via the "Requires Plugins: woocommerce" plugin header. - Bump README.txt "Tested up to" to 7.0. - Ship composer.json in the distributed plugin (drop it, and composer.lock, from composer archive excludes) so the build is reproducible/reviewable.
1 parent 01876f5 commit 68754f8

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: kidunot89, ranaaterning, jasonbahl, saleebm
33
Tags: GraphQL, WooCommerce, WPGraphQL
44
Requires at least: 6.3
5-
Tested up to: 6.8
5+
Tested up to: 7.0
66
Requires PHP: 8.1
77
Requires WooCommerce: 9.0.0
88
Requires WPGraphQL: 2.0.0

composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@
108108
"/codeception.dist.yml",
109109
"/codeception.yml",
110110
"/codeclimate.yml",
111-
"/composer.json",
112-
"/composer.lock",
113111
"/docker-compose.yml",
114112
"/Dockerfile",
115113
"/netlify.toml",

includes/utils/class-session-transaction-manager.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function next_transaction() {
228228
// If lead transaction object invalid pop transaction and loop.
229229
if ( ! is_array( $transaction_queue[0] ) ) {
230230
$this->acquire_lock();
231-
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
231+
$transaction_queue = get_transient( "graphql_woocommerce_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
232232
if ( ! empty( $transaction_queue ) ) {
233233
array_shift( $transaction_queue );
234234
$this->save_transaction_queue( $transaction_queue );
@@ -241,7 +241,7 @@ public function next_transaction() {
241241
} elseif ( true === $this->did_transaction_expire( $transaction_queue ) ) {
242242
// If transaction has expired, remove it from the queue array and continue loop.
243243
$this->acquire_lock();
244-
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
244+
$transaction_queue = get_transient( "graphql_woocommerce_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
245245
if ( ! empty( $transaction_queue ) ) {
246246
array_shift( $transaction_queue );
247247
$this->save_transaction_queue( $transaction_queue );
@@ -265,7 +265,7 @@ public function get_transaction_queue() {
265265
$this->acquire_lock();
266266

267267
// Get transaction queue.
268-
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
268+
$transaction_queue = get_transient( "graphql_woocommerce_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
269269
if ( ! $transaction_queue ) {
270270
$transaction_queue = [];
271271
}
@@ -353,7 +353,7 @@ public function pop_transaction_id() {
353353
$this->acquire_lock();
354354

355355
// Get transaction queue.
356-
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
356+
$transaction_queue = get_transient( "graphql_woocommerce_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
357357

358358
if ( ! empty( $transaction_queue[0]['transaction_id'] ) && $this->transaction_id === $transaction_queue[0]['transaction_id'] ) {
359359
// Remove Transaction ID and update queue.
@@ -378,12 +378,12 @@ public function pop_transaction_id() {
378378
public function save_transaction_queue( $queue = [] ) {
379379
// If queue empty delete transient and bail.
380380
if ( empty( $queue ) ) {
381-
delete_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
381+
delete_transient( "graphql_woocommerce_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
382382
return;
383383
}
384384

385385
// Save transaction queue.
386-
set_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}", $queue, 5 * MINUTE_IN_SECONDS );
386+
set_transient( "graphql_woocommerce_session_transactions_queue_{$this->session_handler->get_customer_id()}", $queue, 5 * MINUTE_IN_SECONDS );
387387
}
388388

389389
/**
@@ -394,7 +394,7 @@ public function save_transaction_queue( $queue = [] ) {
394394
public function set_timestamp() {
395395
$this->acquire_lock();
396396

397-
$transaction_queue = get_transient( "woo_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
397+
$transaction_queue = get_transient( "graphql_woocommerce_session_transactions_queue_{$this->session_handler->get_customer_id()}" );
398398
if ( ! $transaction_queue ) {
399399
$transaction_queue = [];
400400
}

wp-graphql-woocommerce.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
1313
* Requires at least: 6.3
1414
* Requires PHP: 8.1
15+
* Requires Plugins: woocommerce
1516
* WC requires at least: 9.0.0
1617
* WC tested up to: 10.4.3
1718
* WPGraphQL requires at least: 2.0.0

0 commit comments

Comments
 (0)