On lines 756 and 757 of wysiwyg.module are the following two lines necessary?

$url = url('wysiwyg_theme/' . $theme, array('absolute' => TRUE, 'max_redirects' => 0));
$response = drupal_http_request($url);;

They will sometimes perform 404s on some sites (especially those on HTTPS with proxies) and fill up the logs.

CommentFileSizeAuthor
#2 2996267-unnecessary-code.patch658 bytesebremner

Comments

ebremner created an issue. See original summary.

ebremner’s picture

StatusFileSize
new658 bytes

Patch to fix.

liam morland’s picture

Status: Active » Needs review
twod’s picture

Status: Needs review » Closed (works as designed)

This is currently by design. It needs to do a new request to itself to get a clean page with just the stylesheets loaded and prime the cache read on the next line.
Removing that requests simply breaks all in-editor stylesheet loading.

It was added as part of #2289683: Select in-editor theme and get all stylesheets. If you want something to sink your teeth into, figure out how to force the client to make that request instead, before stylesheets have actually been loaded into the editing area. ;)

We could force admins to trigger the "cache-warning" via the GUI after changing editor configs (or whenever you expect some stylesheets have been added/removed) but you'd easily forget to do this for all themes. Best would be if it was completely transparent to admins and visitors, without the first person who loads an editor ending up without stylesheets in the editing area because the caches were cold .

I have at least one idea on how to do it. Instead of doing that request it could return the path to a single stylesheet, which actually points to the page callback currently handling that request. It would do pretty much the same thing it does now, but instead of only returning "OK" and prepping the cache with the stylesheet list it would dynamically build a temporary stylesheet with @import statements for each of the files. @import statements weren't well supported a few years ago but now it should be fine...
That way you'd both warm the cache and have the first editor load get all stylesheets, by forcing it to take an extra step.

(A similar method could perhaps be used to include multiple stylesheets for editors which only support loading a single one.)

liam morland’s picture