Project

General

Profile

Revision 8f9b0d95

Added by Julien Enselme over 10 years ago

Création des settings.local.php

Petites modifications afin que le script fonctionne.

View differences:

scripts_divers/d7-all-gen-settings-local.sh
1 1
#!/bin/sh
2 2

  
3
. /users/guest/assos/bin/script-config.sh
3
. /users/guest/assos/bin/scripts-config.sh
4 4
. /users/guest/assos/bin/scripts-utils.sh
5 5

  
6 6
# This script generate settings.php and settings.local.php from settings.php
7 7

  
8 8
for settings in $(find $d7_dir_sites -mindepth 2 -maxdepth 2 -name settings.php) ; do
9 9
    # Get infos from settings.php
10
    d7_site_name=$(grep "^\s*'database' => '\(.*\)'" $settings | sed "s/^ *'database' => '\(.*\)'.*/\1/")
10
    db_name=$(grep "^ *'database' => '\(.*\)'" $settings | sed "s/^ *'database' => '\(.*\)'.*/\1/")
11 11
    db_user=$(grep "^ *'username' => '\(.*\)'" $settings | sed "s/^ *'username' => '\(.*\)'.*/\1/")
12
    db_password=$(grep "^\s*'password' => '\(.*\)'" $settings | sed "s/^ *'password' => '\(.*\)'.*/\1/")
13
    base_url=$(grep "^\s*\$base_url = '\(.*\)'" $settings | sed "s/^ *\$base_url = '\(.*\)'.*/\1/")
12
    db_password=$(grep "^ *'password' => '\(.*\)'" $settings | sed "s/^ *'password' => '\(.*\)'.*/\1/")
13
    base_url=$(grep "^ *\$base_url = '\(.*\)'" $settings | sed "s/^ *\$base_url = '\(.*\)'.*/\1/")
14 14

  
15 15
    settings_dir=`give_dir $settings`
16 16

  
......
20 20

  
21 21
    # We go into the settings.php directory.
22 22
    cd $settings_dir
23
    pwd
23 24

  
24 25
    cp $d7_settings settings.php
25 26
    chmod 400 settings.php
26 27

  
27
    generate_settings_local $d7_site_name $site_password $d7_settings_local_template settings.local.php
28
    sed "s/\%\%DBUSER\%\%/$db_user/ ; s/\%\%DBNAME\%\%/$db_name/ ; s/\%\%DBPASS\%\%/$db_password/ ; s#\%\%BASE_URL\%\%#$base_url#" < ~/tmp/d7-settings-local-template.php > settings.local.php
28 29

  
29 30
    chmod 400 settings.local.php
30 31
done

Also available in: Unified diff