Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -35,7 +35,7 @@ class Base_Installer {
|
||||
*/
|
||||
public function get_steps() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,7 +75,7 @@ class Base_Installer {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$callable = array($this, "_install_{$installer}");
|
||||
$callable = [$this, "_install_{$installer}"];
|
||||
|
||||
$callable = apply_filters("wu_installer_{$installer}_callback", $callable, $installer);
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Core_Installer extends Base_Installer {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
add_filter(
|
||||
'wu_core_installer_install_sunrise',
|
||||
@ -64,9 +64,9 @@ class Core_Installer extends Base_Installer {
|
||||
|
||||
$has_tables_installed = \WP_Ultimo\Loaders\Table_Loader::get_instance()->is_installed();
|
||||
|
||||
$steps = array();
|
||||
$steps = [];
|
||||
|
||||
$steps['database_tables'] = array(
|
||||
$steps['database_tables'] = [
|
||||
'done' => $has_tables_installed,
|
||||
'title' => __('Create Database Tables', 'wp-ultimo'),
|
||||
'description' => __('WP Multisite WaaS uses custom tables for performance reasons. We need to create those tables and make sure they are setup properly before we can activate the plugin.', 'wp-ultimo'),
|
||||
@ -74,9 +74,9 @@ class Core_Installer extends Base_Installer {
|
||||
'installing' => __('Creating default tables...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('installation-errors'),
|
||||
);
|
||||
];
|
||||
|
||||
$steps['sunrise'] = array(
|
||||
$steps['sunrise'] = [
|
||||
'done' => defined('SUNRISE') && SUNRISE && defined('WP_ULTIMO_SUNRISE_VERSION'),
|
||||
'title' => __('Install <code>sunrise.php</code> File', 'wp-ultimo'),
|
||||
'description' => __('We need to add our own sunrise.php file to the wp-content folder in order to be able to control access to sites and plugins before anything else happens on WordPress. ', 'wp-ultimo'),
|
||||
@ -84,7 +84,7 @@ class Core_Installer extends Base_Installer {
|
||||
'installing' => __('Installing sunrise file...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('installation-errors'),
|
||||
);
|
||||
];
|
||||
|
||||
return $steps;
|
||||
}
|
||||
@ -96,17 +96,17 @@ class Core_Installer extends Base_Installer {
|
||||
* @throws \Exception When an error occurs during the creation.
|
||||
* @return void
|
||||
*/
|
||||
public function _install_database_tables() {
|
||||
public function _install_database_tables(): void {
|
||||
|
||||
$tables = \WP_Ultimo\Loaders\Table_Loader::get_instance()->get_tables();
|
||||
|
||||
foreach ($tables as $table_name => $table) {
|
||||
|
||||
// Exclude native WP tables, as they already exist.
|
||||
$exclude_list = array(
|
||||
$exclude_list = [
|
||||
'site_table',
|
||||
'sitemeta_table',
|
||||
);
|
||||
];
|
||||
|
||||
if (in_array($table_name, $exclude_list, true)) {
|
||||
continue;
|
||||
@ -131,7 +131,7 @@ class Core_Installer extends Base_Installer {
|
||||
* @throws \Exception When sunrise copying fails.
|
||||
* @return void
|
||||
*/
|
||||
public function _install_sunrise() {
|
||||
public function _install_sunrise(): void {
|
||||
|
||||
$copy = \WP_Ultimo\Sunrise::try_upgrade();
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Default_Content_Installer extends Base_Installer {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
require_once wu_path('inc/functions/email.php');
|
||||
|
||||
@ -143,9 +143,9 @@ class Default_Content_Installer extends Base_Installer {
|
||||
*/
|
||||
public function get_steps() {
|
||||
|
||||
$steps = array();
|
||||
$steps = [];
|
||||
|
||||
$steps['create_template_site'] = array(
|
||||
$steps['create_template_site'] = [
|
||||
'done' => $this->done_creating_template_site(),
|
||||
'title' => __('Create Example Template Site', 'wp-ultimo'),
|
||||
'description' => __('This will create a template site on your network that you can use as a starting point.', 'wp-ultimo'),
|
||||
@ -153,9 +153,9 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'installing' => __('Creating Template Site...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('installation-errors'),
|
||||
);
|
||||
];
|
||||
|
||||
$steps['create_products'] = array(
|
||||
$steps['create_products'] = [
|
||||
'done' => $this->done_creating_products(),
|
||||
'title' => __('Create Example Products', 'wp-ultimo'),
|
||||
'description' => __('This action will create example products (plans, packages, and services), so you have an starting point.', 'wp-ultimo'),
|
||||
@ -163,9 +163,9 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'installing' => __('Creating Products...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('installation-errors'),
|
||||
);
|
||||
];
|
||||
|
||||
$steps['create_checkout'] = array(
|
||||
$steps['create_checkout'] = [
|
||||
'done' => $this->done_creating_checkout_forms(),
|
||||
'title' => __('Create a Checkout Form', 'wp-ultimo'),
|
||||
'description' => __('This action will create a single-step checkout form that your customers will use to place purchases, as well as the page that goes with it.', 'wp-ultimo'),
|
||||
@ -173,9 +173,9 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'installing' => __('Creating Checkout Form and Registration Page...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('installation-errors'),
|
||||
);
|
||||
];
|
||||
|
||||
$steps['create_emails'] = array(
|
||||
$steps['create_emails'] = [
|
||||
'done' => $this->done_creating_emails(),
|
||||
'title' => __('Create the System Emails', 'wp-ultimo'),
|
||||
'description' => __('This action will create all emails sent by WP Multisite WaaS.', 'wp-ultimo'),
|
||||
@ -183,9 +183,9 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'installing' => __('Creating System Emails...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('installation-errors'),
|
||||
);
|
||||
];
|
||||
|
||||
$steps['create_login_page'] = array(
|
||||
$steps['create_login_page'] = [
|
||||
'done' => $this->done_creating_login_page(),
|
||||
'title' => __('Create Custom Login Page', 'wp-ultimo'),
|
||||
'description' => __('This action will create a custom login page and replace the default one.', 'wp-ultimo'),
|
||||
@ -193,7 +193,7 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'installing' => __('Creating Custom Login Page...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('installation-errors'),
|
||||
);
|
||||
];
|
||||
|
||||
return $steps;
|
||||
}
|
||||
@ -207,16 +207,16 @@ class Default_Content_Installer extends Base_Installer {
|
||||
* @throws \Exception When a site with the /template path already exists.
|
||||
* @return void
|
||||
*/
|
||||
public function _install_create_template_site() {
|
||||
public function _install_create_template_site(): void {
|
||||
|
||||
$d = wu_get_site_domain_and_path('template');
|
||||
|
||||
$template_site = array(
|
||||
$template_site = [
|
||||
'domain' => $d->domain,
|
||||
'path' => $d->path,
|
||||
'title' => __('Template Site', 'wp-ultimo'),
|
||||
'type' => 'site_template',
|
||||
);
|
||||
];
|
||||
|
||||
$status = wu_create_site($template_site);
|
||||
|
||||
@ -238,24 +238,24 @@ class Default_Content_Installer extends Base_Installer {
|
||||
* @throws \Exception When the network already has products.
|
||||
* @return void
|
||||
*/
|
||||
public function _install_create_products() {
|
||||
public function _install_create_products(): void {
|
||||
/*
|
||||
* Saves Images
|
||||
*/
|
||||
$images = array(
|
||||
'free' => wu_get_asset('free.png', 'img/wizards'),
|
||||
'premium' => wu_get_asset('premium.png', 'img/wizards'),
|
||||
'seo' => wu_get_asset('seo.png', 'img/wizards'),
|
||||
);
|
||||
$images = [
|
||||
'free' => wu_get_asset('free.webp', 'img/wizards'),
|
||||
'premium' => wu_get_asset('premium.webp', 'img/wizards'),
|
||||
'seo' => wu_get_asset('seo.webp', 'img/wizards'),
|
||||
];
|
||||
|
||||
$images = array_map(array('\\WP_Ultimo\\Helpers\\Screenshot', 'save_image_from_url'), $images);
|
||||
$images = array_map([\WP_Ultimo\Helpers\Screenshot::class, 'save_image_from_url'], $images);
|
||||
|
||||
$products = array();
|
||||
$products = [];
|
||||
|
||||
/*
|
||||
* Free Plan
|
||||
*/
|
||||
$products[] = array(
|
||||
$products[] = [
|
||||
'name' => __('Free', 'wp-ultimo'),
|
||||
'description' => __('This is an example of a free plan.', 'wp-ultimo'),
|
||||
'currency' => wu_get_setting('currency_symbol', 'USD'),
|
||||
@ -270,12 +270,12 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'billing_cycles' => false,
|
||||
'list_order' => false,
|
||||
'active' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
/*
|
||||
* Premium Plan
|
||||
*/
|
||||
$products[] = array(
|
||||
$products[] = [
|
||||
'name' => __('Premium', 'wp-ultimo'),
|
||||
'description' => __('This is an example of a paid plan.', 'wp-ultimo'),
|
||||
'currency' => wu_get_setting('currency_symbol', 'USD'),
|
||||
@ -290,12 +290,12 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'billing_cycles' => false,
|
||||
'list_order' => false,
|
||||
'active' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
/*
|
||||
* Service
|
||||
*/
|
||||
$products[] = array(
|
||||
$products[] = [
|
||||
'name' => __('SEO Consulting', 'wp-ultimo'),
|
||||
'description' => __('This is an example of a service that you can create and charge customers for.', 'wp-ultimo'),
|
||||
'currency' => wu_get_setting('currency_symbol', 'USD'),
|
||||
@ -310,7 +310,7 @@ class Default_Content_Installer extends Base_Installer {
|
||||
'billing_cycles' => false,
|
||||
'list_order' => false,
|
||||
'active' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($products as $product_data) {
|
||||
$status = wu_create_product($product_data);
|
||||
@ -332,13 +332,13 @@ class Default_Content_Installer extends Base_Installer {
|
||||
* @throws \Exception When a checkout form is already present.
|
||||
* @return void
|
||||
*/
|
||||
public function _install_create_checkout() {
|
||||
public function _install_create_checkout(): void {
|
||||
|
||||
$checkout_form = array(
|
||||
$checkout_form = [
|
||||
'name' => __('Registration Form', 'wp-ultimo'),
|
||||
'slug' => 'main-form',
|
||||
'settings' => array(),
|
||||
);
|
||||
'settings' => [],
|
||||
];
|
||||
|
||||
$status = wu_create_checkout_form($checkout_form);
|
||||
|
||||
@ -359,14 +359,14 @@ class Default_Content_Installer extends Base_Installer {
|
||||
/*
|
||||
* Create the page on the main site.
|
||||
*/
|
||||
$post_details = array(
|
||||
$post_details = [
|
||||
'post_name' => 'register',
|
||||
'post_title' => __('Register', 'wp-ultimo'),
|
||||
'post_content' => sprintf($post_content, $status->get_slug()),
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
'post_author' => get_current_user_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$page_id = wp_insert_post($post_details);
|
||||
|
||||
@ -387,7 +387,7 @@ class Default_Content_Installer extends Base_Installer {
|
||||
* @throws \Exception When the content is already present.
|
||||
* @return void
|
||||
*/
|
||||
public function _install_create_emails() {
|
||||
public function _install_create_emails(): void {
|
||||
|
||||
\WP_Ultimo\Managers\Email_Manager::get_instance()->create_all_system_emails();
|
||||
}
|
||||
@ -399,7 +399,7 @@ class Default_Content_Installer extends Base_Installer {
|
||||
* @throws \Exception When the content is already present.
|
||||
* @return void
|
||||
*/
|
||||
public function _install_create_login_page() {
|
||||
public function _install_create_login_page(): void {
|
||||
|
||||
$page_content = '
|
||||
<!-- wp:shortcode -->
|
||||
@ -407,13 +407,13 @@ class Default_Content_Installer extends Base_Installer {
|
||||
<!-- /wp:shortcode -->
|
||||
';
|
||||
|
||||
$page_args = array(
|
||||
$page_args = [
|
||||
'post_title' => __('Login', 'wp-ultimo'),
|
||||
'post_content' => $page_content,
|
||||
'post_status' => 'publish',
|
||||
'post_author' => get_current_user_id(),
|
||||
'post_type' => 'page',
|
||||
);
|
||||
];
|
||||
|
||||
$page_id = wp_insert_post($page_args);
|
||||
|
||||
|
@ -88,7 +88,7 @@ class Migrator extends Base_Installer {
|
||||
* @since 2.0.7
|
||||
* @var array
|
||||
*/
|
||||
protected $ids_of_interest = array();
|
||||
protected $ids_of_interest = [];
|
||||
|
||||
/**
|
||||
* The status of our attempts to bypass server limitations.
|
||||
@ -107,7 +107,7 @@ class Migrator extends Base_Installer {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
if ($this->is_migration_screen()) {
|
||||
$this->session = wu_get_session('migrator');
|
||||
@ -120,7 +120,7 @@ class Migrator extends Base_Installer {
|
||||
/*
|
||||
* Install the handler for the parallel installer.
|
||||
*/
|
||||
\WP_Ultimo\Async_Calls::register_listener('parallel_installers', array($this, 'handle_parallel_installers'));
|
||||
\WP_Ultimo\Async_Calls::register_listener('parallel_installers', [$this, 'handle_parallel_installers']);
|
||||
|
||||
\WP_Ultimo\Async_Calls::install_listeners();
|
||||
}
|
||||
@ -152,7 +152,7 @@ class Migrator extends Base_Installer {
|
||||
* @param string $installer The name of the current installer.
|
||||
* @return void
|
||||
*/
|
||||
public function on_shutdown($session, $dry_run, $installer) {
|
||||
public function on_shutdown($session, $dry_run, $installer): void {
|
||||
|
||||
$message = 'The migrator process exit unexpectedly while running the "%s" migration... You might need to increase server resources to run the migrator. Below, a list of the ids of interest collected thus far:';
|
||||
|
||||
@ -185,10 +185,10 @@ class Migrator extends Base_Installer {
|
||||
public static function is_migration_done() {
|
||||
|
||||
$plans = get_posts(
|
||||
array(
|
||||
[
|
||||
'post_type' => 'wpultimo_plan',
|
||||
'numberposts' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (empty($plans)) {
|
||||
@ -245,12 +245,12 @@ class Migrator extends Base_Installer {
|
||||
*/
|
||||
public function get_steps($force_all = false) {
|
||||
|
||||
$steps = array();
|
||||
$steps = [];
|
||||
|
||||
$dry_run = wu_request('dry-run', true);
|
||||
|
||||
if ($dry_run && ! $force_all) {
|
||||
$steps['dry_run_check'] = array(
|
||||
$steps['dry_run_check'] = [
|
||||
'title' => __('Pre-Migration Check', 'wp-ultimo'),
|
||||
'description' => __('Runs all migrations in a sand-boxed environment to see if it hits an error.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
@ -258,13 +258,13 @@ class Migrator extends Base_Installer {
|
||||
'installing' => __('Checking...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
return $steps;
|
||||
}
|
||||
|
||||
if ( ! $dry_run) {
|
||||
$steps['backup'] = array(
|
||||
$steps['backup'] = [
|
||||
'title' => __('Prepare for Migration', 'wp-ultimo'),
|
||||
'description' => __('Verifies the data before going forward with the migration.', 'wp-ultimo'),
|
||||
'pending' => __('Pending', 'wp-ultimo'),
|
||||
@ -272,110 +272,110 @@ class Migrator extends Base_Installer {
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$steps['settings'] = array(
|
||||
$steps['settings'] = [
|
||||
'title' => __('Settings', 'wp-ultimo'),
|
||||
'description' => __('Migrates the settings from the older version.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['products'] = array(
|
||||
$steps['products'] = [
|
||||
'title' => __('Plans to Products', 'wp-ultimo'),
|
||||
'description' => __('Converts the old plans into products.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['customers'] = array(
|
||||
$steps['customers'] = [
|
||||
'title' => __('Users to Customers', 'wp-ultimo'),
|
||||
'description' => __('Creates customers based on the existing users.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['memberships'] = array(
|
||||
$steps['memberships'] = [
|
||||
'title' => __('Subscriptions to Memberships', 'wp-ultimo'),
|
||||
'description' => __('Converts subscriptions into Memberships.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['transactions'] = array(
|
||||
$steps['transactions'] = [
|
||||
'title' => __('Transactions to Payments & Events', 'wp-ultimo'),
|
||||
'description' => __('Converts transactions into payments and events.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['discount_codes'] = array(
|
||||
$steps['discount_codes'] = [
|
||||
'title' => __('Coupons to Discount Codes', 'wp-ultimo'),
|
||||
'description' => __('Converts coupons into discount codes.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['sites'] = array(
|
||||
$steps['sites'] = [
|
||||
'title' => __('Customer Sites', 'wp-ultimo'),
|
||||
'description' => __('Adjusts existing customer sites.', 'wp-ultimo'),
|
||||
'installing' => __('Making Adjustments...', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['site_templates'] = array(
|
||||
$steps['site_templates'] = [
|
||||
'title' => __('Sites Templates', 'wp-ultimo'),
|
||||
'description' => __('Adjusts existing site templates.', 'wp-ultimo'),
|
||||
'installing' => __('Making Adjustments...', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['domains'] = array(
|
||||
$steps['domains'] = [
|
||||
'title' => __('Mapped Domains', 'wp-ultimo'),
|
||||
'description' => __('Converts mapped domains.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['forms'] = array(
|
||||
$steps['forms'] = [
|
||||
'title' => __('Checkout Forms', 'wp-ultimo'),
|
||||
'description' => __('Creates a checkout form based on the existing signup flow.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['emails'] = array(
|
||||
$steps['emails'] = [
|
||||
'title' => __('Emails & Broadcasts', 'wp-ultimo'),
|
||||
'description' => __('Converts the emails and broadcasts.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['webhooks'] = array(
|
||||
$steps['webhooks'] = [
|
||||
'title' => __('Webhooks', 'wp-ultimo'),
|
||||
'description' => __('Migrates existing webhooks.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps['other'] = array(
|
||||
$steps['other'] = [
|
||||
'title' => __('Other Migrations', 'wp-ultimo'),
|
||||
'description' => __('Other migrations that don\'t really fit anywhere else.', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('migration-errors'),
|
||||
'done' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$steps = array_map(
|
||||
fn($item) => wp_parse_args(
|
||||
$item,
|
||||
array(
|
||||
[
|
||||
'pending' => __('Pending', 'wp-ultimo'),
|
||||
'installing' => __('Migrating...', 'wp-ultimo'),
|
||||
'success' => __('Success!', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
),
|
||||
$steps
|
||||
);
|
||||
@ -465,7 +465,7 @@ class Migrator extends Base_Installer {
|
||||
*/
|
||||
$this->dry_run = wu_request('dry-run', true);
|
||||
|
||||
$callable = array($this, "_install_{$installer}");
|
||||
$callable = [$this, "_install_{$installer}"];
|
||||
|
||||
$callable = apply_filters("wu_installer_{$installer}_callback", $callable, $installer);
|
||||
|
||||
@ -550,9 +550,9 @@ class Migrator extends Base_Installer {
|
||||
}
|
||||
|
||||
if ($session) {
|
||||
$session->set('errors', array());
|
||||
$session->set('errors', []);
|
||||
|
||||
$session->set('back_traces', array());
|
||||
$session->set('back_traces', []);
|
||||
}
|
||||
|
||||
return $status;
|
||||
@ -601,7 +601,7 @@ class Migrator extends Base_Installer {
|
||||
* @since 2.0.7
|
||||
* @return void
|
||||
*/
|
||||
public function log_ids_of_interest() {
|
||||
public function log_ids_of_interest(): void {
|
||||
|
||||
if ( ! is_array($this->ids_of_interest)) {
|
||||
wu_log_add(self::LOG_FILE_NAME, 'The list of IDs of interested got corrupted, this might indicate problems with one or more migrations', LogLevel::ERROR);
|
||||
@ -610,7 +610,7 @@ class Migrator extends Base_Installer {
|
||||
}
|
||||
|
||||
foreach ($this->ids_of_interest as $key => $ids) {
|
||||
list($installer, $reason) = explode(':', $key);
|
||||
[$installer, $reason] = explode(':', $key);
|
||||
|
||||
if (empty($ids)) {
|
||||
continue;
|
||||
@ -634,11 +634,11 @@ class Migrator extends Base_Installer {
|
||||
* @param string $installer The installer name.
|
||||
* @return void
|
||||
*/
|
||||
public function add_id_of_interest($id_or_ids, $reason, $installer) {
|
||||
public function add_id_of_interest($id_or_ids, $reason, $installer): void {
|
||||
|
||||
$id_list_key = sprintf('%s:%s', $installer, $reason);
|
||||
|
||||
$id_list = wu_get_isset($this->ids_of_interest, $id_list_key, array());
|
||||
$id_list = wu_get_isset($this->ids_of_interest, $id_list_key, []);
|
||||
|
||||
$id_or_ids = (array) $id_or_ids;
|
||||
|
||||
@ -652,7 +652,7 @@ class Migrator extends Base_Installer {
|
||||
* @throws \Exception Halts the process on error.
|
||||
* @return mixed
|
||||
*/
|
||||
public function _install_dry_run_check() {
|
||||
public function _install_dry_run_check(): void {
|
||||
|
||||
global $wpdb, $wu_migrator_current_installer;
|
||||
|
||||
@ -661,7 +661,7 @@ class Migrator extends Base_Installer {
|
||||
foreach ($all_steps as $installer => $step) {
|
||||
$wu_migrator_current_installer = $installer;
|
||||
|
||||
$callable = array($this, "_install_{$installer}");
|
||||
$callable = [$this, "_install_{$installer}"];
|
||||
|
||||
call_user_func($callable);
|
||||
}
|
||||
@ -674,7 +674,7 @@ class Migrator extends Base_Installer {
|
||||
* @throws \Exception Halts the process on error.
|
||||
* @return mixed
|
||||
*/
|
||||
public function _install_backup() {
|
||||
public function _install_backup(): void {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
@ -686,9 +686,9 @@ class Migrator extends Base_Installer {
|
||||
sprintf('mysql:dbname=%s;host=%s', DB_NAME, DB_HOST),
|
||||
DB_USER,
|
||||
DB_PASSWORD,
|
||||
array(
|
||||
[
|
||||
'compress' => MySQLDump::GZIP,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$dump->start($file_name);
|
||||
@ -761,7 +761,7 @@ class Migrator extends Base_Installer {
|
||||
*/
|
||||
wu_save_option("v1_settings_{$random_key}", $settings);
|
||||
|
||||
$keys_to_migrate = array(
|
||||
$keys_to_migrate = [
|
||||
// General
|
||||
'currency_symbol',
|
||||
'currency_position',
|
||||
@ -826,7 +826,7 @@ class Migrator extends Base_Installer {
|
||||
|
||||
// Other options we want to keep.
|
||||
'limits_and_quotas',
|
||||
);
|
||||
];
|
||||
|
||||
$to_migrate = array_intersect_key($settings, array_flip($keys_to_migrate));
|
||||
|
||||
@ -854,13 +854,13 @@ class Migrator extends Base_Installer {
|
||||
/*
|
||||
* Gateway
|
||||
*/
|
||||
$active_gateways = array_keys($this->get_old_setting('active_gateway', array()));
|
||||
$active_gateways = array_keys($this->get_old_setting('active_gateway', []));
|
||||
$to_migrate['active_gateways'] = $active_gateways;
|
||||
|
||||
/*
|
||||
* Stripe
|
||||
*/
|
||||
$is_sandbox = strpos((string) $this->get_old_setting('stripe_api_sk', ''), 'test') !== false;
|
||||
$is_sandbox = str_contains((string) $this->get_old_setting('stripe_api_sk', ''), 'test');
|
||||
|
||||
$to_migrate['stripe_sandbox_mode'] = $is_sandbox;
|
||||
|
||||
@ -905,7 +905,7 @@ class Migrator extends Base_Installer {
|
||||
/*
|
||||
* Top-bar Settings
|
||||
*/
|
||||
$top_bar_settings = array(
|
||||
$top_bar_settings = [
|
||||
'enabled' => $this->get_old_setting('allow_template_top_bar', true),
|
||||
'preview_url_parameter' => 'template-preview',
|
||||
'bg_color' => $this->get_old_setting('top-bar-bg-color', '#f9f9f9'),
|
||||
@ -914,7 +914,7 @@ class Migrator extends Base_Installer {
|
||||
'display_responsive_controls' => $this->get_old_setting('top-bar-enable-resize', true),
|
||||
'use_custom_logo' => $this->get_old_setting('top-bar-use-logo'),
|
||||
'custom_logo' => $this->get_old_setting('top-bar-logo'),
|
||||
);
|
||||
];
|
||||
|
||||
$save_settings = Template_Previewer::get_instance()->save_settings($top_bar_settings);
|
||||
|
||||
@ -937,7 +937,7 @@ class Migrator extends Base_Installer {
|
||||
* @param array $to_migrate The list of settings to migrate.
|
||||
* @return array
|
||||
*/
|
||||
public function fake_register_settings($to_migrate = array()) {
|
||||
public function fake_register_settings($to_migrate = []) {
|
||||
|
||||
add_filter(
|
||||
'wu_settings_section_core_fields',
|
||||
@ -948,11 +948,11 @@ class Migrator extends Base_Installer {
|
||||
$missing_keys = array_diff_key($to_migrate, $all_keys);
|
||||
|
||||
foreach ($missing_keys as $field_slug => $value) {
|
||||
$fields[ $field_slug ] = array(
|
||||
$fields[ $field_slug ] = [
|
||||
'type' => 'hidden',
|
||||
'setting_id' => $field_slug,
|
||||
'raw' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
@ -988,7 +988,7 @@ class Migrator extends Base_Installer {
|
||||
$product_type_plan = 'plan';
|
||||
$duration_unit_day = 'month';
|
||||
$recurring = true;
|
||||
$currency = isset($settings['currency']) ? $settings['currency'] : 'USD';
|
||||
$currency = $settings['currency'] ?? 'USD';
|
||||
|
||||
$plans = $wpdb->get_results(
|
||||
"
|
||||
@ -1016,7 +1016,7 @@ class Migrator extends Base_Installer {
|
||||
continue;
|
||||
}
|
||||
|
||||
$product_data = array();
|
||||
$product_data = [];
|
||||
$product_data['type'] = 'plan';
|
||||
$product_data['migrated_from_id'] = $plan->ID;
|
||||
$product_data['name'] = $plan->name;
|
||||
@ -1042,7 +1042,7 @@ class Migrator extends Base_Installer {
|
||||
*/
|
||||
$default_trial_value = $this->get_old_setting('trial', 0);
|
||||
$plan_trial_value = get_post_meta($plan->ID, 'wpu_trial', true);
|
||||
$product_data['trial_duration'] = $plan_trial_value ? $plan_trial_value : $default_trial_value;
|
||||
$product_data['trial_duration'] = $plan_trial_value ?: $default_trial_value;
|
||||
$product_data['trial_duration_unit'] = $duration_unit_day;
|
||||
|
||||
$active = ! (bool) get_post_meta($plan->ID, 'wpu_hidden', true);
|
||||
@ -1050,7 +1050,7 @@ class Migrator extends Base_Installer {
|
||||
|
||||
$is_free = get_post_meta($plan->ID, 'wpu_free', true);
|
||||
|
||||
$price_variations = array();
|
||||
$price_variations = [];
|
||||
|
||||
if ($is_free) {
|
||||
$product_data['amount'] = 0;
|
||||
@ -1064,11 +1064,11 @@ class Migrator extends Base_Installer {
|
||||
$product_data['duration'] = 1;
|
||||
$product_data['duration_unit'] = 'month';
|
||||
} else {
|
||||
$price_variations[] = array(
|
||||
$price_variations[] = [
|
||||
'amount' => $price_month,
|
||||
'duration' => 1,
|
||||
'duration_unit' => 'month',
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1080,11 +1080,11 @@ class Migrator extends Base_Installer {
|
||||
$product_data['duration'] = 3;
|
||||
$product_data['duration_unit'] = 'month';
|
||||
} else {
|
||||
$price_variations[] = array(
|
||||
$price_variations[] = [
|
||||
'amount' => $price_3_month,
|
||||
'duration' => 3,
|
||||
'duration_unit' => 'month',
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1096,11 +1096,11 @@ class Migrator extends Base_Installer {
|
||||
$product_data['duration'] = 1;
|
||||
$product_data['duration_unit'] = 'year';
|
||||
} else {
|
||||
$price_variations[] = array(
|
||||
$price_variations[] = [
|
||||
'amount' => $price_12_month,
|
||||
'duration' => 1,
|
||||
'duration_unit' => 'year',
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1172,7 +1172,7 @@ class Migrator extends Base_Installer {
|
||||
/*
|
||||
* Build template list.
|
||||
*/
|
||||
$site_templates_limit = array();
|
||||
$site_templates_limit = [];
|
||||
|
||||
$available_site_templates = wu_get_site_templates();
|
||||
|
||||
@ -1188,28 +1188,28 @@ class Migrator extends Base_Installer {
|
||||
$behavior = 'available';
|
||||
}
|
||||
|
||||
$site_templates_limit[ $site_template_id ] = array(
|
||||
$site_templates_limit[ $site_template_id ] = [
|
||||
'behavior' => $behavior,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Limitation modules.
|
||||
*/
|
||||
$limitations_modules = array(
|
||||
'domain_mapping' => array(
|
||||
$limitations_modules = [
|
||||
'domain_mapping' => [
|
||||
'enabled' => $has_custom_domain,
|
||||
),
|
||||
'customer_user_role' => array(
|
||||
],
|
||||
'customer_user_role' => [
|
||||
'enabled' => true,
|
||||
'limit' => $product_data['customer_role'],
|
||||
),
|
||||
'site_templates' => array(
|
||||
],
|
||||
'site_templates' => [
|
||||
'mode' => $site_template_mode,
|
||||
'enabled' => $site_template_enabled,
|
||||
'limit' => $site_templates_limit,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Build the plugins limitations object.
|
||||
@ -1219,18 +1219,18 @@ class Migrator extends Base_Installer {
|
||||
if (is_array($allowed_plugins)) {
|
||||
$allowed_plugins = $allowed_plugins;
|
||||
|
||||
$plugins_limit = array();
|
||||
$plugins_limit = [];
|
||||
|
||||
foreach (Limitation_Manager::get_instance()->get_all_plugins() as $plugin_path => &$plugin_data) {
|
||||
$plugins_limit[ $plugin_path ] = array(
|
||||
$plugins_limit[ $plugin_path ] = [
|
||||
'visibility' => in_array($plugin_path, $allowed_plugins, true) ? 'visible' : 'hidden',
|
||||
'behavior' => in_array($plugin_path, $allowed_plugins, true) ? 'available' : 'not_available',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$limitations_modules['plugins'] = array(
|
||||
$limitations_modules['plugins'] = [
|
||||
'limit' => $plugins_limit,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1239,61 +1239,61 @@ class Migrator extends Base_Installer {
|
||||
* @since 2.0.7
|
||||
*/
|
||||
if (is_array($allowed_themes)) {
|
||||
$themes_limit = array();
|
||||
$themes_limit = [];
|
||||
|
||||
foreach (Limitation_Manager::get_instance()->get_all_themes() as $stylesheet => &$theme_data) {
|
||||
$themes_limit[ $stylesheet ] = array(
|
||||
$themes_limit[ $stylesheet ] = [
|
||||
'visibility' => in_array($stylesheet, $allowed_themes, true) ? 'visible' : 'hidden',
|
||||
'behavior' => in_array($stylesheet, $allowed_themes, true) ? 'available' : 'not_available',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$limitations_modules['themes'] = array(
|
||||
$limitations_modules['themes'] = [
|
||||
'limit' => $themes_limit,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$unlimited_users = (bool) get_post_meta($plan->ID, 'wpu_unlimited_extra_users', true);
|
||||
|
||||
$post_types_limit = array();
|
||||
$post_types_limit = [];
|
||||
|
||||
foreach ($quotas as $post_type => $quota) {
|
||||
if ($post_type === 'users' && ! $unlimited_users) {
|
||||
$user_roles = get_editable_roles();
|
||||
|
||||
$roles_limit = array();
|
||||
$roles_limit = [];
|
||||
|
||||
foreach ($user_roles as $role => $role_data) {
|
||||
$roles_limit[ $role ] = array(
|
||||
$roles_limit[ $role ] = [
|
||||
'enabled' => true,
|
||||
'number' => $quota ? absint($quota) : '',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$limitations_modules['users'] = array(
|
||||
$limitations_modules['users'] = [
|
||||
'limit' => $roles_limit,
|
||||
'enabled' => true,
|
||||
);
|
||||
];
|
||||
} elseif ($post_type === 'upload') {
|
||||
$limitations_modules['disk_space'] = array(
|
||||
$limitations_modules['disk_space'] = [
|
||||
'limit' => absint($quota),
|
||||
'enabled' => true,
|
||||
);
|
||||
];
|
||||
} elseif ($post_type === 'visits') {
|
||||
$limitations_modules['visits'] = array(
|
||||
$limitations_modules['visits'] = [
|
||||
'limit' => $quota ? absint($quota) : '',
|
||||
'enabled' => true,
|
||||
);
|
||||
];
|
||||
} elseif ($post_type === 'sites') {
|
||||
$limitations_modules['sites'] = array(
|
||||
$limitations_modules['sites'] = [
|
||||
'limit' => absint($quota),
|
||||
'enabled' => true,
|
||||
);
|
||||
];
|
||||
} else {
|
||||
$post_types_limit[ $post_type ] = array(
|
||||
$post_types_limit[ $post_type ] = [
|
||||
'enabled' => in_array($post_type, $disabled_post_types, true) === false,
|
||||
'number' => $quota ? absint($quota) : '',
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1301,10 +1301,10 @@ class Migrator extends Base_Installer {
|
||||
* If there's any limitations to post types, add it.
|
||||
*/
|
||||
if ($post_types_limit) {
|
||||
$limitations_modules['post_types'] = array(
|
||||
$limitations_modules['post_types'] = [
|
||||
'limit' => $post_types_limit,
|
||||
'enabled' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$limitations = new \WP_Ultimo\Objects\Limitations($limitations_modules);
|
||||
@ -1365,10 +1365,10 @@ class Migrator extends Base_Installer {
|
||||
*/
|
||||
if ($this->is_parallel() === false) {
|
||||
if ($total_records > $threshold) {
|
||||
$args = array(
|
||||
$args = [
|
||||
'installer' => $this->get_installer(),
|
||||
'dry-run' => $this->dry_run,
|
||||
);
|
||||
];
|
||||
|
||||
$result = \WP_Ultimo\Async_Calls::run('parallel_installers', $args, $total_records, $threshold, 10);
|
||||
|
||||
@ -1461,13 +1461,13 @@ class Migrator extends Base_Installer {
|
||||
}
|
||||
|
||||
$customer = wu_create_customer(
|
||||
array(
|
||||
[
|
||||
'user_id' => $user->user_id,
|
||||
'email_verification' => 'verified',
|
||||
'vip' => false,
|
||||
'date_registered' => $user->created_at,
|
||||
'last_login' => $user->created_at,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (is_wp_error($customer)) {
|
||||
@ -1555,9 +1555,9 @@ class Migrator extends Base_Installer {
|
||||
|
||||
$product = wu_get_product_by('migrated_from_id', absint($subscription->plan_id));
|
||||
|
||||
$v1_subscription_meta = (object) ($subscription->meta ? maybe_unserialize($subscription->meta) : array());
|
||||
$v1_subscription_meta = (object) ($subscription->meta ? maybe_unserialize($subscription->meta) : []);
|
||||
|
||||
$membership_data = array();
|
||||
$membership_data = [];
|
||||
|
||||
if ( ! $product) {
|
||||
$this->add_id_of_interest($subscription->plan_id, 'plan_not_migrated', 'memberships');
|
||||
@ -1738,8 +1738,8 @@ class Migrator extends Base_Installer {
|
||||
$membership_data['times_billed'] = absint($payments_count);
|
||||
|
||||
$membership_data = array_merge(
|
||||
$product ? $product->to_array() : array(),
|
||||
$customer ? $customer->to_array() : array(),
|
||||
$product ? $product->to_array() : [],
|
||||
$customer ? $customer->to_array() : [],
|
||||
$membership_data
|
||||
);
|
||||
|
||||
@ -1822,17 +1822,17 @@ class Migrator extends Base_Installer {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
$types_to_skip = array(
|
||||
$types_to_skip = [
|
||||
'recurring_setup',
|
||||
'cancel',
|
||||
);
|
||||
];
|
||||
|
||||
$map_status = array(
|
||||
$map_status = [
|
||||
'payment' => Payment_Status::COMPLETED,
|
||||
'failed' => Payment_Status::FAILED,
|
||||
'refund' => Payment_Status::REFUND,
|
||||
'pending' => Payment_Status::PENDING,
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($transactions as $transaction) {
|
||||
/*
|
||||
@ -1857,10 +1857,10 @@ class Migrator extends Base_Installer {
|
||||
}
|
||||
|
||||
$line_item = new \WP_Ultimo\Checkout\Line_Item(
|
||||
array(
|
||||
[
|
||||
'product' => $product,
|
||||
'quantity' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$line_item->set_title($transaction->description);
|
||||
@ -1870,11 +1870,11 @@ class Migrator extends Base_Installer {
|
||||
$line_item->set_subtotal(wu_to_float($transaction->amount));
|
||||
$line_item->set_total(wu_to_float($transaction->amount));
|
||||
|
||||
$line_items = array(
|
||||
$line_items = [
|
||||
$line_item->get_id() => $line_item,
|
||||
);
|
||||
];
|
||||
|
||||
$payment_data = array(
|
||||
$payment_data = [
|
||||
'parent' => 0,
|
||||
'line_items' => $line_items,
|
||||
'status' => wu_get_isset($map_status, $transaction->type, Payment_Status::COMPLETED),
|
||||
@ -1892,7 +1892,7 @@ class Migrator extends Base_Installer {
|
||||
'migrated_from_id' => $transaction->id,
|
||||
'date_created' => $transaction->time,
|
||||
'date_modified' => $transaction->time,
|
||||
);
|
||||
];
|
||||
|
||||
if ( ! $customer) {
|
||||
$this->add_id_of_interest($transaction->user_id, 'customer_not_migrated', 'transactions');
|
||||
@ -1963,7 +1963,7 @@ class Migrator extends Base_Installer {
|
||||
|
||||
$limit_products = false;
|
||||
|
||||
$allowed_products = array();
|
||||
$allowed_products = [];
|
||||
|
||||
if ($allowed_plans) {
|
||||
$limit_products = true;
|
||||
@ -1977,7 +1977,7 @@ class Migrator extends Base_Installer {
|
||||
}
|
||||
}
|
||||
|
||||
$discount_code_data = array(
|
||||
$discount_code_data = [
|
||||
'uses' => get_post_meta($coupon->ID, 'wpu_uses', true),
|
||||
'max_uses' => get_post_meta($coupon->ID, 'wpu_allowed_uses', true),
|
||||
'name' => $coupon->name,
|
||||
@ -1994,7 +1994,7 @@ class Migrator extends Base_Installer {
|
||||
'date_created' => $coupon->date_create,
|
||||
'date_modified' => $coupon->post_modified,
|
||||
'skip_validation' => true,
|
||||
);
|
||||
];
|
||||
|
||||
/*
|
||||
* Fix the type name.
|
||||
@ -2111,19 +2111,19 @@ class Migrator extends Base_Installer {
|
||||
require_once wu_path('inc/functions/membership.php');
|
||||
require_once wu_path('inc/functions/site.php');
|
||||
|
||||
$skip_ids = array();
|
||||
$skip_ids = [];
|
||||
|
||||
/*
|
||||
* First thing, add the main site to the skip list.
|
||||
*/
|
||||
$skip_ids[] = wu_get_main_site_id();
|
||||
|
||||
$search_arguments = array(
|
||||
$search_arguments = [
|
||||
'network_id' => get_current_site()->id,
|
||||
'fields' => 'ids',
|
||||
'site__not_in' => $skip_ids,
|
||||
'no_found_rows' => true,
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->dry_run) {
|
||||
$per_page = 10;
|
||||
@ -2185,9 +2185,9 @@ class Migrator extends Base_Installer {
|
||||
*/
|
||||
wu_enqueue_async_action(
|
||||
'wu_async_take_screenshot',
|
||||
array(
|
||||
[
|
||||
'site_id' => $site_template->get_id(),
|
||||
),
|
||||
],
|
||||
'site'
|
||||
);
|
||||
}
|
||||
@ -2267,14 +2267,14 @@ class Migrator extends Base_Installer {
|
||||
}
|
||||
|
||||
$domain = wu_create_domain(
|
||||
array(
|
||||
[
|
||||
'stage' => 'done',
|
||||
'domain' => $domain->name,
|
||||
'blog_id' => $domain->blog_id,
|
||||
'active' => $domain->active,
|
||||
'primary_domain' => true,
|
||||
'secure' => $https,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (is_wp_error($domain)) {
|
||||
@ -2306,12 +2306,12 @@ class Migrator extends Base_Installer {
|
||||
return;
|
||||
}
|
||||
|
||||
$checkout_form = array(
|
||||
$checkout_form = [
|
||||
'name' => __('Signup Form', 'wp-ultimo'),
|
||||
'slug' => 'main-form',
|
||||
'allowed_countries' => $this->get_old_setting('allowed_countries', array()),
|
||||
'settings' => array(),
|
||||
);
|
||||
'allowed_countries' => $this->get_old_setting('allowed_countries', []),
|
||||
'settings' => [],
|
||||
];
|
||||
|
||||
$status = wu_create_checkout_form($checkout_form);
|
||||
|
||||
@ -2342,14 +2342,14 @@ class Migrator extends Base_Installer {
|
||||
/*
|
||||
* Create the page on the main site.
|
||||
*/
|
||||
$post_details = array(
|
||||
$post_details = [
|
||||
'post_name' => $page_slug,
|
||||
'post_title' => __('Signup', 'wp-ultimo'),
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
'post_content' => sprintf($post_content, $status->get_slug()),
|
||||
'post_author' => get_current_user_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$page_id = wp_insert_post($post_details);
|
||||
|
||||
@ -2382,14 +2382,14 @@ class Migrator extends Base_Installer {
|
||||
/*
|
||||
* Create the page on the main site.
|
||||
*/
|
||||
$login_post_details = array(
|
||||
$login_post_details = [
|
||||
'post_name' => $login_page_slug,
|
||||
'post_title' => __('Login', 'wp-ultimo'),
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
'post_content' => '',
|
||||
'post_author' => get_current_user_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$login_page_id = wp_insert_post($login_post_details);
|
||||
|
||||
@ -2484,23 +2484,23 @@ class Migrator extends Base_Installer {
|
||||
$product_targets
|
||||
);
|
||||
|
||||
$targets = array(
|
||||
$targets = [
|
||||
'customers' => array_filter($customer_targets),
|
||||
'products' => array_filter($product_targets),
|
||||
);
|
||||
];
|
||||
|
||||
$broadcast = wu_create_broadcast(
|
||||
array(
|
||||
[
|
||||
'name' => $broadcast->post_title,
|
||||
'content' => $broadcast->post_content,
|
||||
'type' => $new_type,
|
||||
'style' => $style ? $style : 'success',
|
||||
'style' => $style ?: 'success',
|
||||
'date_created' => $broadcast->post_date,
|
||||
'date_modified' => $broadcast->post_modified,
|
||||
'message_targets' => $targets,
|
||||
'migrated_from_id' => $broadcast->ID,
|
||||
'skip_validation' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (is_wp_error($broadcast)) {
|
||||
@ -2538,7 +2538,7 @@ class Migrator extends Base_Installer {
|
||||
|
||||
foreach ($webhooks as $webhook) {
|
||||
$webhook = wu_create_webhook(
|
||||
array(
|
||||
[
|
||||
'name' => $webhook->post_title,
|
||||
'migrated_from_id' => $webhook->ID,
|
||||
'webhook_url' => get_post_meta($webhook->ID, 'wpu_url', true),
|
||||
@ -2546,7 +2546,7 @@ class Migrator extends Base_Installer {
|
||||
'active' => (bool) get_post_meta($webhook->ID, 'wpu_active', true),
|
||||
'date_created' => $webhook->post_date,
|
||||
'date_modified' => $webhook->post_modified,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (is_wp_error($webhook)) {
|
||||
|
Reference in New Issue
Block a user