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

Detect updated mofiles #3

Open
soulseekah opened this issue Feb 16, 2018 · 3 comments
Open

Detect updated mofiles #3

soulseekah opened this issue Feb 16, 2018 · 3 comments
Assignees

Comments

@soulseekah
Copy link
Contributor

When mofiles are updated we have to clear our caches, otherwise changed translations will not be served. New translations will, though.

First thought is parsing the update date from the matching po file, but that might not even exist. What do we do then? md5sum the mofile and match against the sum in cache? That would add some overhead, we don't want to open the files unless we really need to.

More ideas? Plugin versions? Update hooks? Not reliable.

@soulseekah soulseekah self-assigned this Feb 16, 2018
@versusbassz
Copy link

@soulseekah
Copy link
Contributor Author

soulseekah commented Feb 19, 2018

This doesn't account for manual updates (via SFTP, etc.), Loco Translate updates (which writes to mo files directly). Maybe filemtime()?

@soulseekah
Copy link
Contributor Author

soulseekah commented Feb 20, 2018

Couple of things to note with filemtime() caching (i.e. stat caching) - according to the PHP source stat caching is done in the basic globals (BG) which is destroyed on module shutdown (PHP_MSHUTDOWN_FUNCTION). This means that caches could persist for quite a while, especially in pool-based configurations where the modules are shared across subprocesses.

This needs more preliminary testing, especially with php-fpm.

soulseekah added a commit that referenced this issue Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants