IMAmuseum / tap-cms

Authoring tools for the TAP mobile application software platform, built on top of Drupal. Learn more about the project at TAPintoMuseums.org.
https://github.com/IMAmuseum/tap-cms/wiki
GNU General Public License v3.0
24 stars 8 forks source link

TourML Export fails on Windows #45

Open IllyaMoskvin opened 8 years ago

IllyaMoskvin commented 8 years ago

On L397-398 of tap.export.inc, there is an exec() call to move the *-bundle.zip from /tmp to the files directory. I think the command used will only work on Linux, or at least, it was what caused the TourML Export functionality to break on my WAMP stack. Replacing these two lines with the following rename() call fixed the issue:

rename( str_replace('\\', '/', $file_path) , str_replace('\\', '/', drupal_realpath($dest) ) );

There might be a Drupal function, maybe in one of the required modules, that accomplishes the same thing with more elegance. From cursory examination, it seems that $output and $return_val from the original exec() call aren't used elsewhere, so I thought it was safe to discard them, but it'd be good if someone more familiar with the module could confirm that this is the case.

Without the str_replace() to force forward-slashes in paths, rename() would bug out on Windows. Without them, it removed bundle files from my temporary directory, but they never arrived in sites\default\files\tourml_bundle. (I'm still not sure where they all went.)

I just tested this change on a Linux server, and the bundle export works as expected.

Thanks!

IllyaMoskvin commented 8 years ago

Today, I ran into trouble again, where a bundle would not export because the server's security permissions blocked exec() calls.