get_results(sprintf('SHOW TABLES FROM %s;', DB_NAME), ARRAY_N)); // phpcs:enable if (!in_array("{$wpdb->prefix}wu_domain_mappings", $tables, true)) { Core_Installer::get_instance()->_install_database_tables(); } // end if; return true; } // end if; return get_network_option(null, 'wu_setup_finished', false); } // end run_setup; /** * Checks for a test environment. * * @since 2.0.0 * @return boolean */ public static function is_unit_test() { return defined('WP_TESTS_MULTISITE') && WP_TESTS_MULTISITE; } // end is_unit_test; /** * Check if the PHP version requirements are met * * @since 2.0.0 */ public static function check_php_version(): bool { if (version_compare(phpversion(), self::$php_version, '<')) { add_action('network_admin_notices', array('WP_Ultimo\Requirements', 'notice_unsupported_php_version')); return false; } // end if; return true; } // end check_php_version; /** * Check if the WordPress version requirements are met * * @since 2.0.0 */ public static function check_wp_version(): bool { global $wp_version; if (version_compare($wp_version, self::$wp_version, '<')) { add_action('network_admin_notices', array('WP_Ultimo\Requirements', 'notice_unsupported_wp_version')); return false; } // end if; return true; } // end check_wp_version; /** * Check Cron Status * * Gets the current cron status by performing a test spawn. * Cached for one hour when all is well. * * Heavily inspired on Astra's test_cron check: * * @see astra/inc/theme-update/class-astra-theme-background-updater.php * * @since 2.0.0 * @return false if there is a problem spawning a call to WP-Cron system. */ public static function check_wp_cron(): bool { global $wp_version; if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) { return false; } // end if; if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) { return false; } // end if; $cached_status = get_site_transient('wp-ultimo-cron-test-ok'); if ($cached_status) { return true; } // end if; $sslverify = version_compare($wp_version, 4.0, '<'); $doing_wp_cron = sprintf('%.22F', microtime(true)); $cron_request = apply_filters('cron_request', array( // phpcs:ignore 'url' => site_url('wp-cron.php?doing_wp_cron=' . $doing_wp_cron), 'args' => array( 'timeout' => 3, 'blocking' => true, 'sslverify' => apply_filters('https_local_ssl_verify', $sslverify), // phpcs:ignore ), )); $result = wp_remote_post($cron_request['url'], $cron_request['args']); if (wp_remote_retrieve_response_code($result) >= 300) { return false; } // end if; set_transient('wp-ultimo-cron-test-ok', 1, HOUR_IN_SECONDS); return true; } // end check_wp_cron; /** * Check if the install is a Multisite install * * @since 2.0.0 */ public static function is_multisite(): bool { if (!is_multisite()) { add_action('admin_notices', array('WP_Ultimo\Requirements', 'notice_not_multisite')); return false; } // end if; return true; } // end is_multisite; /** * Check if WP Ultimo is network active. * * @since 2.0.0 */ public static function is_network_active(): bool { /** * Allow for developers to short-circuit this check. * * This is useful when using composer-based and other custom setups, * such as Bedrock, for example, where using plugins as mu-plugins * are the norm. * * @since 2.0.0 * @return bool */ $skip_network_activation_check = apply_filters('wp_ultimo_skip_network_active_check', wu_is_must_use()); if ($skip_network_activation_check) { return true; } // end if; if (!function_exists('is_plugin_active_for_network')) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } // end if; if (!is_plugin_active_for_network(WP_ULTIMO_PLUGIN_BASENAME) && !self::is_unit_test()) { add_action('admin_notices', array('WP_Ultimo\Requirements', 'notice_not_network_active')); return false; } // end if; return true; } // end is_network_active; /** * Adds a network admin notice about the PHP requirements not being met * * @since 2.0.0 * @return void */ public static function notice_unsupported_php_version() { // translators: the %1$s placeholder is the required PHP version, while the %2$s is the current PHP version. $message = sprintf(__('WP Ultimo requires at least PHP version %1$s to run. Your current PHP version is %2$s. Please, contact your hosting company support to upgrade your PHP version. If you want maximum performance consider upgrading your PHP to version 7.0 or later.', 'wp-ultimo'), self::$php_version, phpversion()); printf('
%s
%s
%s
%s