Hi,
Lately i've spent a lot of time trying to solve some problems that I had (and still have) on one of my projects. I've found out that I've ran into two separate issues that were already known and have a github ticket. I've made some workarounds and it works now. But I've got a feeling that maybe my implementation is wrong and I need a advice how to do things correctly. Also I have some suggestions too.
The main reason why I've ran into these issues is that my project uses cronjobs. One of them must be run every 15 mins. Cronjobs are cofigured on DirectAdmin Web Control Panel.
So the first thing is that documentation doesn't mention (at least I didn't found where) that I need to do a flush before running my task (at least it is preferable). That's because SS creates separate manifest for every user. Flushing with HTTP request rebuilds manifest only for HTTP server user but not for cron user (#3092). I understand the reason why it is implemented in this way, but would useful to use other user's manifest if needed (passing username via CLI parameter or etc.). Of course it is possible to run conjob on the same user as HTTP server runs, but it is not always possible (at least DirectAdmin doesn't let me change it).
My cronjob command looked like this then:
php framework/cli-script.php / "flush=all" > /dev/null && php framework/cli-script.php /MyJob
But then my error log started to fill up with the messages about permission denied in /assests/_combinedfiles/. It was because the flush command was made on my index page and combined files were created by the cron user. So i tried to set Filesystem::file_create_mask to 02777 but then I realized that this property is not used at all anywhere in code... :) Also I checked Requiremets class and found that it does not use Filesystem or File to create combined file at all.
So I modified my command and everything looked OK then:
php framework/cli-script.php /dev/ "flush=all" > /dev/null && php framework/cli-script.php /MyJob
It still cleared /assests/_combinedfiles/ but it didn't create new ones, so apache user could recreate them.
But does it really necessary to clear this folder when I only need to rebuild the manifest? SS creates different manifest cache for every user to avoid user permission errors but it does writing/deleting in "shared" /assests/_combinedfiles/ folder. CLI does not use combined files so why to mess with it anyway?
After some time my client started to complain that he cannot work on admin. From time to time he has to reload the page because admin becomes irresponsible. After some digging I realized that I ran into #4553. Every 15mins cronjob clears /assests/_combinedfiles/ and lib.js has to be recreated. This is a very good example that ]hafriedlander's suggestion how to fix this issue is correct. Currently I use tractorcow's PR as a quickfix. At least my client can work with admin again.
So that's my story :) Sorry for the looog post.
P.S. It would be very useful to have a list of "know issues" (with the links to github) that are too difficult to fix or currently impossible to fix at all. Let's say Developer guides / Cli page could have a "known issues" list with #3092 and e.t.