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

Allow excluding files in opcache:status:scripts command #254

Merged
merged 4 commits into from
Nov 15, 2024

Conversation

dritter
Copy link
Contributor

@dritter dritter commented Nov 13, 2024

While inspecting our OPcache scripts, I noticed that most of them were some 3rd party scripts, which were mostly uninteresting for me. So I created an option to exclude some scripts from the listing.

You can now add --exclude='/vendor/' to exclude all vendor scripts. Note, that this will match _all_ scripts that have vendor` in their path (there is no way to determine if the script is really a 3rd party script).

The option takes a regex as value, so it would be possible to set --exclude='.*dor/' to exclude all paths which have a directory ending with "dor/".

Note: Delimiters are added automatically (I chose bracket style delimiters).

@gordalina
Copy link
Owner

@dritter thanks for the contribution. Can you add a test case, both for when there's no exclusion and when there's exclusion?

@dritter
Copy link
Contributor Author

dritter commented Nov 13, 2024

Uhm. This is harder than I thought. Is there a way to mock the data returned from OPcache?

@dritter
Copy link
Contributor Author

dritter commented Nov 13, 2024

Okay. I added some tests. Not sure if this is the right way to add mock data. But now it is pretty easy to do so: Just add the mock data as second parameter to runCommand().
But maybe there is an easier way (through proxies?)..

@gordalina gordalina merged commit 1c79a08 into gordalina:main Nov 15, 2024
9 checks passed
@gordalina
Copy link
Owner

Looks good, thanks!

@gordalina gordalina changed the title Add ability to exclude files from opcode cache listing Allow excluding files in opcache:status:scripts command Nov 15, 2024
@dritter dritter deleted the exclude_cachelist branch November 15, 2024 08:23
@gordalina
Copy link
Owner

Released in 9.2.1

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 this pull request may close these issues.

2 participants