Remove cache files for managed locales.

@return \Symfony\Component\HttpFoundation\RedirectResponse
505038
public function invalidateCacheAction(Request $request)
    {
        $this->get('lexik_translation.translator')->removeLocalesCacheFiles($this->getManagedLocales());

        $message = $this->get('translator')->trans('translations.cache_removed', array(), 'LexikTranslationBundle');

        if ($request->isXmlHttpRequest()) {
            $this->checkCsrf();

            return new JsonResponse(array('message' => $message));
        }

        $this->get('session')->getFlashBag()->add('success', $message);

        return $this->redirect($this->generateUrl('lexik_translation_grid'));
    }
1349270
public function clear() {
        $children = $this->children();
        foreach ($children as $file) {
            $file->delete();
        }
        return $this;
    }
353905
public function destroyAll()
    {
        $cacheDir = $this->getDirectory();

        if (file_exists($cacheDir)) {
            $cacheFile = fopen($cacheDir, 'w');
            fclose($cacheFile);
        }

        return $this;
    }
825603
public function removeAction()
    {
        $params  = $this->params();
        $vendor  = $params->fromRoute( 'vendor' );
        $subname = $params->fromRoute( 'subname' );
        $name    = $vendor . '/' . $subname;
        $model   = $this->getServiceLocator()
                        ->get( 'Grid\Core\Model\Package\Model' );
        $package = $model->find( $name );

        if ( ! $model->getEnabledPackageCount() )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        if ( empty( $package ) )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        if ( ! $package->canRemove() )
        {
            $this->getResponse()
                 ->setStatusCode( 403 );

            return;
        }

        if ( ! $model->remove( $package ) )
        {
            $this->messenger()
                 ->add( 'admin.packages.remove.failed',
                        'admin', Message::LEVEL_ERROR );

            return $this->redirect()
                        ->toRoute( 'Grid\Core\Admin\Package\View', array(
                            'locale'    => (string) $this->locale(),
                            'vendor'    => $vendor,
                            'subname'   => $subname,
                        ) );
        }

        return $this->redirect()
                    ->toRoute( 'Grid\Core\Admin\Package\Update', array(
                        'locale' => (string) $this->locale(),
                    ) );
    }
252671
public function cleanup() {
    $this->say("Removing deprecated files and directories...");
    $this->taskFilesystemStack()
      ->remove([
        "build",
        "docroot/sites/default/settings/apcu_fix.yml",
        "docroot/sites/default/settings/base.settings.php",
        "docroot/sites/default/settings/blt.settings.php",
        "docroot/sites/default/settings/cache.settings.php",
        "docroot/sites/default/settings/filesystem.settings.php",
        "docroot/sites/default/settings/logging.settings.php",
        "docroot/sites/default/settings/travis.settings.php",
        "docroot/sites/default/settings/pipelines.settings.php",
        "docroot/sites/default/settings/tugboat.settings.php",
        "docroot/sites/settings/global.settings.default.php",
        "tests/phpunit/blt",
        "tests/phpunit/Bolt",
        "scripts/blt",
        "scripts/drupal",
        "scripts/drupal-vm",
        "scripts/git-hooks",
        "scripts/release-notes",
        "scripts/tugboat",
        "blt.sh",
        "project.yml",
        "project.local.yml",
        "example.project.local.yml",
        "readme/acsf-setup.md",
        "readme/architecture.md",
        "readme/best-practices.md",
        "readme/deploy.md",
        "readme/dev-workflow.md",
        "readme/features-workflow.md",
        "readme/local-development.md",
        "readme/onboarding.md",
        "readme/project-tasks.md",
        "readme/release-process.md",
        "readme/repo-architecture.md",
        "readme/views.md",
        "drush/policy.drush.inc",
      ])
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
  }
6569
public static function CleanCache(){
		static $clean = false;


		if( $clean || empty(Less_Cache::$cache_dir) ){
			return;
		}

		$clean = true;

		// only remove files with extensions created by less.php
		// css files removed based on the list files
		$remove_types = array('lesscache'=>1,'list'=>1,'less'=>1,'map'=>1);

		$files = scandir(Less_Cache::$cache_dir);
		if( !$files ){
			return;
		}

		$check_time = time() - self::$gc_lifetime;
		foreach($files as $file){


			// don't delete if the file wasn't created with less.php
			if( strpos($file,Less_Cache::$prefix) !== 0 ){
				continue;
			}

			$parts = explode('.',$file);
			$type = array_pop($parts);


			if( !isset($remove_types[$type]) ){
				continue;
			}

			$full_path = Less_Cache::$cache_dir . $file;
			$mtime = filemtime($full_path);

			// don't delete if it's a relatively new file
			if( $mtime > $check_time ){
				continue;
			}


			// delete the list file and associated css file
			if( $type === 'list' ){
				self::ListFiles($full_path, $list, $css_file_name);
				if( $css_file_name ){
					$css_file = Less_Cache::$cache_dir . $css_file_name;
					if( file_exists($css_file) ){
						unlink($css_file);
					}
				}
			}

			unlink($full_path);
		}


	}
725504
private function clean()
    {
        foreach (Finder::find($this->namespace . '*')->from($this->tempDir)->childFirst() as $entry) {
            $path = (string)$entry;
            if ($entry->isDir()) {
                //We dont use dirs, ignore
                continue;
            }

            $updateDate = $this->cache->load($entry->getFilename());
            if ($updateDate === null) {
                @unlink($path);
            }
        }

        return;
    }
698879
public function clear()
    {
        if (is_file($this->path)) {
            unlink($this->path);
        }

        $this->path = '';

        echo $this->path;

        return $this;
    }
114827
public static function clearCache()
    {
        $tempDirectory = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class)->getVar("sCompileDir");
        $mask = $tempDirectory . "/" . self::CACHE_FILE_PREFIX . ".*.txt";
        $files = glob($mask);
        if (is_array($files)) {
            foreach ($files as $file) {
                if (is_file($file)) {
                    @unlink($file);
                }
            }
        }
    }
1350897
public function eraseExpired() {
    $cacheData = $this->_loadCache();
    if (true === is_array($cacheData)) {
      $counter = 0;
      foreach ($cacheData as $key => $entry) {
        if (true === $this->_checkExpired($entry['time'], $entry['expire'])) {
          unset($cacheData[$key]);
          $counter++;
        }
      }
      if ($counter > 0) {
        $cacheData = json_encode($cacheData);
        file_put_contents($this->getCacheDir(), $cacheData);
      }
      return $counter;
    }
  }
213939
public function purgeOldCache()
    {
        $cache_dir = dirname($this->cache_dir);
        $current = basename($this->cache_dir);
        $count = 0;

        foreach (new \DirectoryIterator($cache_dir) as $file) {
            $dir = $file->getBasename();
            if ($dir === $current || $file->isDot() || $file->isFile()) {
                continue;
            }

            Folder::delete($file->getPathname());
            $count++;
        }

        return $count;
    }
1076487
public function deleteAll()
    {
        $this->request->allowMethod(['post', 'delete']);
        $this->BackupManager->deleteAll();
        $this->Flash->success(I18N_OPERATION_OK);

        return $this->redirect(['action' => 'index']);
    }
1126831
public function removeLocalesCacheFiles(array $locales)
    {
        foreach ($locales as $locale) {
            $this->removeCacheFile($locale);
        }

        // also remove database.resources.php cache file
        $file = sprintf('%s/database.resources.php', $this->options['cache_dir']);
        if (file_exists($file)) {
            $this->invalidateSystemCacheForFile($file);
            unlink($file);
        }

        $metadata = $file.'.meta';
        if (file_exists($metadata)) {
            $this->invalidateSystemCacheForFile($metadata);
            unlink($metadata);
        }
    }
228374
public function removeCache()
	{
		if ( ! $this->useCache || ! $this->cacheLocation ) return false;

		if ( ! is_dir( $this->cacheLocation ) ) return false;

		$rmrf = function ($dir) use ( &$rmrf )
		{
		    foreach ( glob( $dir ) as $file )
		    {
		        if ( is_dir( $file ) )
		        {
		            $rmrf( "$file/*" );
		            rmdir( $file );
		        }
		        else
		        {
		            unlink( $file );
		        }
		    }
		};

		$rmrf( $this->cacheLocation );

		return true;
	}
1047608
@DELETE
    @RequiresPermissions(I18nPermissions.LOCALE_DELETE)
    public Response deleteAllAvailableLocales() {
        List<Locale> locales = localeRepository.loadAll();
        for (Locale locale : locales) {
            localeRepository.remove(locale);
        }
        return Response.noContent().build();

    }
621877
public function removeCatalogs($locale = null, $domain = null) {
		$cache = $this->getCacheFrontend();
		
		if (is_array($domain)) {
			return $cache->removeMany($domain);
		}
		
		return $cache->remove($domain);
	}
30651
public function purge() {
        if (class_exists('APCUIterator', false)) {
            $iterator = new APCUIterator('#^' . preg_quote($this->cacheprefix, '#') . '#');
        } else {
            $iterator = new APCIterator('user', '#^' . preg_quote($this->cacheprefix, '#') . '#');
        }
        return apcu_delete($iterator);
    }