Пример #1
0
 /**
  * Makes sure that the AOP proxies are rebuilt if a policy has changed.
  *
  * Note: This is not an advice but a method which is used as a slot for a signal
  *       sent by the system file monitor defined in the bootstrap scripts.
  *
  * @param string $fileMonitorIdentifier Identifier of the File Monitor
  * @param array $changedFiles A list of full paths to changed files
  * @return void
  */
 public function triggerAopProxyRebuildingByChangedFiles($fileMonitorIdentifier, array $changedFiles)
 {
     if ($fileMonitorIdentifier !== 'FLOW3_PolicyFiles') {
         return;
     }
     $this->systemLogger->log('The security policies have changed, thus triggering an AOP proxy class rebuild.', LOG_INFO);
     $this->flushCachesByTag(\TYPO3\FLOW3\Cache\CacheManager::getClassTag());
     $this->flushCachesByTag(\TYPO3\FLOW3\Cache\CacheManager::getClassTag('TYPO3\\FLOW3\\Security\\Aspect\\PolicyEnforcementAspect'));
 }
Пример #2
0
 /**
  * Factory method which creates the specified cache along with the specified kind of backend.
  * After creating the cache, it will be registered at the cache manager.
  *
  * @param string $cacheIdentifier The name / identifier of the cache to create
  * @param string $cacheObjectName Object name of the cache frontend
  * @param string $backendObjectName Object name of the cache backend
  * @param array $backendOptions (optional) Array of backend options
  * @return \TYPO3\FLOW3\Cache\Frontend\FrontendInterface The created cache frontend
  * @throws \TYPO3\FLOW3\Cache\Exception\InvalidBackendException
  * @throws \TYPO3\FLOW3\Cache\Exception\InvalidCacheException
  * @api
  */
 public function create($cacheIdentifier, $cacheObjectName, $backendObjectName, array $backendOptions = array())
 {
     $backend = new $backendObjectName($this->context, $backendOptions);
     if (!$backend instanceof \TYPO3\FLOW3\Cache\Backend\BackendInterface) {
         throw new \TYPO3\FLOW3\Cache\Exception\InvalidBackendException('"' . $backendObjectName . '" is not a valid cache backend object.', 1216304301);
     }
     $backend->injectEnvironment($this->environment);
     if (is_callable(array($backend, 'initializeObject'))) {
         $backend->initializeObject(\TYPO3\FLOW3\Object\ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED);
     }
     $cache = new $cacheObjectName($cacheIdentifier, $backend);
     if (!$cache instanceof \TYPO3\FLOW3\Cache\Frontend\FrontendInterface) {
         throw new \TYPO3\FLOW3\Cache\Exception\InvalidCacheException('"' . $cacheObjectName . '" is not a valid cache frontend object.', 1216304300);
     }
     if (is_callable(array($cache, 'initializeObject'))) {
         $cache->initializeObject(\TYPO3\FLOW3\Object\ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED);
     }
     $this->cacheManager->registerCache($cache);
     return $cache;
 }
Пример #3
0
 /**
  * Call system function
  *
  * @FLOW3\Internal
  * @param integer $address
  * @return void
  */
 public function sysCommand($address)
 {
     if ($address === 64738) {
         $this->cacheManager->flushCaches();
         $content = "G1syShtbMkobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgKioqKiBDT01NT0RPUkUgNjQgQkFTSUMgVjIgKioqKiAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gIDY0SyBSQU0gU1lTVEVNICAzODkxMSBCQVNJQyBCWVRFUyBGUkVFICAgG1swbQobWzE7MzdtG1sxOzQ0bSBSRUFEWS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIEZMVVNIIENBQ0hFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSBPSywgRkxVU0hFRCBBTEwgQ0FDSEVTLiAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIFJFQURZLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gG1sxOzQ3bSAbWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQoK";
         $this->response->setOutputFormat(Response::OUTPUTFORMAT_RAW);
         $this->response->appendContent(base64_decode($content));
         if ($this->lockManager->isSiteLocked()) {
             $this->lockManager->unlockSite();
         }
         $this->sendAndExit(0);
     }
 }
Пример #4
0
 /**
  * Explicitly compile proxy classes
  *
  * The compile command triggers the proxy class compilation.
  * Although a compilation run is triggered automatically by FLOW3, there might
  * be cases in a production context where a manual compile run is needed.
  *
  * @FLOW3\Internal
  * @param boolean $force If set, classes will be compiled even though the cache says that everything is up to date.
  * @return void
  */
 public function compileCommand($force = FALSE)
 {
     $objectConfigurationCache = $this->cacheManager->getCache('FLOW3_Object_Configuration');
     if ($force === FALSE) {
         if ($objectConfigurationCache->has('allCompiledCodeUpToDate')) {
             return;
         }
     }
     $classesCache = $this->cacheManager->getCache('FLOW3_Object_Classes');
     $this->proxyClassCompiler->injectClassesCache($classesCache);
     $this->aopProxyClassBuilder->injectObjectConfigurationCache($objectConfigurationCache);
     $this->aopProxyClassBuilder->build();
     $this->dependencyInjectionProxyClassBuilder->build();
     $classCount = $this->proxyClassCompiler->compile();
     $objectConfigurationCache->set('allCompiledCodeUpToDate', TRUE);
     $classesCacheBackend = $classesCache->getBackend();
     if ($this->bootstrap->getContext()->isProduction() && $classesCacheBackend instanceof FreezableBackendInterface) {
         $classesCache->getBackend()->freeze();
     }
     $this->emitFinishedCompilationRun($classCount);
 }
Пример #5
0
 /**
  * Injects the Cache Manager because we cannot inject an automatically factored cache during compile time.
  *
  * @param \TYPO3\FLOW3\Cache\CacheManager $cacheManager
  * @return void
  */
 public function injectCacheManager(\TYPO3\FLOW3\Cache\CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('FLOW3_Security_Policy');
 }
Пример #6
0
 /**
  * @test
  */
 public function getClassTagRendersTagWhichCanBeUsedToTagACacheEntryWithACertainClass()
 {
     $identifier = 'someCacheIdentifier';
     $backend = $this->getMock('TYPO3\\FLOW3\\Cache\\Backend\\AbstractBackend', array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', FALSE);
     $this->getMock('TYPO3\\FLOW3\\Cache\\Frontend\\StringFrontend', array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
     $this->assertEquals('%CLASS%TYPO3_Foo_Bar_Baz', \TYPO3\FLOW3\Cache\CacheManager::getClassTag('TYPO3\\Foo\\Bar\\Baz'));
 }