PluginUpdate
in package
Uses
UtilsProvider, PluginUpdateLicensePool
Plugin update and license handling. If the plugin is hosted on wordpress.org, this class never does anything. But notice, that wordpress.org plugins also needs to "Complete the setup" and get a "free license" from the RPM license server.
Table of Contents
Constants
- ERROR_CODE_BLOG_NOT_FOUND = 'rpm_wpc_blog_not_found'
- ERROR_CODE_INVALID_KEYS = 'rpm_wpc_invalid_keys'
- ERROR_CODE_INVALID_LICENSES = 'rpm_wpc_invalid_licenses'
- ERROR_CODE_INVALID_NEWSLETTER = 'rpm_wpc_invalid_newsletter'
- ERROR_CODE_NONE_IN_USAGE = 'rpm_wpc_none_in_usage'
- OPTION_NAME_FIRST_INITIALIZATION_PREFIX = RPM_WP_CLIENT_OPT_PREFIX . '-puFirst_'
Properties
- $suppressGetLicensesWpDie : mixed
- $announcementPool : AnnouncementPool
- Announcement pool
- $initiator : AbstractInitiator
- Initiator for this plugin.
- $licenseActivationClient : LicenseActivation
- License activation client.
- $licenseCache : array<string|int, License>
- License instances cached, can be also partial within a multisite (not all subsites).
- $licenses : array<string|int, License>
- License instances of the complete multisite.
- $pluginUpdateChecker : PluginUpdateChecker
- Plugin Update Checker instance.
- $view : PluginUpdateView
- View handler.
Methods
- auto_update_plugin() : bool|null
- Check for auto updates and do not update major versions.
- enableAutoUpdates() : mixed
- Enable auto updates for this plugin.
- getAnnouncementPool() : mixed
- Get announcement pool.
- getCurrentBlogLicense() : License
- Get the license for the current blog id.
- getDaysSinceFirstInitialization() : mixed
- Get the days since the first initialization. See `#getFirstInitializationTimestamp`. Imagine, you install the plugin today, you will get `1` for today, `2` for tomorrow, and so on.
- getFirstFoundLicense() : mixed
- Get first found license as we can not update per-site in multisite (?).
- getFirstInitializationTimestamp() : int
- Get the timestamp which represents the existence of the first time this plugin updater was used.
- getInitiator() : mixed
- Get initiator.
- getLicenseActivationClient() : mixed
- Get license activation client.
- getLicensedBlogIds() : array<string|int, mixed>|false
- Get a list of licensed blog IDs.
- getLicenses() : array<string|int, License>
- Get all licenses for each blog (when multisite is enabled). Attention: If a blog uses the same hostname as a previous known blog, they share the same `License` instance.
- getPluginConstantPrefix() : string
- Get the prefix of this package so we can utils package natively.
- getPluginUpdateChecker() : mixed
- Get Plugin Update Checker.
- getUniqueLicenses() : array<string|int, License>
- The same as `getLicenses`, but only get unique `License` instances.
- getView() : mixed
- Get view.
- init() : mixed
- `init` hook which does e.g. automatically activate licenses depending on a WordPress hook.
- initialize() : mixed
- Initialize PRO updates for this plugin. This is before the `init` hook was called!
- instance() : mixed
- New instance.
- language_packs() : mixed
- For licensed plugin installations, endable the download from assets.devowl.io for language packs.
- setupConstants() : mixed
- Make sure the RPM_WP_CLIENT constants are available.
- updateLicenseSettings() : mixed
- Update license settings for this plugin.
- constructPluginUpdateLicensePool() : mixed
- C'tor.
- getPotentialBlogIds() : array<string|int, int>
- Get all blog ids for this WordPress instance (Multisite) which needs a license.
- validateLicenseCodes() : mixed
- Validate license codes.
- __construct() : mixed
- C'tor.
Constants
ERROR_CODE_BLOG_NOT_FOUND
public
mixed
ERROR_CODE_BLOG_NOT_FOUND
= 'rpm_wpc_blog_not_found'
ERROR_CODE_INVALID_KEYS
public
mixed
ERROR_CODE_INVALID_KEYS
= 'rpm_wpc_invalid_keys'
ERROR_CODE_INVALID_LICENSES
public
mixed
ERROR_CODE_INVALID_LICENSES
= 'rpm_wpc_invalid_licenses'
ERROR_CODE_INVALID_NEWSLETTER
public
mixed
ERROR_CODE_INVALID_NEWSLETTER
= 'rpm_wpc_invalid_newsletter'
ERROR_CODE_NONE_IN_USAGE
public
mixed
ERROR_CODE_NONE_IN_USAGE
= 'rpm_wpc_none_in_usage'
OPTION_NAME_FIRST_INITIALIZATION_PREFIX
public
mixed
OPTION_NAME_FIRST_INITIALIZATION_PREFIX
= RPM_WP_CLIENT_OPT_PREFIX . '-puFirst_'
Properties
$suppressGetLicensesWpDie
public
mixed
$suppressGetLicensesWpDie
= false
$announcementPool
Announcement pool
private
AnnouncementPool
$announcementPool
$initiator
Initiator for this plugin.
private
AbstractInitiator
$initiator
$licenseActivationClient
License activation client.
private
LicenseActivation
$licenseActivationClient
$licenseCache
License instances cached, can be also partial within a multisite (not all subsites).
private
array<string|int, License>
$licenseCache
= []
$licenses
License instances of the complete multisite.
private
array<string|int, License>
$licenses
$pluginUpdateChecker
Plugin Update Checker instance.
private
PluginUpdateChecker
$pluginUpdateChecker
$view
View handler.
private
PluginUpdateView
$view
Methods
auto_update_plugin()
Check for auto updates and do not update major versions.
public
auto_update_plugin(bool|null $update, object|array<string|int, mixed> $item) : bool|null
Parameters
- $update : bool|null
- $item : object|array<string|int, mixed>
Return values
bool|nullenableAutoUpdates()
Enable auto updates for this plugin.
public
enableAutoUpdates() : mixed
getAnnouncementPool()
Get announcement pool.
public
getAnnouncementPool() : mixed
Tags
getCurrentBlogLicense()
Get the license for the current blog id.
public
getCurrentBlogLicense() : License
Return values
LicensegetDaysSinceFirstInitialization()
Get the days since the first initialization. See `#getFirstInitializationTimestamp`. Imagine, you install the plugin today, you will get `1` for today, `2` for tomorrow, and so on.
public
getDaysSinceFirstInitialization() : mixed
getFirstFoundLicense()
Get first found license as we can not update per-site in multisite (?).
public
getFirstFoundLicense() : mixed
getFirstInitializationTimestamp()
Get the timestamp which represents the existence of the first time this plugin updater was used.
public
getFirstInitializationTimestamp() : int
Return values
intgetInitiator()
Get initiator.
public
getInitiator() : mixed
Tags
getLicenseActivationClient()
Get license activation client.
public
getLicenseActivationClient() : mixed
Tags
getLicensedBlogIds()
Get a list of licensed blog IDs.
public
getLicensedBlogIds([bool|string $invalidate = false ][, bool $returnCurrentOnNonMultisite = false ]) : array<string|int, mixed>|false
Parameters
- $invalidate : bool|string = false
-
If
true
it will invalidate the transient, or"never"
to get the value independent of cache expiration - $returnCurrentOnNonMultisite : bool = false
Return values
array<string|int, mixed>|false —Array with hostname as key and blog IDs as value. If it is not multisite, it returns false
(see also $returnCurrentOnNonMultisite
)
getLicenses()
Get all licenses for each blog (when multisite is enabled). Attention: If a blog uses the same hostname as a previous known blog, they share the same `License` instance.
public
getLicenses([bool $checkRemoteStatus = false ][, array<string|int, int> $inBlogIds = null ]) : array<string|int, License>
Parameters
- $checkRemoteStatus : bool = false
- $inBlogIds : array<string|int, int> = null
-
If set only return the list of this blog IDs
Return values
array<string|int, License>getPluginConstantPrefix()
Get the prefix of this package so we can utils package natively.
public
getPluginConstantPrefix() : string
Return values
stringgetPluginUpdateChecker()
Get Plugin Update Checker.
public
getPluginUpdateChecker() : mixed
Tags
getUniqueLicenses()
The same as `getLicenses`, but only get unique `License` instances.
public
getUniqueLicenses([bool $skipNoUsage = false ]) : array<string|int, License>
Use this with caution as it leads to iterate all subsites within your multisite!
Parameters
- $skipNoUsage : bool = false
-
Pass
true
to skip licenses which are not in usage
Return values
array<string|int, License>getView()
Get view.
public
getView() : mixed
Tags
init()
`init` hook which does e.g. automatically activate licenses depending on a WordPress hook.
public
init() : mixed
initialize()
Initialize PRO updates for this plugin. This is before the `init` hook was called!
public
initialize() : mixed
instance()
New instance.
public
static instance(AbstractInitiator $initiator) : mixed
Parameters
- $initiator : AbstractInitiator
Tags
language_packs()
For licensed plugin installations, endable the download from assets.devowl.io for language packs.
public
language_packs(array<string|int, mixed> $urls, bool $isPrereleaseVersion) : mixed
Parameters
- $urls : array<string|int, mixed>
- $isPrereleaseVersion : bool
setupConstants()
Make sure the RPM_WP_CLIENT constants are available.
public
static setupConstants() : mixed
updateLicenseSettings()
Update license settings for this plugin.
public
updateLicenseSettings(array<string|int, mixed> $licenses[, bool $telemetry = false ][, bool $newsletterOptIn = false ][, string $firstName = '' ][, string $email = '' ]) : mixed
Parameters
- $licenses : array<string|int, mixed>
-
Pass
null
to activate all unlicensed, free sites - $telemetry : bool = false
- $newsletterOptIn : bool = false
- $firstName : string = ''
- $email : string = ''
constructPluginUpdateLicensePool()
C'tor.
protected
constructPluginUpdateLicensePool() : mixed
getPotentialBlogIds()
Get all blog ids for this WordPress instance (Multisite) which needs a license.
protected
getPotentialBlogIds([array<string|int, int> $inBlogIds = null ]) : array<string|int, int>
Parameters
- $inBlogIds : array<string|int, int> = null
-
If set only return the list of this blog IDs
Return values
array<string|int, int>validateLicenseCodes()
Validate license codes.
protected
validateLicenseCodes(array<string|int, mixed> $licenses, bool $telemetry, bool $newsletterOptIn, string $firstName, string $email) : mixed
Parameters
- $licenses : array<string|int, mixed>
- $telemetry : bool
- $newsletterOptIn : bool
- $firstName : string
- $email : string
__construct()
C'tor.
private
__construct(AbstractInitiator $initiator) : mixed
Parameters
- $initiator : AbstractInitiator