installer = $installer; } /** * {@inheritdoc} */ public function register(): void { add_action( 'init', array( $this->installer, 'maybe_upgrade' ), 5 ); add_action( 'wp_initialize_site', array( $this->installer, 'install_new_site' ) ); add_action( 'admin_notices', array( $this, 'render_error_notice' ) ); } /** * Tells administrators when the database could not be set up. * * @since 0.1.0 * * @return void */ public function render_error_notice(): void { if ( ! current_user_can( Capabilities::ACCESS_APP ) ) { return; } $error = $this->installer->last_error(); if ( '' === $error ) { return; } printf( '
%s