HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
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: //proc/self/cwd/wp-content/plugins/elementskit-lite/libs/xs-migration/initiator.php
<?php

namespace ElementsKit_Lite\Libs\Xs_Migration;

use ElementsKit_Lite\Traits\Singleton;

class Initiator {

	use Singleton;

	const OK_MIGRATION_LOGGER = 'ekit_migration_log';


	public function init() {

		add_filter('heartbeat_send', [$this, 'send_heartbeat'], 10, 2 );
		//add_filter('heartbeat_received', [$this, 'receive_heartbeat'], 10, 2);
		//add_filter( 'heartbeat_settings', [$this, 'heartbeat_settings'] );
	}


	public function send_heartbeat($response, $screen_id) {

		$txtDomain = 'elementskit-lite';
		$optionKey = 'data_migration_'.$txtDomain.'_log';

		$option = get_option($optionKey, []);

		if(empty($option['_last_version_scanned'])) {

			/**
			 * Migration never ran in this domain
			 *
			 */
			$migration = new Migration();

			$ret = $migration->input($txtDomain, '1.3.1', \ElementsKit_Lite::version());

			$response['migration_log'] = $ret;

			return $response;
		}

		/**
		 * We have last version of migration run
		 * checking if it is same as current version
		 */
		if($option['_last_version_scanned'] == \ElementsKit_Lite::version()) {

			$data[] = 'Migration has already run for this version - '. \ElementsKit_Lite::version();
			$data[] = $screen_id;

			$response['migration_push'] = $data;

			return $response;
		}

		/**
		 * We have started running migration for this version
		 * Or this is an update version that need to check migration run again
		 *
		 */
		$migration = new Migration();

		$ret = $migration->input($txtDomain, '1.3.1', \ElementsKit_Lite::version());

		$response['migration_log'] = $ret;

		return $response;
	}

	public function receive_heartbeat() {

	}


	public function heartbeat_settings() {

		$settings['interval'] = 15; //Anything between 15-120
		//$settings['autostart'] = false;

		return $settings;
	}

}