Fix: Error management with corrupted module files
This commit is contained in:
parent
37b0780523
commit
7aa2c9dcd1
@ -136,6 +136,9 @@ foreach ($modulesdir as $dir)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$res=include_once $dir.$file;
|
$res=include_once $dir.$file;
|
||||||
|
if (class_exists($modName))
|
||||||
|
{
|
||||||
|
try {
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
$modNameLoaded[$modName]=$dir;
|
$modNameLoaded[$modName]=$dir;
|
||||||
|
|
||||||
@ -179,6 +182,16 @@ foreach ($modulesdir as $dir)
|
|||||||
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
|
|||||||
@ -74,8 +74,10 @@ foreach($modulesdir as $dir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// File to load
|
// File to load
|
||||||
include_once $dir.$file;
|
$res=include_once $dir.$file;
|
||||||
|
if (class_exists($modName))
|
||||||
|
{
|
||||||
|
try {
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
|
|
||||||
$modules[$objMod->numero]=$objMod;
|
$modules[$objMod->numero]=$objMod;
|
||||||
@ -84,6 +86,16 @@ foreach($modulesdir as $dir)
|
|||||||
$modules_fullpath[$file]=$dir.$file;
|
$modules_fullpath[$file]=$dir.$file;
|
||||||
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
|
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
|
||||||
}
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user