Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suboptimal maintenance of parser cache files using touch() #7061

Closed
dvz opened this issue Dec 4, 2021 · 0 comments · Fixed by #7082
Closed

Suboptimal maintenance of parser cache files using touch() #7061

dvz opened this issue Dec 4, 2021 · 0 comments · Fixed by #7082

Comments

@dvz
Copy link
Contributor

dvz commented Dec 4, 2021

The modification time of files in the parser cache directory (ParserCacheProvider::PARSER_CACHE_DIRECTORY, php-parser) may be changed multiple times during a single run:

Given that the only non-maintenance usage of modification time appears to be the comparison with source files at:

&& filemtime($cache_location) > $file_modified_time

the apparent reason is to allow purging of old cache files in ProjectAnalyzer::check() at:

$removed_parser_files = $this->parser_cache_provider->deleteOldParserCaches(
$is_diff ? $this->project_cache_provider->getLastRun(\PSALM_VERSION) : $start_checks
);

by calling ParserCacheProvider::deleteOldParserCaches(), which seems to be non-functional:
if ($cache_directory) {
return 0;
}

The mechanism that relies on touch() (likely introduced via e9b4eb6) could be replaced completely with one that deletes all cache files before a full run, or one that relies on a list of processed files for which a cache should be kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant