Skip to content

Commit

Permalink
license validation API Client
Browse files Browse the repository at this point in the history
  • Loading branch information
wordpressfan committed Jun 26, 2024
1 parent 43a5027 commit 65e347f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.

This file was deleted.

37 changes: 37 additions & 0 deletions inc/Engine/License/API/LicenseValidationClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace WP_Rocket\Engine\Plugin;

use WP_Rocket\Engine\Common\JobManager\APIHandler\AbstractSafeAPIClient;

/**
* Class PluginInformationClient
*
* This class extends the AbstractSafeAPIClient class and provides methods for
* getting the transient key and API URL specific to plugin information.
*
*/

Check notice on line 13 in inc/Engine/License/API/LicenseValidationClient.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

inc/Engine/License/API/LicenseValidationClient.php#L13

Additional blank lines found at end of doc comment
class LicenseValidationClient extends AbstractSafeAPIClient {

/**
* Get the transient key for plugin information.
*
* This method returns the transient key used for caching plugin information.
*
* @return string The transient key for plugin information.
*/
protected function get_transient_key() {
return 'wp_rocket_license_validation';
}

/**
* Get the API URL for plugin information.
*
* This method returns the API URL used for fetching plugin information.
*
* @return string The API URL for plugin information.
*/
protected function get_api_url() {
return rocket_get_constant( 'WP_ROCKET_WEB_VALID' );
}
}
6 changes: 4 additions & 2 deletions inc/functions/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use WP_Rocket\Admin\Options;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Logger\Logger;
use WP_Rocket\Engine\Plugin\LicenseValidationClient;

defined( 'ABSPATH' ) || exit;

Expand Down Expand Up @@ -460,8 +461,9 @@ function rocket_check_key() {

Logger::info( 'LICENSE VALIDATION PROCESS STARTED.', [ 'license validation process' ] );

$response = wp_remote_get(
rocket_get_constant( 'WP_ROCKET_WEB_VALID' ),
$api_client = new LicenseValidationClient();

$response = $api_client->send_get_request(
[
'timeout' => 30,
]
Expand Down

0 comments on commit 65e347f

Please sign in to comment.