M:QDdUD*]QDdUdi!QDdUЮ+ [AQDdUsuQDdU+!QDdU.ID8R)BQDdUpQSTQDdUWQDdU*M:QDdU@hD=YQDdU <!QDdU8,RU'QDdU>&DdUSTQDdU5QDdUP %CQDdU @ .1?&DdU` 4>QDdU @0CUQDdU00y@QDdU0@\dQDdU@P*]QDdUdi!QDdU}IDPp[AQDdUP`suQDdU`+!QDdUFmpR)BQDdUppQSTQDdUWQDdU*nfQDdU pcXQDdU<^QDdU5QDdUP%CQDdU@.1?&DdU4>QDdU@CUQDdUpy@QDdU\dQDdU`=YQDdU<!QDdU}ID`U'QDdU`p>&DdUH?QDdUp>$,QDdU>x4kA+0+`Ix4kA@+x4kA+x4kA+`+.UAx4kA 'x4kA '+n.UApDdU>>M:QDdU@D*]QDdUdi!QDdUp,  [AQDdUsuQDdU+!QDdU.ID8R)BQDdUQSTQDdUWQDdU*M:QDdUhD=YQDdU <!QDdU ,@RU'QDdU0>&DdUSTQDdU5QDdUP %CQDdU @ .1?&DdU 4>QDdU @0CUQDdU0y@QDdU0@\dQDdU@P*]QDdUdi!QDdU}ID Pp[AQDdUP`suQDdU`+!QDdUFmpR)BQDdUpQSTQDdUWQDdU*M:QDdUD=YQDdU<!QDdU ,@U'QDdU0>&DdUSTQDdU5QDdUP%CQDdU@.1?&DdU4>QDdU@CUQDdUy@QDdU\dQDdU`=YQDdU<!QDdU}ID`U'QDdU`p>&DdUH?QDdUp>$,QDdU>x4kA,+Jx4kA+x4kA +x4kAp++@R.UAx4kA+x4kA+x4kA@++R.UApDdUess_Worker::ACTION_PROCESS, [ $this, 'migrate_event' ], ); remove_action( Process_Worker::ACTION_UNDO, [ $this, 'undo_event_migration' ] ); remove_action( Process_Worker::ACTION_CHECK_PHASE, [ $this, 'check_migration_phase' ], ); remove_action( Ajax::ACTION_REPORT, [ $this, 'send_report' ] ); remove_action( Ajax::ACTION_PAGINATE_EVENTS, [ $this, 'paginate_events' ] ); remove_action( Ajax::ACTION_START, [ $this, 'start_migration' ] ); remove_action( Ajax::ACTION_CANCEL, [ $this, 'cancel_migration' ] ); remove_action( Ajax::ACTION_REVERT, [ $this, 'revert_migration' ] ); remove_action( 'action_scheduler_bulk_cancel_actions', [ $this, 'cancel_async_actions' ] ); remove_action( 'action_scheduler_canceled_action', [ $this, 'cancel_async_action' ] ); remove_action( 'admin_enqueue_scripts', $this->container->callback( Asset_Loader::class, 'enqueue_scripts' ) ); remove_filter( 'tec_events_upgrade_tab_has_content', [ $this, 'show_upgrade_tab' ] ); remove_filter( 'tribe_upgrade_fields', [ $this, 'remove_phase_callback' ] ); } /** * Executes one step of the migration process to migrate, or preview * the migration of, one Event. * * @since 6.0.0 * * @param int $post_id The post ID of the Event to migrate. * @param bool $dry_run Whether the step should be executed in dry-run mode or not. * * @return void The method does not return any value but will trigger the action * that will migrate the Event. */ public function migrate_event( $post_id, $dry_run = false ) { $this->container->make( Process_Worker::class )->migrate_event( $post_id, $dry_run ); } /** * Executes a check on the current migration phase state to transition it to the correct * one if no Worker took care of that. * * @since 6.0.0 * * @return void The method does not return any value and will have the side-effect of * updating the phase, if completed. */ public function check_migration_phase() { $this->container->make( Process_Worker::class )->check_phase_complete(); } /** * Executes one step of the migration process to undo the migration of one Event. * * @since 6.0.0 * * @param array The metadata the worker passes itself to track state. * * @return void The method does not return any value but will trigger the action * that will undo the Event migration. */ public function undo_event_migration( $meta = [] ) { $this->container->make( Process_Worker::class )->undo_event_migration( $meta ); } /** * Respond to canceled Action Scheduler actions. * * @since 6.0.0 * * @param numeric $action_id The action scheduler action ID. */ public function cancel_async_action( $action_id ) { $this->container->make( Process::class )->cancel_async_action( $action_id ); } /** * Respond to bulk canceled Action Scheduler actions. * * @since 6.0.0 * * @param array $action_id A list of the action scheduler action IDs. */ public function cancel_async_actions( $action_ids ) { if ( ! is_array( $action_ids ) ) { return; } $this->container->make( Process::class )->cancel_async_actions( $action_ids ); } /** * Sends (echoes) a JSON format report of the site migration. * * @since 6.0.0 * * @return void The method does not return any value and will have the side effect * of echoing a JSON format string back for the Migration UI JS component * to consume. */ public function send_report() { return $this->container->make( Ajax::class )->send_report(); } /** * Sends (echoes) a JSON format report of a batch of paginated events. * * @since 6.0.0 * * @return void The method does not return any value and will have the side effect * of echoing a JSON format string back for the Migration UI JS component * to consume. */ public function paginate_events() { return $this->container->make( Ajax::class )->paginate_events(); } /** * Starts the migration and sends the initial report. * * @since 6.0.0 * * @return void The method does not return any value and will have the side effect * of echoing a JSON format string back for the Migration UI JS component * to consume. */ public function start_migration() { $this->container->make( Ajax::class )->start_migration(); } /** * Stops the migration and sends the final report. * * @since 6.0.0 * * @return void The method does not return any value and will have the side effect * of echoing a JSON format string back for the Migration UI JS component * to consume. */ public function cancel_migration() { $this->container->make( Ajax::class )->cancel_migration(); } /** * Undoes the migration and sends the initial report. * * @since 6.0.0 * * @return void The method does not return any value and will have the side effect * of echoing a JSON format string back for the Migration UI JS component * to consume. */ public function revert_migration() { $this->container->make( Ajax::class )->revert_migration(); } /** * Activate the Event-only maintenance mode, if required by the current * migration state. * * @since 6.0.0 * * @return void The method does not return any value and will have the side * effect of putting the site Events, and related data, in maintenance * mode. */ public function activate_maintenance_mode() { $this->container->make( Maintenance_Mode::class )->activate(); } /** * Filters whether the Upgrade tab, hosting the migration report, should show or not. * * @since 6.0.0 * * @param bool $show_tab The initial value as worked out by TEC and other plugins. * * @return bool Whether the Upgrade tab should show or not. A logic OR on the input * value depending on the Migration state. */ public function show_upgrade_tab( $show_tab ) { return $show_tab || $this->container->make( Upgrade_Tab::class )->should_show(); } /** * Filters the Upgrade tab fields to add the ones dedicated to the Migration. * * @since 6.0.0 * * @param array $upgrade_fields The Upgrade page fields, as set up * by The Events Calendar and other plugins. * * @return array The filtered Upgrade tab fields, including the fields * dedicated to Migration. */ public function add_phase_callback( $upgrade_fields ) { return $this->container->make( Upgrade_Tab::class )->add_phase_content( $upgrade_fields ); } /** * Loads Action Scheduler late, after the `plugins_loaded` hook, at the * start of the `init` one. * * Action Scheduler does support loading after the `plugins_loaded` hook, but * not during it. The provider will register exactly during the `plugins_loaded` * action, so we need to retry setting up Action Scheduler again. * * @since 6.0.0 * * @deprecated 6.9.1 Deprecate this method in point to the AS included in common. */ public function load_action_scheduler_late() { _deprecated_function( __METHOD__, '6.9.1' ); $action_scheduler_file = TEC::instance()->plugin_path . '/common/vendor/woocommerce/action-scheduler/action-scheduler.php'; require_once $action_scheduler_file; } /** * Piggy-back on the Migration UI JS component polling of the backend to migrate some events, if possible. * * @since 6.0.2 * * @return void Some Events might be migrated. */ public function migrate_events_on_js_poll(): void { if ( ! in_array( $this->container->make( State::class )->get_phase(), [ State::PHASE_MIGRATION_IN_PROGRESS, State::PHASE_PREVIEW_IN_PROGRESS ] ) ) { return; } /** * Filters how many Events should be migrated in a single AJAX request to the Migration UI backend. * * @since 6.0.2 * * @param int $count The number of Events to migrate on the migration UI JS component polling; returning * `0` will disable the functionality. */ $count = apply_filters( 'tec_events_custom_tables_v1_migration_js_poll_count', 10 ); if ( ! $count ) { return; } $this->container->make( Process_Worker::class )->migrate_many_events( $count ); } } xBDCh0HC9LVDCDCDChDCDCh`BBcB@:C