Пример #1
0
 /**
  * ContentPostProc-output hook to add typo3-pid header
  *
  * @param array $parameters Parameter
  * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $parent The parent object
  *
  * @return void
  */
 public function sendHeader(array $parameters, TypoScriptFrontendController $parent)
 {
     // Send Page pid which is used to issue BAN Command against
     if (GeneralUtility::getIndpEnv('TYPO3_REV_PROXY') == 1 || \Snowflake\Varnish\Utilities\GeneralUtility::getProperty('alwaysSendTypo3Headers') == 1) {
         header('TYPO3-Pid: ' . $parent->id);
         header('TYPO3-Sitename: ' . \Snowflake\Varnish\Utilities\GeneralUtility::getSitename());
     }
 }
Пример #2
0
 /**
  * ClearCache
  * Executed by the clearCachePostProc Hook
  *
  * @param string $cacheCmd Cache Command, see Description in t3lib_tcemain
  *
  * @return	void
  */
 public function clearCache($cacheCmd)
 {
     \Snowflake\Varnish\Utilities\GeneralUtility::devLog('clearCache', array('cacheCmd' => $cacheCmd));
     // if cacheCmd is a single Page, issue BAN Command on this pid
     // all other Commands ("page", "all") led to a BAN of the whole Cache
     $cacheCmd = intval($cacheCmd);
     $command = array($cacheCmd > 0 ? 'Varnish-Ban-TYPO3-Pid: ' . $cacheCmd : 'Varnish-Ban-All: 1', 'Varnish-Ban-TYPO3-Sitename: ' . \Snowflake\Varnish\Utilities\GeneralUtility::getSitename());
     $method = \Snowflake\Varnish\Utilities\GeneralUtility::getProperty('banRequestMethod') ? \Snowflake\Varnish\Utilities\GeneralUtility::getProperty('banRequestMethod') : 'BAN';
     // issue command on every Varnish Server
     /** @var $varnishHttp \Snowflake\Varnish\Http */
     $varnishHttp = GeneralUtility::makeInstance('Snowflake\\Varnish\\Http');
     foreach ($this->instanceHostnames as $currentHost) {
         $varnishHttp::addCommand($method, $currentHost, $command);
     }
 }
Пример #3
0
 /**
  * Execute cURL Multi-Handle Queue
  *
  * @return	void
  */
 protected static function runQueue()
 {
     GeneralUtility::devLog(__FUNCTION__);
     $running = NULL;
     do {
         curl_multi_exec(self::$curlQueue, $running);
     } while ($running);
     // destroy Handle which is not required anymore
     curl_multi_close(self::$curlQueue);
 }