Clear a PHP file from all active cache files. Also supports to flush the cache completely, if called without parameter.

@param string $absolutePathAndFilename Absolute path towards the PHP file to clear.
@return void
770276
public static function clearAllActive(string $absolutePathAndFilename = null)
    {
        if (self::$clearCacheCallbacks === null) {
            self::initialize();
        }
        foreach (self::$clearCacheCallbacks as $clearCacheCallback) {
            $clearCacheCallback($absolutePathAndFilename);
        }
    }
164012
public function clear()
    {
        $this->allowed_file_extensions = null;
        $this->error_messages = array();
        $this->file_extensions_mime_types = null;
        $this->files = array();
        $this->input_file_name = null;
        $this->max_file_size = null;
        $this->max_image_dimensions = array();
        $this->move_uploaded_queue = array();
        $this->move_uploaded_to = '.';
        $this->new_file_name = null;
        $this->overwrite = false;
        $this->web_safe_file_name = true;
        $this->security_scan = false;
        $this->stop_on_failed_upload_multiple = true;
    }
665452
private function deleteFiles($dirPath)
    {
        foreach (glob($dirPath.DIRECTORY_SEPARATOR.'{*,.[!.]*,..?*}', GLOB_BRACE) as $content) {
            if (is_dir($content)) {
                $this->deleteFiles($content);
            } else {
                unlink($content);
            }
        }
        rmdir($dirPath);
    }
1036706
public function clearAssetCache()
    {
        foreach ($this->cachedFiles as $hash => $fileData) {
            if (!$this->fileBackend->isWritable($fileData['file'])) {
                continue;
            }
        
            $this->fileBackend->deleteFile($fileData['file']);
        }
        
        $this->cachedFiles = array();
        $this->saveAssetsCache();
    }
733687
public function clear(): bool
    {
        //TODO: check the need to call
        clearstatcache();
        
        $dh = @opendir($this->cacheDir);
        if (false === $dh) {
            return false;
        }
        
        while (false !== ($entry = readdir($dh))) {
            $file = $this->cacheDir . '/' . $entry;
            if (is_file($file) && 0 !== strpos($entry, '.')) { //exclude .htaccess
                unlink($file);
            }
        }
        
        closedir($dh);
        
        return true;
    }
776295
public function cleanStaticCache($sCacheName = null)
    {
        if ($sCacheName) {
            unset($this->_aStaticCache[$sCacheName]);
        } else {
            $this->_aStaticCache = null;
        }
    }
377320
public function deleteAll()
    {
        if ($this->isAbsolute()) {
            if ($this->isFile() || $this->isLink()) {
                // delete file and symlink
                return unlink($this->getPathname());
            } elseif ($this->isDir()) {
                // delete directories and its content
                return $this->deleteAction($this->getPathname(), true);
            }
            return false;
        } else {
            throw new FileException('Given file path is not a absolute path.');
        }
    }
783244
private function cleanPaths()
    {
        $this->output->writeln('');


        if ($this->input->getOption('purge')) {
            $this->output->writeln('<magenta>Purging old cache</magenta>');
            $this->output->writeln('');

            $msg = Cache::purgeJob();
            $this->output->writeln($msg);
        } else {
            $this->output->writeln('<magenta>Clearing cache</magenta>');
            $this->output->writeln('');

            if ($this->input->getOption('all')) {
                $remove = 'all';
            } elseif ($this->input->getOption('assets-only')) {
                $remove = 'assets-only';
            } elseif ($this->input->getOption('images-only')) {
                $remove = 'images-only';
            } elseif ($this->input->getOption('cache-only')) {
                $remove = 'cache-only';
            } elseif ($this->input->getOption('tmp-only')) {
                $remove = 'tmp-only';
            } elseif ($this->input->getOption('invalidate')) {
                $remove = 'invalidate';
            } else {
                $remove = 'standard';
            }

            foreach (Cache::clearCache($remove) as $result) {
                $this->output->writeln($result);
            }
        }
    }
719397
private function clearDirectory($path)
    {
        $this->debug("Clear directory: {$path}");
        $this->delete($path);
        $this->makeDirectory($path);
    }
122019
static function clearAccessPath( $siteaccess = true )
    {
        if ( $siteaccess )
            self::instance()->AccessPath['siteaccess'] = array( 'name' => '', 'url' => array() );
        else
            self::instance()->AccessPath['path'] = array( 'name' => '', 'url' => array() );
    }
719409
public static function clear($path = null) {
		if (empty($path)) {
			self::$_items = array();
			return;
		}

		if (Hash::check(self::$_items, $path)) {
			self::$_items = Hash::insert(self::$_items, $path, array());
		}
	}
867497
protected function clearCache()
    {
        $oldCacheDirName = "{$this->cacheDir}_old";
        $this->fs->rename($this->cacheDir, $oldCacheDirName);
        $this->fs->remove($oldCacheDirName);
    }
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;
    }
927400
private function removePath(string $path): void
    {
        if (false !== strpos($path, '*')) {
            $paths = glob($path);
            foreach ($paths as $path) {
                $this->removePath($path);
            }
        } else {
            if (is_dir($path)) {
                $iterator = new \RecursiveDirectoryIterator($path);
                $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
                /** @var \SplFileInfo $file */
                foreach ($iterator as $file) {
                    if ('.' === $file->getBasename() || '..' === $file->getBasename()) {
                        continue;
                    }
                    if ($file->isLink() || $file->isFile()) {
                        unlink($file->getPathname());
                    } else {
                        rmdir($file->getPathname());
                    }
                }
                rmdir($path);
            } else {
                if (is_file($path)) {
                    unlink($path);
                }
            }
        }
    }
906361
protected function clearCacheRoot()
    {
        /** @var \SplFileInfo $file */
        foreach (Filesystem::items(WINDWALKER_CACHE, false) as $file) {
            if (in_array($file->getBasename(), ['.gitignore', '.htaccess', 'web.config'])) {
                continue;
            }

            if ($file->isDir()) {
                Folder::delete($file->getPathname());
            } else {
                File::delete($file->getPathname());
            }

            $this->out(sprintf('[Deleted] <info>%s</info>', $file->getPathname()));
        }
    }
1126251
public static function clearStatCache($filename = null) {
    if (!empty($filename)) {
      unset(self::$stat_cache[self::getHashValue($filename)]);
    } else {
      self::$stat_cache = [];
    }
  }
374543
protected function clear(): void
    {
        $this->files = [];
        $this->ofs = new Bigint();
        $this->cdr_ofs = new Bigint();
        $this->opt = new ArchiveOptions();
    }