get_licenses() ) { self::unschedule_all(); return; } if ( as_has_scheduled_action( Constants::CRON_JOB_LICENSE_VALIDATE, [], Constants::CRON_GROUP_ADVANCED_ADS ) ) { return; } as_schedule_recurring_action( time() + DAY_IN_SECONDS, DAY_IN_SECONDS, Constants::CRON_JOB_LICENSE_VALIDATE, [], Constants::CRON_GROUP_ADVANCED_ADS, true ); } /** * Cron callback: refresh the stored licenses, or stop once none are left (e.g. after a disconnect). * * A failed sync writes nothing, so the next run simply tries again. * * @return void */ public function sync(): void { if ( [] === License::get_instance()->get_licenses() ) { self::unschedule_all(); return; } License::get_instance()->sync(); } }