New: Add a repair function to restore data into ecm_directories table
that was not sanitized.
This commit is contained in:
parent
fad501d777
commit
616f8ddaa8
@ -109,4 +109,38 @@ function checkLinkedElements($sourcetype, $targettype)
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean data into ecm_directories table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function clean_data_ecm_directories()
|
||||
{
|
||||
global $db, $langs;
|
||||
|
||||
// Clean data from ecm_directories
|
||||
$sql="SELECT rowid, label FROM ".MAIN_DB_PREFIX."ecm_directories";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while($obj=$db->fetch_object($resql))
|
||||
{
|
||||
$id=$obj->rowid;
|
||||
$label=$obj->label;
|
||||
$newlabel=dol_sanitizeFileName($label);
|
||||
if ($label != $newlabel)
|
||||
{
|
||||
$sqlupdate="UPDATE ".MAIN_DB_PREFIX."ecm_directories set label='".$newlabel."' WHERE rowid=".$id;
|
||||
print '<tr><td>'.$sqlupdate."</td></tr>\n";
|
||||
$resqlupdate=$db->query($sqlupdate);
|
||||
if (! $resqlupdate) dol_print_error($db,'Failed to update');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else dol_print_error($db,'Failed to run request');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -181,7 +181,7 @@ if ($ok)
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
print '<tr><td nowrap>';
|
||||
print $langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>';
|
||||
print $langs->trans("Script").'</td><td align="right">'.$file.'</td></tr>';
|
||||
|
||||
$name = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
@ -262,6 +262,10 @@ foreach($listofmodulesextra as $tablename => $elementtype)
|
||||
}
|
||||
|
||||
|
||||
// Clean data into ecm_directories table
|
||||
clean_data_ecm_directories();
|
||||
|
||||
|
||||
// Check and clean linked elements
|
||||
if (GETPOST('clean_linked_elements'))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user