If you use a uri temporary:// is set to : "sites/mysite/private/temp"
-> not a full path !!!
The function "Download Theme" not working.

I receive this error :

localhost
Error
Error message
Exception: Unable to open in write mode '' in Archive_Tar->_error() (line 635 of /opt/lampp/drupal-local/modules/system/system.tar.inc).
The website encountered an unexpected error. Please try again later.

It is because the fonction"drupal_realpath" used at line 514 return NULL VALUE.

In line 509 : $destination = $destination . '/' . $name . '.tar'
return "temporary::/omega-tools/MYTHEME.tar"

In "drupal_realpath" drupal uses the PHP function realpath, but this function return NULL if the path not exist... Here the filename THEME.tar is not yet create.
Archive_Tar receive a NULL value for the destination.

I have patched the module with this code :
Create a new variable for the tar destination :

$tardest = drupal_realpath($destination) . '/' . $name . '.tar';

$archiver = new Archive_Tar($tardest);

With this modification it works well.

Comments

ankur’s picture

Status:Active» Needs review
StatusFileSize
new788 bytes

I encountered the same fatal PHP error.

The fix described above worked for me.

Here's a patch that implements it. Instead of naming the variable $tardest, I called it $realpath_destination

mrgoodcheese’s picture

How do I use the attached patch? Or in what file do I place the code? Sorry, but I'm a bit new to this, and experienced the same download error.

Thank you.

ankur’s picture

@mrgoodcheese

If you are comfortable at the command line on a Unix-based operating system, you can use the "patch" utility.

Otherwise, you can edit the file by hand using the the uploaded patch file as a guide. The lines with a "-" in front of them are lines you remove and the lines with a "+" in front of them are lines you add (of course, you don't want to include the actual "+" or "-") in the removed/added lines. The patch file says you want to make these edits inside the function "omega_tools_write_archive", the definition of which begins at around line 505 (it's line 505 in the version of the .module file against which I created the patch file).

If you've never created/applied patches using the command-line or a version control system, I'd go the manual route.

xurizaemon’s picture

Title:Error in omega_tools_write_archive with uri temporary:// that is not a full path.» Fatal error in omega_tools_write_archive if file_temporary_path is relative
Status:Needs review» Reviewed & tested by the community

Works as advertised, thanks.

To reproduce: Use the "Download theme" link from the theme settings page.

mrgoodcheese’s picture

Thanks for you help so far, ankur. I've tried modifying the file, but I must be doing something wrong because it doesn't work and I still get the same error as before. Is there any chance that I could get you to put up a link to the modified file, or email the file to me? I really want to get this working, and it would be much appreciated.
mrgoodcheese@gmail.com

xurizaemon’s picture

@mrgoodcheese it's worth learning how - http://drupal.org/patch/apply

PlayfulWolf’s picture

applied patch, but my browser cannot finish the file - it shows it on downloaded bar for infinite amount of time.

Rudi91’s picture

I've tried both the method used in the original post aswell as the one in the #1 post (the one with the patch file).
I'm pretty sure I've adjusted the file as mentioned in the post and tried out both but neither of them seem to work.

My error message is slightly different but this is the only post I've found that comes close to it.

My error message goes as follows;
Error message

Exception: File 'test' does not exist in Archive_Tar->_warning() (line 644 of myurl/modules/system/system.tar.inc).
The website encountered an unexpected error. Please try again later.

Has anyone managed to find another fix or should I open a new topic for this one?

sreher’s picture

I installed the patch and in the first place it doesn't work.
After i try it several times, i discover that when i choose a name with only one word, it works.
If there is a space in the name, it doesn't work for me.
Perhaps it helps...

Rudi91’s picture

Thanks sreher,

I got it working using a single word as well.
I've also tried it with underscores instead of spaces but that didn't work either.

joelcollinsdc’s picture

Status:Reviewed & tested by the community» Needs work

+1 for this working if no spaces, not working if spaces

fubhy’s picture

I removed this feature in 4.x because I had the feeling that noone really used it. Is there any demand for me to put this in 4.x?

fubhy’s picture

Status:Needs work» Active
hotwebmatter’s picture

@ fubhy:

For what it's worth, I just tried to use the "Download Theme" feature and got the same error message (which is how I ended up here), so +1 "I'm interested in this feature."

"Demand" seems like a pretty strong word for my feelings on the issue, though -- I certainly figured out another way to download the theme.

joelcollinsdc’s picture

Rerolling the patch because i'm trying to apply 2 patches to the same file and they are dying on the no newline at the end of file.

traveller’s picture

Patch in #15 works for me. Thanks!

PlayfulWolf’s picture

Version:7.x-3.0-rc4» 7.x-3.x-dev

applied #15 manually - download works now

xurizaemon’s picture

Status:Active» Needs review

If testing patches, please consider marking RTBC once you've reviewed them.

PlayfulWolf’s picture

Status:Needs review» Reviewed & tested by the community

I applied patch manually: some of the lines were NOT correct, and I applied only the content of #15 - it may need to apply manually also.
If that is RTBC, I am marking this.

xurizaemon’s picture

Seems to work OK via simplytest.me with temporary directory set to sites/default/files/tmp. No warnings about patch not applying.

wickwood’s picture

Patch in #15 applied with git cleanly to 7.x-3.0-rc4 and fixed the problem for me.

radimklaska’s picture

Issue summary:View changes

Patch #15 works OK. Thanks!