コード例 #1
0
 /**
  * Clears the cache of configured pages in TypoScript
  *
  * @param array $settings The settings
  *
  * @return void
  */
 public function clearCacheForConfiguredUids($settings)
 {
     $pidList = $this->settingsService->getClearCacheUids($settings);
     if (count($pidList) > 0) {
         $this->cacheService->clearPageCache($pidList);
     }
 }
コード例 #2
0
 /**
  * @test
  */
 public function clearPageCacheUsesCacheManagerToFlushCacheOfSpecifiedPages()
 {
     $this->cacheManagerMock->expects($this->at(0))->method('flushCachesInGroupByTag')->with('pages', 'pageId_1');
     $this->cacheManagerMock->expects($this->at(1))->method('flushCachesInGroupByTag')->with('pages', 'pageId_2');
     $this->cacheManagerMock->expects($this->at(2))->method('flushCachesInGroupByTag')->with('pages', 'pageId_3');
     $this->cacheService->clearPageCache(array(1, 2, 3));
 }
コード例 #3
0
 /**
  * The cleanup command
  *
  * @return void
  */
 public function cleanupCommand()
 {
     $fullSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT, 'SfEventMgt', 'Pievent');
     $settings = $fullSettings['plugin.']['tx_sfeventmgt.']['settings.'];
     $this->registrationService->handleExpiredRegistrations($settings['registration.']['deleteExpiredRegistrations']);
     $pidList = explode(',', $settings['clearCacheUids']);
     $this->cacheService->clearPageCache($pidList);
 }
コード例 #4
0
 /**
  * Clear cache of current page on error. Needed because we want a re-evaluation of the data.
  * Better would be just do delete the cache for the error action, but that is not possible right now.
  *
  * @return void
  */
 protected function clearCacheOnError()
 {
     $extbaseSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     if (isset($extbaseSettings['persistence']['enableAutomaticCacheClearing']) && $extbaseSettings['persistence']['enableAutomaticCacheClearing'] === '1') {
         if (isset($GLOBALS['TSFE'])) {
             $pageUid = $GLOBALS['TSFE']->id;
             $this->cacheService->clearPageCache(array($pageUid));
         }
     }
 }
コード例 #5
0
 /**
  * Clear the cachePageEntries of the given tt_content entries
  * 
  * @param array $ttContentEntries
  * @return count of cleared pages
  */
 protected function clearPageCacheEntries(array $ttContentEntries)
 {
     $pageIdsToClear = array();
     /* @var $ttContentEntry Tx_Yag_Domain_Model_Extern_TTContent */
     foreach ($ttContentEntries as $ttContentEntry) {
         $pageIdsToClear[] = $ttContentEntry->getPid();
     }
     $this->cacheService->clearPageCache($pageIdsToClear);
     return count($pageIdsToClear);
 }
コード例 #6
0
 /**
  * Saves the registration
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event
  * @validate $registration \DERHANSEN\SfEventMgt\Validation\Validator\RegistrationValidator
  *
  * @return void
  */
 public function saveRegistrationAction(Registration $registration, Event $event)
 {
     $autoConfirmation = (bool) $this->settings['registration']['autoConfirmation'];
     $result = RegistrationResult::REGISTRATION_SUCCESSFUL;
     $success = $this->checkRegistrationSuccess($event, $registration, $result);
     // Save registration if no errors
     if ($success) {
         $linkValidity = (int) $this->settings['confirmation']['linkValidity'];
         if ($linkValidity === 0) {
             // Use 3600 seconds as default value if not set
             $linkValidity = 3600;
         }
         $confirmationUntil = new \DateTime();
         $confirmationUntil->add(new \DateInterval('PT' . $linkValidity . 'S'));
         $registration->setEvent($event);
         $registration->setPid($event->getPid());
         $registration->setConfirmationUntil($confirmationUntil);
         $registration->_setProperty('_languageUid', $GLOBALS['TSFE']->sys_language_uid);
         $this->registrationRepository->add($registration);
         // Persist registration, so we have an UID
         $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll();
         // Send notifications to user and admin if confirmation link should be sent
         if (!$autoConfirmation) {
             $this->notificationService->sendUserMessage($event, $registration, $this->settings, MessageType::REGISTRATION_NEW);
             $this->notificationService->sendAdminMessage($event, $registration, $this->settings, MessageType::REGISTRATION_NEW);
         }
         // Create given amount of registrations if necessary
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->createDependingRegistrations($registration);
         }
         // Clear cache for configured pages
         $pidList = $this->settingsService->getClearCacheUids($this->settings);
         if (count($pidList) > 0) {
             $this->cacheService->clearPageCache($pidList);
         }
     }
     if ($autoConfirmation && $success) {
         $this->redirect('confirmRegistration', NULL, NULL, array('reguid' => $registration->getUid(), 'hmac' => $this->hashService->generateHmac('reg-' . $registration->getUid())));
     } else {
         $this->redirect('saveRegistrationResult', NULL, NULL, array('result' => $result));
     }
 }
コード例 #7
0
 /**
  * Helper function for flush frontend page cache
  *
  * Needed as we want to make sure new comments are visible after enabling in BE.
  *
  * @return void
  */
 protected function flushFrontendCache()
 {
     if (TYPO3_MODE === 'BE' && !empty($this->settings['blogsystem']['pid'])) {
         $this->cacheService->clearPageCache((int) $this->settings['blogsystem']['pid']);
     }
 }