Fix exporting to a directory

This commit is contained in:
Nathan Gray 2012-04-17 15:40:34 +00:00
parent df1f6b2ff4
commit dff86e4842

View File

@ -344,9 +344,9 @@
*/ */
private static function is__writable($path) { private static function is__writable($path) {
if ($path{strlen($path)-1}=='/') // recursively return a temporary file path if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
return is__writable($path.uniqid(mt_rand()).'.tmp'); return self::is__writable($path.uniqid(mt_rand()).'.tmp');
else if (is_dir($path)) else if (is_dir($path))
return is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); return self::is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
// check tmp file for read/write capabilities // check tmp file for read/write capabilities
$rm = file_exists($path); $rm = file_exists($path);
$f = @fopen($path, 'a'); $f = @fopen($path, 'a');
@ -422,6 +422,8 @@
$type = $data['type']; $type = $data['type'];
if(is_dir($data['target'])) if(is_dir($data['target']))
{
if($data['type'] == 'import')
{ {
$targets = array(); $targets = array();
foreach(scandir($data['target']) as $target) foreach(scandir($data['target']) as $target)
@ -445,6 +447,12 @@
} }
} }
else else
{
// Create a unique file for export
$targets = array($data['target'].uniqid($definition->name).'.'.$po->get_filesuffix());
}
}
else
{ {
$targets = array($data['target']); $targets = array($data['target']);
} }