Intermittently we are finding that a library is missing from a final combined css after server restart and are not being loaded in the final combined file without any indication. This means the css or js will be broken until the application is reinitialised. Subsequent application reinitialisation fixes the issue.
Things we can tighten up
#1 There is a property in combine.cfc which dictates whether to skip missing files. By default this is set to true. What this means is as combine is looping over the list of files it is checking the filesystem to see if the file exists and that it is css or js (or cfm). If it doesn't find the file by default it just skips loading it altogethor.
#2 Later the files are looped over and their contents read and any filepaths are changed. At this point the contents are read from disk and any relative filepaths are changed to be absolute to ensure things like css images load ok. We could add two checks to this process, first check is that the filecontents read from disk is not empty and second check is after doing the replaces that the output again is not empty. A further try/catch should be put around this to ensure no errors occurred during the process. An example of an error generated during this process is:
The third parameter (AtPosition) of the function Insert(SubString, InString, AtPosition), which is now equal to 2779, must be less than or equal to the length of the second parameter (String), which is now equal to
When a library fails to load on init for either of the 2 scenarios bubble up an alert to anyone who is logged in as an admin (similar to how publishing rule failures bubble an alert). (maybe sysadmins only?)
Fall back to outputting the library as a standard css or js call in the head but put a html comment beside indicating it failed on init (again similar to publishing rule error ). This way it would also be found missing in link checkers if it is still failing. Currently the combine returns a string (the cachefilename) so would need to be changed to return a struct with the sCacheFileName that worked and another struct key with the list of files that didn't so they could be output separately. This would happen in /tags/core/cssInHead.cfm and /tags/core/jsInHead.cfm