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
70c4f0bd
Commit
70c4f0bd
authored
16 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
New: Can fix some fatal errors with a repair script.
parent
b96f5017
Branches
Branches containing commit
Tags
Tags containing commit
Loading
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ChangeLog
+1
-0
1 addition, 0 deletions
ChangeLog
htdocs/install/upgrade.php
+139
-109
139 additions, 109 deletions
htdocs/install/upgrade.php
mysql/migration/2.6.0-2.7.0.sql
+0
-5
0 additions, 5 deletions
mysql/migration/2.6.0-2.7.0.sql
mysql/migration/repair.sql
+13
-0
13 additions, 0 deletions
mysql/migration/repair.sql
with
153 additions
and
114 deletions
ChangeLog
+
1
−
0
View file @
70c4f0bd
...
...
@@ -42,6 +42,7 @@ For developers:
- Updated wiki documentation.
- Better W3C standard.
- Can add data provided with a module.
- Can fix some corruptions in database by calling the update page with action=repair
***** Changelog for 2.6 compared to 2.5 *****
...
...
This diff is collapsed.
Click to expand it.
htdocs/install/upgrade.php
+
139
−
109
View file @
70c4f0bd
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-200
8
Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-200
9
Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -19,9 +19,10 @@
*/
/**
\file htdocs/install/upgrade.php
\brief Run migration script
\version $Id$
* \file htdocs/install/upgrade.php
* \brief Run migration script
* \version $Id$
* \remarks Can be also called directly with http://mydolibarr/install/upgrade.php?action=repair
*/
include_once
(
"./inc.php"
);
...
...
@@ -60,14 +61,22 @@ dolibarr_install_syslog("upgrade: Entering upgrade.php page");
if
(
!
is_object
(
$conf
))
dolibarr_install_syslog
(
"upgrade2: conf file not initialized"
,
LOG_ERR
);
/*
* View
*/
pHeader
(
$langs
->
trans
(
"DatabaseMigration"
),
"upgrade2"
,
"upgrade"
);
$actiondone
=
0
;
if
(
!
isset
(
$_GET
[
"action"
])
||
$_GET
[
"action"
]
==
"upgrade"
)
// Action to launch the repair or migrate script
if
(
!
isset
(
$_GET
[
"action"
])
||
$_GET
[
"action"
]
==
"upgrade"
||
$_GET
[
"action"
]
==
"repair"
)
{
$actiondone
=
1
;
print
'<h3>'
.
$langs
->
trans
(
"DatabaseMigration"
)
.
'<h3>'
;
if
(
!
$versionfrom
&&
!
$versionto
)
if
(
$_GET
[
"action"
]
!=
"repair"
&&
!
$versionfrom
&&
!
$versionto
)
{
print
'<div class="error">Parameter versionfrom or version to missing.</div>'
;
exit
;
...
...
@@ -138,7 +147,12 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
print
'<tr><td colspan="2">'
.
$langs
->
trans
(
"PleaseBePatient"
)
.
'</td></tr>'
;
flush
();
// Delete duplicates in table categorie_association
if
(
$_GET
[
"action"
]
!=
"repair"
)
{
/*
* Delete duplicates in table categorie_association
*/
$couples
=
array
();
$filles
=
array
();
$sql
=
"SELECT fk_categorie_mere, fk_categorie_fille"
;
...
...
@@ -203,7 +217,9 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
print
'<div class="error">'
.
$langs
->
trans
(
"Error"
)
.
'</div>'
;
}
/*
* Remove deprecated indexes and constraints
*/
if
(
$ok
)
{
$versioncommande
=
split
(
'\.'
,
'4.0'
);
...
...
@@ -257,12 +273,11 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
}
}
}
}
/***************************************************************************************
*
* Chargement fichiers dans migration
*
***************************************************************************************/
/*
* Load sql files
*/
if
(
$ok
)
{
if
(
$choix
==
1
)
$dir
=
"../../mysql/migration/"
;
...
...
@@ -284,7 +299,9 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
}
sort
(
$filesindir
);
# Determine les fichiers sql a passer
# Define which file to run
if
(
$_GET
[
"action"
]
!=
"repair"
)
{
foreach
(
$filesindir
as
$file
)
{
if
(
eregi
(
$from
,
$file
))
...
...
@@ -296,6 +313,17 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
$filelist
[]
=
$file
;
}
}
}
else
{
foreach
(
$filesindir
as
$file
)
{
if
(
eregi
(
'repair'
,
$file
))
{
$filelist
[]
=
$file
;
}
}
}
# Boucle sur chaque fichier
foreach
(
$filelist
as
$file
)
...
...
@@ -314,7 +342,9 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
if
(
$db
->
connected
)
$db
->
close
();
}
else
if
(
empty
(
$actiondone
))
{
print
'<div class="error">'
.
$langs
->
trans
(
"ErrorWrongParameters"
)
.
'</div>'
;
}
...
...
This diff is collapsed.
Click to expand it.
mysql/migration/2.6.0-2.7.0.sql
+
0
−
5
View file @
70c4f0bd
...
...
@@ -172,8 +172,3 @@ alter table llx_commande_fournisseur add column ref_supplier varchar(30
alter
table
llx_mailing
add
column
bgcolor
varchar
(
8
)
after
body
;
alter
table
llx_mailing
add
column
bgimage
varchar
(
255
)
after
bgcolor
;
-- Request to clean corrupted database
delete
from
llx_facture
where
facnumber
=
'(PROV)'
;
delete
from
llx_commande
where
ref
=
'(PROV)'
;
delete
from
llx_propal
where
ref
=
'(PROV)'
;
This diff is collapsed.
Click to expand it.
mysql/migration/repair.sql
0 → 100644
+
13
−
0
View file @
70c4f0bd
--
-- $Id$
--
-- Script to repair some fatal errors due to database corruption
--
-- when current version is 2.6.0 or higher.
--
-- Request to clean corrupted database
delete
from
llx_facture
where
facnumber
=
'(PROV)'
;
delete
from
llx_commande
where
ref
=
'(PROV)'
;
delete
from
llx_propal
where
ref
=
'(PROV)'
;
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