/**
  * Removes all cache entries of this cache.
  *
  * @return void
  * @api
  */
 public function flush()
 {
     Files::emptyDirectoryRecursively($this->cacheDirectory);
 }
 /**
  * Does some emergency, forced, low level flush caches if the user told to do
  * so through the command line.
  *
  * @param Bootstrap $bootstrap
  * @return void
  */
 public static function forceFlushCachesIfNecessary(Bootstrap $bootstrap)
 {
     if (!isset($_SERVER['argv']) || !isset($_SERVER['argv'][1]) || !isset($_SERVER['argv'][2]) || !in_array($_SERVER['argv'][1], ['neos.flow:cache:flush', 'flow:cache:flush']) || !in_array($_SERVER['argv'][2], ['--force', '-f'])) {
         return;
     }
     $bootstrap->getEarlyInstance(CacheManager::class)->flushCaches();
     $environment = $bootstrap->getEarlyInstance(Environment::class);
     Files::emptyDirectoryRecursively($environment->getPathToTemporaryDirectory());
     echo 'Force-flushed caches for "' . $bootstrap->getContext() . '" context.' . PHP_EOL;
     // In production the site will be locked as this is a compiletime request so we need to take care to remove that lock again.
     if ($bootstrap->getContext()->isProduction()) {
         $bootstrap->getEarlyInstance(CoreLockManager::class)->unlockSite();
     }
     exit(0);
 }
 /**
  * Removes all cache entries of this cache and sets the frozen flag to FALSE.
  *
  * @return void
  * @api
  */
 public function flush()
 {
     Files::emptyDirectoryRecursively($this->cacheDirectory);
     if ($this->frozen === true) {
         @unlink($this->cacheDirectory . 'FrozenCache.data');
         $this->frozen = false;
     }
 }
 /**
  * Compiles the Doctrine proxy class code using the Doctrine ProxyFactory.
  *
  * @return void
  */
 public function compileProxies()
 {
     Files::emptyDirectoryRecursively(Files::concatenatePaths([$this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies']));
     /** @var \Doctrine\ORM\Proxy\ProxyFactory $proxyFactory */
     $proxyFactory = $this->entityManager->getProxyFactory();
     $proxyFactory->generateProxyClasses($this->entityManager->getMetadataFactory()->getAllMetadata());
 }
Exemple #5
0
 /**
  * @test
  * @expectedException \Neos\Utility\Exception\FilesException
  */
 public function emptyDirectoryRecursivelyThrowsExceptionIfSpecifiedPathDoesNotExist()
 {
     Files::emptyDirectoryRecursively('NonExistingPath');
 }