CodeIgniter-minify
CodeIgniter-minify copied to clipboard
Write files to tmp location first
I'm seeing some 'broken' files when the files are being written and webpage views are being done. Perhaps write to a tmp location first and when the write is complete then rename/overwrite to the final location.
To add to this a fix may be to delay the file write by a couple of seconds. What seems to be happening is the files are being compressed while the upload is still taking place resulting in a 'chopped' out_file.
Adding in a sleep delayed the write so the file upload could finish in time. Moving this to a setting could allow some control over it.
if ($compile OR $force) { $this->_concat_files($files_array, $directory, $out_file); }
to
if ($compile OR $force) { sleep(2); $this->_concat_files($files_array, $directory, $out_file); }