epiphyt / embed-privacy

Embed Privacy prevents loading of embedded external content and allows your site visitors to opt-in.
https://epiph.yt/en/embed-privacy/
GNU General Public License v2.0
19 stars 12 forks source link

JS/CSS versioning scheme with filemtime does not work well with dockerized and K8N setups #132

Closed alexmerz closed 2 years ago

alexmerz commented 2 years ago

What feature are you requesting?

Hi,

the plugin makes heavy use of filemtime() for versioning JS & JSS resources in function calls like wp_register_style().

Embed privacy should use a different mechanismen for versioning or at least provide an option to manuelly set a version number (or setting the value to the plugin version number by default?)

Why is this feature necessary?

As docker containers or k8n pods can be created at any given time and can run in parallel, the version number for these resources will be very much random, even if nothing has changed. It also assumes, that filemtime does provide a correct result, which is not the case for some cloud storage setups.

In our case, we are running in trouble with the plugin on the Wordpress VIP plattform.

Are you expecing side-effects?

No

Code of Conduct

MatzeKitt commented 2 years ago

What exactly are the troubles you’re experiencing?

alexmerz commented 2 years ago

Hi MatzeKitt

see: https://docs.wpvip.com/technical-references/vip-platform/file-concatenation-and-minification/#h-versioning-to-bust-the-cache

This is what it looks like in the log for example: PHP message: Warning: filemtime(): stat failed for /var/www/wp-content/plugins/embed-privacy/assets/style/embed-privacy.min.css in /var/www/wp-content/plugins/embed-privacy/inc/class-embed-privacy.php on line 1438 ...

So basically by now, no versioning at all is happening.

Best Alex

MatzeKitt commented 2 years ago

You missed the important part on the PHP message, I think. After the current text the actual problem while using filemtime would be visible. Can you please post the full message?

alexmerz commented 2 years ago

PHP message: Warning: filemtime(): stat failed for /var/www/wp-content/plugins/embed-privacy/assets/style/embed-privacy.min.css in /var/www/wp-content/plugins/embed-privacy/inc/class-embed-privacy.php on line 1438 [XXXXX/xmlrpc.php?for=jetpack&token=XXXXXXXXXX&timestamp=1667564985&nonce=XXXXXXX&body-hash=XXXXXXXXXX&signature=6dYJfIERqspYtp77z1qi9wNKbXs%3D] [wp-content/plugins/embed-privacy/inc/class-embed-privacy.php:1438 filemtime(), wp-includes/class-wp-hook.php:307 epiphyt\Embed_Privacy\Embed_Privacy->register_assets(), wp-includes/class-wp-hook.php:331 WP_Hook->apply_filters(), wp-includes/plugin.php:476 WP_Hook->do_action(), wp-settings.php:598 do_action('init'), wp-config.php:53 require_once('wp-settings.php'), wp-load.php:50 require_once('wp-config.php'), xmlrpc.php:31 require_once('wp-load.php')]

MatzeKitt commented 2 years ago

If WP_DEBUG is disabled, the plugin version is now used as asset version parameter.