HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpprm_err/wp-content/plugins/wp-events-manager/inc/admin/upgrades/upgrade-2.1.php
<?php

if ( ! defined( 'ABSPATH' ) || ! defined( 'WPEMS_INSTALLING' ) || ! WPEMS_INSTALLING ) {
	exit();
}

/**
 * Update event date meta
 */
$event_args = array(
	'post_type'      => 'tp_event',
	'posts_per_page' => - 1,
	'post_status'    => 'any',
);
$events     = new WP_Query( $event_args );
if ( $events->have_posts() ) {
	while ( $events->have_posts() ) {
		$events->the_post();

		$status   = get_post_status( get_the_ID() );
		$metadata = '';
		switch ( $status ) {
			case 'tp-event-upcoming':
				$metadata = 'upcoming';
				break;
			case 'tp-event-happenning':
				$metadata = 'happening';
				break;
			case 'tp-event-expired':
				$metadata = 'expired';
				break;
			default:
				$metadata = $status;
				break;
		}

		update_post_meta( get_the_ID(), 'tp_event_status', $metadata );

		if ( in_array( $status, array( 'tp-event-upcoming', 'tp-event-happenning', 'tp-event-expired' ) ) ) {
			wp_update_post(
				array(
					'ID'          => get_the_ID(),
					'post_status' => 'publish',
				)
			);
		}
	}
	wp_reset_query();
}