Fix: split into 2 functions

This commit is contained in:
Regis Houssin 2012-09-11 18:52:23 +02:00
parent 3e033ef48c
commit b39c9c514a

View File

@ -770,11 +770,7 @@ function dolMoveUploadedFile($src_file, $dest_file, $allowoverwrite, $notrigger=
*/ */
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$object=null) function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$object=null)
{ {
global $db, $conf, $user, $langs; global $db, $hookmanager;
global $hookmanager;
$langs->load("other");
$langs->load("errors");
if (! is_object($hookmanager)) if (! is_object($hookmanager))
{ {
@ -800,6 +796,28 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec
} }
else else
{ {
return dolDeleteFile($file, $disableglob, $nophperrors, $notrigger, $object);
}
}
/**
* Remove a file or several files with a mask
*
* @param string $file File to delete or mask of file to delete
* @param int $disableglob Disable usage of glob like *
* @param int $nophperrors Disable all PHP output errors
* @param int $notrigger Disable all triggers
* @param object $object Current object in use
* @return boolean True if file is deleted, False if error
* @see dol_delete_file
*/
function dolDeleteFile($file,$disableglob=0,$nophperrors=0,$notrigger=0,$object=null)
{
global $db, $conf, $user, $langs;
$langs->load("other");
$langs->load("errors");
$error=0; $error=0;
//print "x".$file." ".$disableglob; //print "x".$file." ".$disableglob;
@ -850,7 +868,6 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec
return $ok; return $ok;
} }
}
/** /**
* Remove a directory (not recursive, so content must be empty). * Remove a directory (not recursive, so content must be empty).