Commit 17150feb67c4ea96d8a416e5906732912c8689f9

Authored by Etienne Pallier
1 parent 568c060d
Exists in master and in 1 other branch dev

Fiabilisation du nouveau script database/update/db-update.sh (v3.7.9.72)

Showing 3 changed files with 17 additions and 19 deletions   Show diff stats
CHANGES.txt
... ... @@ -72,6 +72,10 @@ Outre ces changements, voici d'autres changements importants :
72 72 ======= CHANGES =======
73 73  
74 74 -------
  75 +24/07/2020 v3.7.9.72 (EP)
  76 + - (i) Fiabilisation du nouveau script database/update/db-update.sh
  77 +
  78 +-------
75 79 23/07/2020 v3.7.9.69-71 (EP)
76 80 - (b) Bugfix OrganismesController getArticle => public
77 81 - .gitignore modifs : ignorer dossier Eclipse .metadata/...
... ...
README.md
... ... @@ -42,8 +42,8 @@ Logiciel testé et validé sur les configurations suivantes :
42 42  
43 43 --------------------------------------------------------------------------------------------
44 44  
45   -Date: 23/07/2020
46   -Version: 3.7.9.71
  45 +Date: 24/07/2020
  46 +Version: 3.7.9.72
47 47  
48 48  
49 49 HISTORIQUE DES CHANGEMENTS DE VERSION : voir le fichier CHANGES.txt (ou la page web /pages/changes)
... ...
database/update/db-update.sh
... ... @@ -2,7 +2,7 @@
2 2  
3 3 # Pour Mac OS recent (>=10.10, Yosemite), la syntaxe du SED est differente
4 4 # Il faut donc exécuter ce script de la manière suivante :
5   -# ./macos-db-update.sh <ce_script.sh>
  5 +# ./macos-db-update.sh <ce_script.sh> db-update-AAAA-MM-JJ.sql
6 6  
7 7  
8 8 if [ ! -f ../../config/app.php ] ; then
... ... @@ -26,10 +26,10 @@ function abort() {
26 26  
27 27  
28 28 # Exit si ce script n'existe pas
29   -#if [[ ! -f ./script_sql/$sqlscript ]] ; then
30   -if [[ ! -f ./$sqlscript ]] ; then
31   - #echo "Le script SQL script_sql/$sqlscript n'existe pas"
32   - echo "Le script SQL $sqlscript n'existe pas"
  29 +# Juste le nom du script sql, sans le path qui pourrait être devant
  30 +sqlscript=$(basename $sqlscript)
  31 +if [[ ! -f ./script_sql/$sqlscript ]] ; then
  32 + echo "Le script SQL ./script_sql/$sqlscript n'existe pas"
33 33 abort
34 34 fi
35 35  
... ... @@ -39,10 +39,6 @@ sqlscript_name=${sqlscript%%.*}
39 39 #echo $sqlscript_name
40 40  
41 41  
42   -
43   -
44   -
45   -
46 42 # Get login, pass, dbname, and hostname
47 43 username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4) || abort
48 44 password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4) || abort
... ... @@ -52,21 +48,19 @@ host=$(grep &quot;/\*d\*/&#39;host&#39;&quot; ../../config/app.php | cut -d&quot;&#39;&quot; -f4) || abort
52 48  
53 49 #cp -p ./script_sql/db-update-2016-07-01-irap.sql ./script_sql/db-update-2016-07-01-irap-build.sql
54 50 #cp -p ./script_sql/$sqlscript.sql ./script_sql/$sqlscript-build.sql || abort
55   -#cp -p ./script_sql/$sqlscript_name.sql ./script_sql/$sqlscript_name-build.sql || abort
56   -cp -p ./$sqlscript_name.sql ./$sqlscript_name-build.sql || abort
  51 +cp -p ./script_sql/$sqlscript_name.sql ./script_sql/$sqlscript_name-build.sql || abort
  52 +#ls -l ./script_sql/
57 53  
58 54 # Execute sql update script
59   -#sed -e "s/database/$database/" -i ./script_sql/$sqlscript-build.sql || abort
60   -sed -e "s/database/$database/" -i ./$sqlscript_name-build.sql || abort
  55 +sed -e "s/database/$database/" -i ./script_sql/$sqlscript_name-build.sql || abort
61 56  
62   -#mysql --user=$username --password=$password -h $host < ./script_sql/$sqlscript_name-build.sql || abort
63   -mysql --user=$username --password=$password -h $host < ./$sqlscript_name-build.sql || abort
  57 +mysql --user=$username --password=$password -h $host < ./script_sql/$sqlscript_name-build.sql || abort
64 58  
65 59 # Delete temporary file and cakephp cache (-f avoids warning if no file)
66   -#rm -f ./script_sql/$sqlscript_name-build.sql
67   -rm -f ./$sqlscript_name-build.sql
  60 +rm -f ./script_sql/$sqlscript_name-build.sql
68 61 sudo rm -f ../../tmp/cache/models/*
69 62 sudo rm -f ../../tmp/cache/persistent/*
  63 +#ls -l ./script_sql/
70 64  
71 65 # Faire ca aussi si ca suffit pas...
72 66 #sudo chmod -R 777 ../../tmp
... ...