Skip to content

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.
@brbrbr
Copy link

brbrbr commented Jul 4, 2025

I have successfully tested that this fixes the issue joomla/joomla-cms#45681

@Hackwar Hackwar merged commit f455844 into joomla-framework:3.x-dev Jul 11, 2025
2 checks passed
@richard67 richard67 deleted the 3.x-dev-redo-pr-38-opcache-improvements branch July 11, 2025 12:15
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.

3 participants