forked from Wavyzz/dolibarr
Fix: ical export can works if there is two parallele calls
This commit is contained in:
@@ -598,8 +598,12 @@ class ActionComm
|
||||
$filename=$format.'.'.$extension;
|
||||
}
|
||||
|
||||
|
||||
// Create dir and define output file (definitive and temporary)
|
||||
$result=create_exdir($conf->agenda->dir_temp);
|
||||
$outputfile=$conf->agenda->dir_temp.'/'.$filename;
|
||||
$outputfiletmp=tempnam($conf->agenda->dir_temp,'tmp'); // Temporary file (allow call of function by different threads
|
||||
|
||||
$result=0;
|
||||
|
||||
$buildfile=true;
|
||||
@@ -747,18 +751,22 @@ class ActionComm
|
||||
}
|
||||
|
||||
// Write file
|
||||
if ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfile);
|
||||
if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfile);
|
||||
if ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfile);
|
||||
if ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
|
||||
if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
|
||||
if ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp);
|
||||
|
||||
if ($result < 0)
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (rename($outputfiletmp,$outputfile)) $result=1;
|
||||
else $result=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans("ErrorFailToCreateFile",$outputfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1937,16 +1937,17 @@ function dol_print_error_email()
|
||||
* \param src_file Source filename
|
||||
* \param dest_file Target filename
|
||||
* \param allowoverwrite Overwrite if exists
|
||||
* \param disablevirusscan Disable virus scan
|
||||
* \return int >0 if OK, <0 if KO (an array with virus or errors if virus found or errors)
|
||||
*/
|
||||
function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite)
|
||||
function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$file_name = $dest_file;
|
||||
|
||||
// If we need to make a virus scan
|
||||
if (file_exists($src_file) && $conf->global->MAIN_ANTIVIRUS_COMMAND)
|
||||
if (empty($disablevirusscan) && file_exists($src_file) && $conf->global->MAIN_ANTIVIRUS_COMMAND)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/security.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/antivir.class.php');
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
*/
|
||||
function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$filter='')
|
||||
{
|
||||
global $langs;
|
||||
global $conf,$langs;
|
||||
|
||||
dol_syslog("xcal.lib.php::build_calfile Build cal file ".$outputfile." to format ".$format);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user