Project

General

Profile

Paste
Download (1.03 KB) Statistics
| Branch: | Revision:

root / scripts_divers / d7-all-gen-settings-local.sh @ 65ce03da

1
#!/bin/sh
2

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

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

    
8
for settings in $(find $d7_dir_sites -mindepth 2 -maxdepth 2 -name settings.php) ; do
9
    # Get infos from settings.php
10
    d7_site_name=$(grep "^\s*'database' => '\(.*\)'" $settings | sed "s/^ *'database' => '\(.*\)'.*/\1/")
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/")
14

    
15
    settings_dir=`give_dir $settings`
16

    
17
    chmod 700 $settings
18

    
19
    rm $settings
20

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

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

    
27
    generate_settings_local $d7_site_name $site_password $d7_settings_local_template settings.local.php
28

    
29
    chmod 400 settings.local.php
30
done