Skip to content
Snippets Groups Projects
Commit dcaef54f authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix can't disable a module that were removed.

parent 9422b22e
No related branches found
No related tags found
No related merge requests found
......@@ -838,13 +838,13 @@ function unActivateModule($value, $requiredby=1)
}
else
{
// TODO Replace this afte DolibarrModules is moved as abstract class with a try catch to show module is bugged
// TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module is bugged
$genericMod = new DolibarrModules($db);
$genericMod->name=preg_replace('/^mod/i','',$modName);
$genericMod->rights_class=strtolower(preg_replace('/^mod/i','',$modName));
$genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',$modName));
dol_syslog("modules::unActivateModule Failed to find module file, we use generic function with name " . $modName);
$genericMod->_remove();
$genericMod->_remove('');
}
// Desactivation des modules qui dependent de lui
......@@ -853,6 +853,7 @@ function unActivateModule($value, $requiredby=1)
$countrb=count($objMod->requiredby);
for ($i = 0; $i < $countrb; $i++)
{
var_dump($objMod->requiredby[$i]);
unActivateModule($objMod->requiredby[$i]);
}
}
......
......@@ -32,7 +32,7 @@
*
* Parent class for module descriptor class files
*/
abstract class DolibarrModules
class DolibarrModules // Can not be abstract, because we need to instantiant it into unActivateModule to be able to disable a module whose files were removed.
{
/**
* @var DoliDb Database handler
......@@ -194,16 +194,21 @@ abstract class DolibarrModules
*/
public $core_enabled;
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
//public function __construct($db);
// We should but can't set this as abstract because this will make dolibarr hang
// after migration due to old module not implementing. We must wait PHP is able to make
// a try catch on Fatal error to manage this correctly.
function __construct($db)
{
$this->db=$db;
}
/**
* Enables a module.
* Inserts all informations into database
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment