Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
616f8dda
Commit
616f8dda
authored
12 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
New: Add a repair function to restore data into ecm_directories table
that was not sanitized.
parent
fad501d7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/install/lib/repair.lib.php
+34
-0
34 additions, 0 deletions
htdocs/install/lib/repair.lib.php
htdocs/install/repair.php
+5
-1
5 additions, 1 deletion
htdocs/install/repair.php
with
39 additions
and
1 deletion
htdocs/install/lib/repair.lib.php
+
34
−
0
View file @
616f8dda
...
...
@@ -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
;
}
?>
This diff is collapsed.
Click to expand it.
htdocs/install/repair.php
+
5
−
1
View file @
616f8dda
...
...
@@ -181,7 +181,7 @@ if ($ok)
foreach
(
$filelist
as
$file
)
{
print
'<tr><td nowrap>'
;
print
$langs
->
trans
(
"
ChoosedMigrate
Script"
)
.
'</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'
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment