GF_Background_Upgrader::class, self::FEEDS => GF_Feed_Processor::class, self::NOTIFICATIONS => GF_Notifications_Processor::class, self::TELEMETRY => GF_Telemetry_Processor::class, ); /** * Initializing the processors and adding them to the container as services. * * @since 2.6.9 * * @param GF_Service_Container $container */ public function register( GF_Service_Container $container ) { GFForms::init_background_upgrader(); require_once GF_PLUGIN_DIR_PATH . 'includes/addon/class-gf-feed-processor.php'; require_once GF_PLUGIN_DIR_PATH . 'includes/async/class-gf-notifications-processor.php'; require_once GF_PLUGIN_DIR_PATH . 'includes/telemetry/class-gf-telemetry-processor.php'; foreach ( $this->processors as $name => $class ) { $container->add( $name, function () use ( $name, $class ) { if ( $name === self::UPGRADER ) { return GFForms::$background_upgrader; } $callback = array( $class, 'get_instance' ); if ( is_callable( $callback ) ) { return call_user_func( $callback ); } return new $class(); } ); } } /** * Initializing hooks. * * @since 2.6.9 * * @param GF_Service_Container $container */ public function init( GF_Service_Container $container ) { $processors = array_keys( $this->processors ); add_action( 'gform_uninstalling', function () use ( $processors, $container ) { foreach ( $processors as $name ) { /** * @var GF_Background_Process $processor */ $processor = $container->get( $name ); $processor->clear_scheduled_events(); $processor->clear_queue( true ); $processor->unlock_process(); } } ); } }