JPKCom Simple Lang

JPKComGitPluginUpdater

FinalYes

Class JPKComGitPluginUpdater

Handles plugin updates from a GitHub-hosted JSON manifest.

Table of Contents

Properties

$cache_enabled  : bool
$cache_key  : string
$current_version  : string
$manifest_url  : string
$plugin_file  : string
$plugin_slug  : string

Methods

__construct()  : mixed
Constructor
check_update()  : object
Check for available plugin updates.
clear_cache()  : void
Clear cached manifest after a successful update.
plugin_info()  : mixed
Provide detailed plugin info in the “View Details” modal.
verify_download_checksum()  : bool|WP_Error
Verify download checksum before installation.
get_remote_manifest()  : object|null
Fetch and decode the remote manifest file.

Properties

Methods

__construct()

Constructor

public __construct(string $plugin_file, string $current_version, string $manifest_url) : mixed
Parameters
$plugin_file : string

Absolute path to the main plugin file (FILE).

$current_version : string

Current plugin version.

$manifest_url : string

Full URL to the remote JSON manifest.

check_update()

Check for available plugin updates.

public check_update(object $transient) : object
Parameters
$transient : object

WordPress transient data.

Return values
object

clear_cache()

Clear cached manifest after a successful update.

public clear_cache(WP_Upgrader $upgrader, array<string|int, mixed> $options) : void
Parameters
$upgrader : WP_Upgrader

WordPress upgrader instance.

$options : array<string|int, mixed>

Upgrade options.

plugin_info()

Provide detailed plugin info in the “View Details” modal.

public plugin_info(mixed $result, string $action, object $args) : mixed
Parameters
$result : mixed

Default response.

$action : string

Current action.

$args : object

API request arguments.

verify_download_checksum()

Verify download checksum before installation.

public verify_download_checksum(bool $reply, string $package, WP_Upgrader $upgrader) : bool|WP_Error

This hook fires before WordPress downloads the plugin package, allowing us to verify the SHA256 checksum from the manifest matches the actual download.

Parameters
$reply : bool

Whether to bail without returning the package (default false).

$package : string

The package file name or URL.

$upgrader : WP_Upgrader

The WP_Upgrader instance.

Return values
bool|WP_Error

True to proceed, WP_Error if verification fails.

get_remote_manifest()

Fetch and decode the remote manifest file.

private get_remote_manifest() : object|null

Uses a locking mechanism to prevent race conditions when multiple requests try to fetch the manifest simultaneously.

Return values
object|null

Decoded manifest or null on failure.


        
On this page

Search results