Skip to content

Commit

Permalink
Add a protection for duplicate modules
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 15, 2012
1 parent 62e0814 commit 5edcc19
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions htdocs/admin/modules.php
Expand Up @@ -105,6 +105,7 @@
$dirmod = array();
$i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined.
$modNameLoaded=array();

foreach ($modulesdir as $dir)
{
Expand All @@ -123,10 +124,18 @@

if ($modName)
{
if (in_array($modName,$modNameLoaded))
{
$mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
dol_syslog($mesg, LOG_ERR);
continue;
}

try
{
$res=include_once($dir.$file);
$objMod = new $modName($db);
$modNameLoaded[$modName]=$dir;

if ($objMod->numero > 0)
{
Expand Down

0 comments on commit 5edcc19

Please sign in to comment.