Commit 66b80e1aacdc1a2ff41bd764d5beeb2f32a63b0b

Authored by Etienne Pallier
1 parent 51fb59d9
Exists in master and in 2 other branches dev, dev-IRAP

bugfix ldap

database/update/db-update-2019-06-05.sh 0 → 100755
... ... @@ -0,0 +1,57 @@
  1 +#!/bin/bash
  2 +
  3 +#myname=`basename $0 .sh`
  4 +myname=`basename $0`
  5 +myname=${myname%%.*}
  6 +
  7 +# Pour Mac OS recent (>=10.10, Yosemite), la syntaxe du SED est differente
  8 +# Il faut donc exécuter ce script de la manière suivante :
  9 +# ./macos-db-update.sh <ce_script.sh>
  10 +
  11 +
  12 +function abort() {
  13 + echo "******************************************************"
  14 + echo "!!! Script $0 aborté à cause d'une erreur d'exécution !!!"
  15 + echo "******************************************************"
  16 + exit 1
  17 +}
  18 +
  19 +
  20 +if [ ! -f ../../config/app.php ] ; then
  21 +echo "Vous devez executer ce script depuis le dossier database/update/"
  22 +exit 1
  23 +fi
  24 +
  25 +
  26 +# Get login, pass, dbname, and hostname
  27 +username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4) || abort
  28 +password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4) || abort
  29 +database=$(grep "/\*d\*/'database'" ../../config/app.php | cut -d"'" -f4) || abort
  30 +host=$(grep "/\*d\*/'host'" ../../config/app.php | cut -d"'" -f4) || abort
  31 +
  32 +
  33 +#cp -p ./script_sql/db-update-2016-07-01-irap.sql ./script_sql/db-update-2016-07-01-irap-build.sql
  34 +cp -p ./script_sql/$myname.sql ./script_sql/$myname-build.sql || abort
  35 +
  36 +# Execute sql update script
  37 +sed -e "s/database/$database/" -i ./script_sql/$myname-build.sql || abort
  38 +mysql --user=$username --password=$password -h $host < ./script_sql/$myname-build.sql || abort
  39 +
  40 +# Delete temporary file and cakephp cache (-f avoids warning if no file)
  41 +rm -f ./script_sql/$myname-build.sql
  42 +sudo rm -f ../../tmp/cache/models/*
  43 +sudo rm -f ../../tmp/cache/persistent/*
  44 +
  45 +# Faire ca aussi si ca suffit pas...
  46 +#sudo chmod -R 777 ../../tmp
  47 +#sudo chmod -R 777 ../../vendor
  48 +#sudo chmod -R 777 ../../webroot
  49 +
  50 +
  51 +# PLUGIN update
  52 +# Installation plugin cakephp-dompdf
  53 +# (on va a la racine du projet)
  54 +#cd ../../
  55 +#php composer.phar require daoandco/cakephp-dompdf
  56 +#bin/cake plugin assets symlink
  57 +#cd -
... ...
database/update/script_sql/db-update-2019-06-05.sql 0 → 100755
... ... @@ -0,0 +1,3 @@
  1 +use database;
  2 +
  3 +update configurations set ldap_cached = 0;
0 4 \ No newline at end of file
... ...