Fix: check if directory exists
This commit is contained in:
parent
9793a8f13a
commit
2e595643f5
@ -63,13 +63,21 @@ class Interfaces
|
|||||||
dol_syslog('interface::run_triggers was called with wrong parameters object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
|
dol_syslog('interface::run_triggers was called with wrong parameters object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle=opendir($this->dir);
|
// Load all directory
|
||||||
|
$this->getModulesTriggers();
|
||||||
|
|
||||||
|
foreach($this->dir as $dir)
|
||||||
|
{
|
||||||
|
// Check if directory exists
|
||||||
|
if (!is_dir($dir)) continue;
|
||||||
|
|
||||||
|
$handle=opendir($dir);
|
||||||
$modules = array();
|
$modules = array();
|
||||||
$nbfile = $nbtotal = $nbok = $nbko = 0;
|
$nbfile = $nbtotal = $nbok = $nbko = 0;
|
||||||
|
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (is_readable($this->dir."/".$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php$/i',$file,$reg))
|
if (is_readable($dir."/".$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php$/i',$file,$reg))
|
||||||
{
|
{
|
||||||
$nbfile++;
|
$nbfile++;
|
||||||
|
|
||||||
@ -103,7 +111,7 @@ class Interfaces
|
|||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
|
dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
|
||||||
include_once($this->dir."/".$file);
|
include_once($dir."/".$file);
|
||||||
$objMod = new $modName($this->db);
|
$objMod = new $modName($this->db);
|
||||||
$i=0;
|
$i=0;
|
||||||
if ($objMod)
|
if ($objMod)
|
||||||
@ -133,6 +141,9 @@ class Interfaces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
|
||||||
if ($nbko)
|
if ($nbko)
|
||||||
{
|
{
|
||||||
dol_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR);
|
dol_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user