Skip to content

Commit

Permalink
Merge pull request #12 from pronamic/11-upgrade-420-subscription-id-meta
Browse files Browse the repository at this point in the history
Add upgrade script to fix missing Pronamic subscription IDs in WooCommerce subscription meta
  • Loading branch information
rvdsteege authored Sep 19, 2022
2 parents c0cf59f + ae4a27f commit 6e6b3cc
Show file tree
Hide file tree
Showing 6 changed files with 426 additions and 10 deletions.
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@
"overtrue/phplint": "^2.1",
"php-coveralls/php-coveralls": "^2.4",
"php-stubs/woocommerce-stubs": "^5.9",
"php-stubs/wp-cli-stubs": "^2.6",
"phpmd/phpmd": "^2.9",
"phpunit/phpunit": "^5.7 || ^6.0",
"pronamic/wp-coding-standards": "^1.0",
"pronamic/wp-coding-standards": "^1.2",
"roots/wordpress": "^5.8",
"woocommerce/woocommerce": "^5.9",
"wp-cli/wp-cli": "^2.6",
"wp-phpunit/wp-phpunit": "^5.8",
"wp-premium/woocommerce-subscriptions": "^3.0",
"yoast/phpunit-polyfills": "^1.0"
"yoast/phpunit-polyfills": "^1.0",
"yoast/wordpress-seo": "^19.6"
},
"scripts": {
"coveralls": "vendor/bin/php-coveralls -v",
Expand All @@ -97,7 +100,7 @@
"phpcs": "XDEBUG_MODE=off vendor/bin/phpcs -s -v",
"phplint": "vendor/bin/phplint",
"phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php",
"phpstan": "vendor/bin/phpstan analyse",
"phpstan": "vendor/bin/phpstan analyse --memory-limit=-1",
"phpunit": "vendor/bin/phpunit",
"post-install-cmd": "echo 'Optionally run: composer bin all install'",
"post-update-cmd": "echo 'Optionally run: composer bin all update'",
Expand Down
4 changes: 4 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
<rule ref="PronamicWP">
<exclude name="Squiz.Commenting" />

<exclude name="WordPress.DB.SlowDBQuery.slow_db_query_meta_query" />

<exclude name="WordPress.VIP.SlowDBQuery.slow_db_query" />

<exclude name="WordPressVIPMinimum.Performance.NoPaging.nopaging_nopaging" />
</rule>

<rule ref="WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_putenv">
Expand Down
6 changes: 5 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ includes:
parameters:
checkMissingIterableValueType: false
customRulesetUsed: false
dynamicConstantNames:
- WP_CLI
level: max
bootstrapFiles:
- vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php
- tests/phpstan/bootstrap.php
paths:
- src/
scanDirs:
scanDirectories:
- wp-content/
scanFiles:
- vendor/php-stubs/wp-cli-stubs/wp-cli-stubs.php
ignoreErrors:
-
message: '#Access to protected property WC_Order::\$id\.#'
Expand Down
16 changes: 10 additions & 6 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,23 @@ class Extension extends AbstractPluginIntegration {
/**
* Construct WooCommerce plugin integration.
*
* @param array<string, mixed> $args Arguments.
* @return void
*/
public function __construct() {
parent::__construct(
[
'name' => __( 'WooCommerce', 'pronamic_ideal' ),
]
);
public function __construct( $args = [] ) {
$args['name'] = __( 'WooCommerce', 'pronamic_ideal' );

parent::__construct( $args );

// Dependencies.
$dependencies = $this->get_dependencies();

$dependencies->add( new WooCommerceDependency() );

// Upgrades.
$upgrades = $this->get_upgrades();

$upgrades->add( new Upgrade420() );
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ private function has_pronamic_subscriptions_support() {

/**
* Maybe add subscriptions support.
*
* @return void
*/
public function maybe_add_subscriptions_support() {
if ( ! $this->has_pronamic_subscriptions_support() ) {
Expand Down
Loading

0 comments on commit 6e6b3cc

Please sign in to comment.