Fix regression: We can't yet set method __construct of DolibarrModules
abstract because this break compatibility with a lot of external module and generate FATAL errors after migration. Because PHP is not yet able to manage try catch on FATAL error, we can't catch such error. Using bstract on constructor is so postponed.
This commit is contained in:
parent
0b9ed9a25c
commit
688562a816
@ -837,13 +837,13 @@ function unActivateModule($value, $requiredby=1)
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO Cannot instantiate abstract class
|
||||
//$genericMod = new DolibarrModul($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));
|
||||
// TODO Replace this afte 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
|
||||
|
||||
@ -199,8 +199,11 @@ abstract class DolibarrModules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
abstract public function __construct($db);
|
||||
|
||||
//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.
|
||||
|
||||
/**
|
||||
* Enables a module.
|
||||
* Inserts all informations into database
|
||||
|
||||
Loading…
Reference in New Issue
Block a user