Trying to export an Omega subtheme kept failing because of file permissions. The error mentions a failed attempt to copy a temp file, with no indication of where or why the failure was happening.

The specified file temporary://filerCasCS could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.

I fixed permissions (and the setting) for the main temp directory and also gave Drupal write access to the themes folder. With that, I was able to get the expected result: the .info file got the new settings.

FWIW, when recreating this I did *not* check the "Revert theme settings" checkbox in the theme export window.

Also, I tested to see if it was the temp directory permissions causing the problem. Nope. That generates a different error:

Warning: file_put_contents(temporary://filez8m7yx): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1904 of /home/usr/www/includes/file.inc).
The file could not be created.

So, that at least is a different message, one that matches loosely to the nature of the error. But BOTH errors also yielded the erroneous

The theme settings for MyAwesomeTheme have been exported and saved to the corresponding .info file.

But, in fact, the theme was NOT being exported.

This was more than a bit confusing for a relative newbie trying to figure out how to export my themes. It was even worse when I left the "Revert theme settings" checkbox checked, as it destroyed the changes I had just made. It took quite a while to figure out it was a permissions issue and that, in fact, the "correct" behavior of the system was that the .info file would be nicely overwritten (I tried downloading, which also didn't work right for somewhat different reasons).

Anyway, it would be great if you could update the error messages to be more clear and keep it from the false success message when, in fact, the .info file is not updated. You might even want to run a diff to make sure it worked if you don't have another way to tell that the write or copy failed.

It's easy to recreate the error by turning off write permissions to the .info file.

FWIW, I also don't seem to have dblog in the administration log interface. So, I never was able to see what was written to the log.

Comments

Project:Omega» Omega Tools
Version:7.x-3.0» 7.x-3.x-dev

omega tools exports...that is an issue for omega tools..moved

Title:Nearly useless error message and incorrect sucess message on failed theme export Export Error Handling
Priority:Normal» Critical

I'm changing the title and updating to critical as I nearly lost a theme to this just now. Luckily I had backed up the changes and backed up the .info before anything happened. We need to sense if the write error happens **THEN** clear the db and display the success message. Otherwise it should throw the error and stop the whole process.

I'll change write permissions and try again but just wanted to bring this up as a critical before we pull off the RC on this

I've experienced the issue described in Comment 2 above and second the sentiment.

If there is a failure when writing the .info file, the reverting of the theme settings in the database should be aborted. Otherwise, the innocent mistake of failing to change permissions/ownership in order to make the .info file writable will result in all theme configuration changes being lost.