PluginProbe
wpForo Forum / 3.2.2
wpForo Forum v3.2.2
3.2.2 3.2.1 3.2.0 3.1.7 3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 All 142 releases
← All changes | admin/pages/license/src/Services/LicenseService.php +34 -1 3.2.0 → 3.2.2 View file →
@@ -304,9 +304,11 @@
304 304 $is_terminal = in_array( $server_reason, self::REFUND_REASONS, true )
305 305 || in_array( $server_status, self::TERMINAL_STATUSES, true )
306 306 || $server_reason === 'not_found';
307 307
308 - if( $is_terminal ) {
308 + if( $is_terminal && self::is_legacy_license( $license ) ) {
309 + $this->keep_legacy_license( $product_id, $license );
310 + } elseif( $is_terminal ) {
309 311 $plugin_slug = $license['plugin_slug'] ?? '';
310 312 $this->remove( $product_id );
311 313
312 314 if( $plugin_slug ) {
@@ -348,8 +350,26 @@
348 350 }
349 351 }
350 352
351 353 /**
354 + * A license migrated from the old gVectors store (legacy activation key).
355 + */
356 + private static function is_legacy_license( array $license ): bool {
357 + return ( $license['plan_name'] ?? '' ) === 'Legacy License';
358 + }
359 +
360 + /**
361 + * A legacy license the server no longer knows or reports invalid: old-store owners keep using their
362 + * addon for life, so the license is kept as expired (no updates) and the addon is never deactivated or deleted.
363 + */
364 + private function keep_legacy_license( string $product_id, array $license ): void {
365 + $license['status'] = 'expired';
366 + $license['last_validated'] = time();
367 + $this->save( $product_id, $license );
368 + $this->update_expired_notice( $product_id );
369 + }
370 +
371 + /**
352 372 * If the server reports a real Paddle product_id different from the local key
353 373 * (e.g. a migrated legacy license stored under its plugin slug), move the local
354 374 * license to that key so the store UI treats it like any purchased license.
355 375 * Returns the key to continue with, or '' when the entry was dropped because an
@@ -541,8 +561,21 @@
541 561 // Terminal = refunded, not found on server, or invalid status
542 562 $is_terminal = in_array( $server_reason, self::REFUND_REASONS, true )
543 563 || in_array( $server_status, self::TERMINAL_STATUSES, true )
544 564 || $server_reason === 'not_found';
565 +
566 + if( $is_terminal && self::is_legacy_license( $license ) ) {
567 + $this->keep_legacy_license( $product_id, $license );
568 +
569 + return [
570 + 'valid' => false,
571 + 'reason' => $server_reason ?: $server_status,
572 + 'error' => $server_error,
573 + 'status' => 'expired',
574 + 'removed' => false,
575 + 'addon_deleted' => false,
576 + ];
577 + }
545 578
546 579 $removed = false;
547 580 $addon_deleted = false;
548 581