public function handle()
 {
     global $app;
     $this->countNew = 0;
     $this->countExisting = 0;
     $this->countSaved = 0;
     $this->countInPast = 0;
     $this->countToFarInFuture = 0;
     $this->countNotValid = 0;
     $this->importedEventsToEvents = new ImportedEventsToEvents();
     $this->importedEventsToEvents->setFromImportURlRun($this->importURLRun);
     $iurlr = new ImportURLResultModel();
     $iurlr->setIsSuccess(true);
     $iurlr->setMessage("Meetup data found");
     try {
         if ($this->eventId) {
             $meetupData = $this->getMeetupDataForEventID($this->eventId);
             if ($meetupData) {
                 $this->processMeetupData($meetupData);
             }
         } else {
             if ($this->groupName) {
                 foreach ($this->getMeetupDatasForGroupname($this->groupName) as $meetupData) {
                     $this->processMeetupData($meetupData);
                 }
             }
         }
     } catch (ImportURLMeetupHandlerAPIError $err) {
         $iurlr->setIsSuccess(false);
         $iurlr->setMessage("Meetup API error: " . $err->getCode() . " " . $err->getMessage());
     }
     // Now run the thing to make imported events real events!
     $this->importedEventsToEvents->run();
     $iurlr->setNewCount($this->countNew);
     $iurlr->setExistingCount($this->countExisting);
     $iurlr->setSavedCount($this->countSaved);
     $iurlr->setInPastCount($this->countInPast);
     $iurlr->setToFarInFutureCount($this->countToFarInFuture);
     $iurlr->setNotValidCount($this->countNotValid);
     return $iurlr;
 }
 public function handle()
 {
     global $app;
     $this->countNew = 0;
     $this->countExisting = 0;
     $this->countSaved = 0;
     $this->countInPast = 0;
     $this->countToFarInFuture = 0;
     $this->countNotValid = 0;
     $extension = $app['extensions']->getExtensionById('org.openacalendar.facebook');
     $appID = $app['appconfig']->getValue($extension->getAppConfigurationDefinition('app_id'));
     $appSecret = $app['appconfig']->getValue($extension->getAppConfigurationDefinition('app_secret'));
     $userToken = $app['appconfig']->getValue($extension->getAppConfigurationDefinition('user_token'));
     FacebookSession::setDefaultApplication($appID, $appSecret);
     $this->importedEventsToEvents = new ImportedEventsToEvents();
     $this->importedEventsToEvents->setFromImportURlRun($this->importURLRun);
     $iurlr = new ImportURLResultModel();
     $iurlr->setIsSuccess(true);
     $iurlr->setMessage("Facebook data found");
     if ($this->eventId && $appID && $appSecret && $userToken) {
         try {
             $fbData = $this->getFBDataForEventID($this->eventId);
             if ($fbData) {
                 $this->processFBData($this->eventId, $fbData);
             }
         } catch (FacebookAuthorizationException $err) {
             $iurlr->setIsSuccess(false);
             $iurlr->setMessage("Facebook API error: " . $err->getCode() . " " . $err->getMessage());
         }
     }
     // Now run the thing to make imported events real events!
     $this->importedEventsToEvents->run();
     $iurlr->setNewCount($this->countNew);
     $iurlr->setExistingCount($this->countExisting);
     $iurlr->setSavedCount($this->countSaved);
     $iurlr->setInPastCount($this->countInPast);
     $iurlr->setToFarInFutureCount($this->countToFarInFuture);
     $iurlr->setNotValidCount($this->countNotValid);
     return $iurlr;
 }