/** * @return array */ public function sync() { $response = ['success' => true, 'message' => '']; $this->start = microtime(true); $websites = $this->helper->getWebsites(true); $started = false; foreach ($websites as $website) { //if subscriber is enabled and mapped $apiEnabled = $this->helper->isEnabled($website->getid()); $subscriberEnaled = $this->helper->isSubscriberSyncEnabled($website->getid()); $addressBook = $this->helper->getSubscriberAddressBook($website->getId()); //enabled and mapped if ($apiEnabled && $addressBook && $subscriberEnaled) { //ready to start sync $numUpdated = $this->exportSubscribersPerWebsite($website); if ($this->countSubscriber && !$started) { $this->helper->log('---------------------- Start subscriber sync -------------------'); $started = true; } // show message for any number of customers if ($numUpdated) { $response['message'] .= '</br>' . $website->getName() . ', updated subscribers = ' . $numUpdated; } } } return $response; }