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

[3.x] Port improvements for opcache invalidation from CMS - redo PR #38 #75

Open
wants to merge 5 commits into
base: 3.x-dev
Choose a base branch
from

Conversation

richard67
Copy link
Contributor

Pull Request for Issue #

Summary of Changes

This pull request is a redo of PR #38 , which was closed by its author for unrelated reasons.

In opposite to that PR, it does not introduce a new method to check if opcache can be invalidated but checks that locally in the invalidateFileCache method, and it does not extend the invalidateFileCache method by a new parameter if the invalidation shall be forced.

Besides these differences in implementation, the changes here are functionally the same as in the closed PR.

The changes were once implemented in the file system classes of the CMS with PR joomla/joomla-cms#32915 , which was intensively tested by me at that time.

In detail the changes are following, done with separate commits in this PR so they can be easily verified:

  • When deleting a file, invalidate the OPCache for the file before actually deleting it.
    See https://www.php.net/manual/en/function.opcache-invalidate.php#116372 .
  • When moving a file, invalidate the OPCache for the file before actually moving it.
    This is done in the move method and for the temporary upload file also in the upload method.
  • Better check if opcache_invalidate is possible (check also if opcache is enabled at all and if there is a restriction by opcache.restrict_api) and save the result in a static variable.
  • Code style fix for multi-line comment not related to the other changes from this PR.

Testing Instructions

Will be added soon.

Documentation Changes Required

None.

Invalidate opcache of uploaded temp file before saving to target file
Check if
- opcache is enabled, and
- the opcache_invalidate function is available, and
- calling opcache_invalidate is not restricted by opcache.restrict_api or it is restricted to allow the currently executing script
and save the result in a static variable.
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.

1 participant