diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php
index bc2f165a30c..229ae0a3c3e 100644
--- a/htdocs/install/repair.php
+++ b/htdocs/install/repair.php
@@ -901,61 +901,10 @@ if ($ok && GETPOST('set_empty_time_spent_amount','alpha'))
}
-// clean_old_module_entries: Clean data into const when files of module were removed without being
-if ($ok && GETPOST('clean_perm_table','alpha'))
-{
- print '
*** Clean table user_rights from lines of external modules no more enabled |
';
-
- $listofmods='';
- foreach($conf->modules as $key => $val)
- {
- $listofmods.=($listofmods?',':'')."'".$val."'";
- }
- $sql = 'SELECT id, libelle, module from '.MAIN_DB_PREFIX.'rights_def WHERE module not in ('.$listofmods.') AND id > 100000';
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- if ($num)
- {
- $i = 0;
- while ($i < $num)
- {
- $obj=$db->fetch_object($resql);
- if ($obj->id > 0)
- {
- print '| Found line with id '.$obj->id.', label "'.$obj->libelle.'" of module "'.$obj->module.'" to delete';
- if (GETPOST('clean_perm_table','alpha') == 'confirmed')
- {
- $sqldelete = 'DELETE FROM '.MAIN_DB_PREFIX.'rights_def WHERE id = '.$obj->id;
- $resqldelete = $db->query($sqldelete);
- if (! $resqldelete)
- {
- dol_print_error($db);
- }
- print ' - deleted';
- }
- print ' |
';
- }
- $i++;
- }
- }
- else
- {
- print '| No lines of a disabled external module (with id > 100000) found into table rights_def |
';
- }
- }
- else
- {
- dol_print_error($db);
- }
-}
-
-
// clean_old_module_entries: Clean data into const when files of module were removed without being
if ($ok && GETPOST('force_disable_of_modules_not_found','alpha'))
{
- print ' *** Force modules not found to be disabled |
';
+ print ' *** Force modules not found to be disabled (only modules adding js, css or hooks can be detected as removed) |
';
$arraylistofkey=array('hooks','js','css');
@@ -1071,6 +1020,56 @@ if ($ok && GETPOST('force_disable_of_modules_not_found','alpha'))
}
+// clean_old_module_entries: Clean data into const when files of module were removed without being
+if ($ok && GETPOST('clean_perm_table','alpha'))
+{
+ print ' *** Clean table user_rights from lines of external modules no more enabled |
';
+
+ $listofmods='';
+ foreach($conf->modules as $key => $val)
+ {
+ $listofmods.=($listofmods?',':'')."'".$val."'";
+ }
+ $sql = 'SELECT id, libelle, module from '.MAIN_DB_PREFIX.'rights_def WHERE module not in ('.$listofmods.') AND id > 100000';
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ if ($num)
+ {
+ $i = 0;
+ while ($i < $num)
+ {
+ $obj=$db->fetch_object($resql);
+ if ($obj->id > 0)
+ {
+ print '| Found line with id '.$obj->id.', label "'.$obj->libelle.'" of module "'.$obj->module.'" to delete';
+ if (GETPOST('clean_perm_table','alpha') == 'confirmed')
+ {
+ $sqldelete = 'DELETE FROM '.MAIN_DB_PREFIX.'rights_def WHERE id = '.$obj->id;
+ $resqldelete = $db->query($sqldelete);
+ if (! $resqldelete)
+ {
+ dol_print_error($db);
+ }
+ print ' - deleted';
+ }
+ print ' |
';
+ }
+ $i++;
+ }
+ }
+ else
+ {
+ print '| No lines of a disabled external module (with id > 100000) found into table rights_def |
';
+ }
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+}
+
// clean_linked_elements: Check and clean linked elements