dpegasusm
Forum Replies Created
-
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingWorks Perfectly!
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingSure ill test right now
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingThank you. Yes that filter is exactly what we need for one part of the puzzle.
I have tested and changing the code to use
wp_upload_dir()
creates the directory and files without error as needed.Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingWe still need the above filter to modify the hash. It also needs to check for and create the directory (or directory path) before trying to write to it.
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingSo this is actually looking like a two part issue. First part we mentioned above, but the second part is the files and images are offloaded to a CDN. This means that the entire uploads folder doesn’t exist on the server so when it is trying to write to it with
file_put_contents
the tree doesn’t exist and the pathway fails.A few things could fix this:
can
wp_upload_dir();
be used on line #33 instead ofwp_get_upload_dir();
so that the directory is created if it fails to exist.Alternately could the writing of the file be handled by the WP_Filesystem API? This would make it easy for us to put the file into our CDN and bypass the LB/hash issue entirely.
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingOn closer look, I think that the root of the issue is that the plugin assumes that the file its trying to write to on 144/145 exists:
If a check was added to determine if the file exists and if not create it before writing that may solve the issue too.
In our setup we have a cache in front of the load balancer on all CSS files that we can manually invalidate objects in but standard browser caching rules still apply. If there was a way to permanently set the hash via filter as you described or append the hash to the file via query string parameter like filename.css?ver=hash instead of in the file name then that might solve both the browser cache issue and the file writing issue.
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingThe load balancer behaves like a round robin connecting to anywhere between 5-20 servers a time depending on load requirements so the CSS file exists on one server which may or may not be the server an end user ends up connecting to. On the read/write end the file could be written to one server but not to others so the file that is being looked for may not be found. For example:
On server one the files are called:
teccc_aa580578f69ec3d2c0062de7c652ca2d.css
teccc_aa580578f69ec3d2c0062de7c652ca2d.min.css
On server two we have:
teccc_f0fd8b4e32c410052774ee38ca793538.css
teccc_f0fd8b4e32c410052774ee38ca793538.min.css
On server 3 we have:
teccc_0829174adf7de37a6fc47e92231b13c1.css
teccc_0829174adf7de37a6fc47e92231b13c1.min.css
Additionally, every time a server is destroyed the files are destroyed with that server and since they are only created by the plugin locally on that one instance and not pushed to a CDN the cease to exist completely.
So the load balancer doesn’t __see__ it because it is not intelligently looking for it and just doing a dumb passthrough. If the user happens to be the 1/5 chance of connecting to the server with the correctly named file then they get the styles otherwise no, but once that server is taken out of commission due to the autoscaling with load the files cease to exist as well.
- This reply was modified 5 years, 7 months ago by dpegasusm.
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingJetpack is also doing some realtime display of their CSS files without writing it to disk:
Forum: Plugins
In reply to: [The Events Calendar: Category Colors] Writing to CSS file failingWordpress has the filter
wp_get_custom_css
/** * Filters the Custom CSS Output into the <head>. * * @since 4.7.0 * * @param string $css CSS pulled in from the Custom CSS CPT. * @param string $stylesheet The theme stylesheet name. */ $css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );
It might be possible to append the CSS to the WP custom CSS output using that hook or do something similar to how WP is handling the Custom CSS output instead of writing it to a file.
do you have a way i can direct message it to you? in WP slack perhaps?
Upgrading broke my site. 3.3.2
Forum: Fixing WordPress
In reply to: Make WP_List_Table columns selectable from screen optionsThanks That plugin is extremely helpful and i used it to get 90% of the application i am trying to build done. However, the screen options stuff is not in there and i have yet to find any reference or documentation of it.