actionScheduler->scheduleAsync( self::ACTION ); } /** * Cancel every queued chunk — used on deactivate. * * @since 4.0.0 * * @return void */ public static function cancelAll(): void { aioseo404To301()->actionScheduler->unscheduleAll( self::ACTION ); // Also clear any cron event left behind by a run under the fallback, or by a pre-port install. wp_clear_scheduled_hook( self::ACTION ); } /** * Build the URL that, when visited, installs Action Scheduler * via WordPress's own plugin installer. * * Used by the migration banner when AS isn't loaded but the * current user has `install_plugins`. Includes the nonce * `update.php` expects. * * @since 4.0.0 * * @return string Empty string when the current user lacks the cap. */ public static function installAsUrl(): string { if ( ! current_user_can( 'install_plugins' ) ) { return ''; } if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { return ''; } // Build the URL with raw `&` separators. `wp_nonce_url()` would // run the result through `esc_html()` (turning `&` into `&`), // which is right for a PHP-echoed HTML attribute but wrong here: // this URL is serialised into JSON and assigned to a React `href`, // where the entities are NOT decoded and the link breaks. Assemble // it with `add_query_arg()` so the separators stay literal. return add_query_arg( [ 'action' => 'install-plugin', 'plugin' => 'action-scheduler', '_wpnonce' => wp_create_nonce( 'install-plugin_action-scheduler' ) ], self_admin_url( 'update.php' ) ); } }