Follow these instructions to do it manually.'), wu_get_documentation_url('wp-ultimo-closte-config')); throw new \Exception($closte_message); } // end if; return true; } // end if; return false; }); } // end init; /** * Returns the list of migration steps. * * @since 2.0.0 * @return array */ public function get_steps() { $has_tables_installed = \WP_Ultimo\Loaders\Table_Loader::get_instance()->is_installed(); $steps = array(); $steps['database_tables'] = array( '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'), 'pending' => __('Pending', 'wp-ultimo'), 'installing' => __('Creating default tables...', 'wp-ultimo'), 'success' => __('Success!', 'wp-ultimo'), 'help' => wu_get_documentation_url('installation-errors'), ); $steps['sunrise'] = array( 'done' => defined('SUNRISE') && SUNRISE && defined('WP_ULTIMO_SUNRISE_VERSION'), 'title' => __('Install sunrise.php 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'), 'pending' => __('Pending', 'wp-ultimo'), 'installing' => __('Installing sunrise file...', 'wp-ultimo'), 'success' => __('Success!', 'wp-ultimo'), 'help' => wu_get_documentation_url('installation-errors'), ); return $steps; } // end get_steps; /** * Installs our custom database tables. * * @since 2.0.0 * @throws \Exception When an error occurs during the creation. * @return void */ public function _install_database_tables() { $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( 'site_table', 'sitemeta_table', ); if (in_array($table_name, $exclude_list, true)) { continue; } // end if; $success = $table->install(); if ($success === false) { // translators: %s is the name of a database table, e.g. wu_memberships. $error_message = sprintf(__('Installation of the table %s failed', 'wp-ultimo'), $table->get_name()); throw new \Exception($error_message); } // end if; } // end foreach; } // end _install_database_tables; /** * Copies the sunrise.php file and adds the SUNRISE constant. * * @since 2.0.0 * @throws \Exception When sunrise copying fails. * @return void */ public function _install_sunrise() { $copy = \WP_Ultimo\Sunrise::try_upgrade(); if (is_wp_error($copy)) { throw new \Exception($copy->get_error_message()); } // end if; /** * Allow host providers to install the constant differently. * * Returning true will prevent WP Multisite WaaS from trying to write to the wp-config file. * * @since 2.0.0 * @param bool $short_circuit */ $short_circuit = apply_filters('wu_core_installer_install_sunrise', false); if ($short_circuit) { return; } // end if; $success = \WP_Ultimo\Helpers\WP_Config::get_instance()->inject_wp_config_constant('SUNRISE', true); if (is_wp_error($success)) { throw new \Exception($success->get_error_message()); } // end if; } // end _install_sunrise; } // end class Core_Installer;