installer = $installer; } /** * {@inheritdoc} */ public function register(): void { // Priority 15: after tools that switch the table prefix on `init` (for example Plugin Check's runtime checks), // and before our own database work at priority 20. add_action( 'init', array( $this->installer, 'maybe_upgrade' ), 15 ); add_action( 'wp_initialize_site', array( $this->installer, 'install_new_site' ) ); add_action( 'admin_notices', array( $this, 'render_error_notice' ) ); } /** * Prints the migration error, if any. * * @since 0.1.0 * * @return void */ public function render_error_notice(): void { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; // Only on the InterviewNea screen, only for people who can fix it, and only while the error exists. if ( ! $screen || ! Menu::is_app_screen( $screen->id ) || ! Capabilities::can_manage() ) { return; } $error = $this->installer->last_error(); if ( '' === $error ) { return; } printf( '
%s