connector = $connector; $this->configWriter = $configWriter; $this->reinitableConfig = $reinitableConfig; $this->flagManager = $flagManager; $this->analyticsToken = $analyticsToken; } /** * Execute scheduled update operation * * @return bool */ public function execute() { $result = false; $attemptsCount = $this->flagManager ->getFlagData(SubscriptionUpdateHandler::SUBSCRIPTION_UPDATE_REVERSE_COUNTER_FLAG_CODE); if ($attemptsCount) { $attemptsCount -= 1; $result = $this->connector->execute('update'); } if ($result || ($attemptsCount <= 0) || (!$this->analyticsToken->isTokenExist())) { $this->flagManager ->deleteFlag(SubscriptionUpdateHandler::SUBSCRIPTION_UPDATE_REVERSE_COUNTER_FLAG_CODE); $this->flagManager->deleteFlag(SubscriptionUpdateHandler::PREVIOUS_BASE_URL_FLAG_CODE); $this->configWriter->delete(SubscriptionUpdateHandler::UPDATE_CRON_STRING_PATH); $this->reinitableConfig->reinit(); } return $result; } }