: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @subpackage Admin/Upgrades
* @copyright Copyright (c) 2023, Code Atlantic LLC
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
* Class PUM_Admin_Upgrade_Routine
class PUM_Admin_Upgrade_Routine {
* Describe the upgrade routine.
public static function description() {
* Run the upgrade routine.
public static function run() {
* Properly redirects or returns redirect url if DOING_AJAX.
* @param string $redirect
public static function redirect( $redirect = '' ) {
wp_safe_redirect( $redirect );
* Generate the next step ajax response or redirect.
public static function next_step() {
$upgrades = PUM_Admin_Upgrades::instance();
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
'status' => sprintf( __( 'Step %1$d of approximately %2$d running', 'popup-maker' ), $upgrades->get_arg( 'step' ), $upgrades->get_arg( 'steps' ) ),
'next' => $upgrades->get_args(),
$redirect = add_query_arg( $upgrades->get_args(), admin_url() );
self::redirect( $redirect );
public static function done() {
$upgrades = PUM_Admin_Upgrades::instance();
delete_option( 'pum_doing_upgrade' );
$upgrades->set_upgrade_complete( $upgrades->current_routine() );
$upgrades->set_pum_db_ver( $upgrades->get_arg( 'pum-upgrade' ) );
$next_routine = $upgrades->next_routine();
if ( $upgrades->has_upgrades() && $next_routine && $upgrades->get_upgrade( $next_routine ) ) {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
$upgrades->set_arg( 'step', 1 );
$upgrades->set_arg( 'completed', 0 );
$upgrades->set_arg( 'pum-upgrade', $next_routine );
'status' => sprintf( '<strong>%s</strong>', $upgrades->get_upgrade( $next_routine ) ),
'next' => $upgrades->get_args(),