Implement API for Premium plugin installation and activation

[MAILPOET-2431]
This commit is contained in:
Jan Jakeš
2019-12-11 10:53:28 +01:00
committed by Jack Kitterhing
parent 757d09ac19
commit 4e75bcd296
7 changed files with 290 additions and 27 deletions

View File

@ -16,3 +16,38 @@ if (!class_exists(WooCommerce::class)) {
}
require_once __DIR__ . '/function-stubs.php';
// methods & classes for Premium plugin installation are required
// only when needed so we need to let PHPStan know about them
if (!function_exists('plugins_api')) {
/**
* @param string $action
* @param array|object $args
* @return object|array|WP_Error
*/
function plugins_api($action, $args) {
return [];
}
}
if (!class_exists(WP_Ajax_Upgrader_Skin::class)) {
// phpcs:ignore
class WP_Ajax_Upgrader_Skin {}
}
if (!class_exists(Plugin_Upgrader::class)) {
// phpcs:ignore
class Plugin_Upgrader {
public function __construct($skin = null) {
}
/**
* @param string $package
* @param array $args
* @return bool|WP_Error
*/
public function install($package, $args = []) {
return true;
}
}
}