PHP Classes
elePHPant
Icontem

File: build/dbconfig.sh

Recommend this page to a friend!
  Classes of Will Tinsdeall  >  Boiler Framework  >  build/dbconfig.sh  >  Download  
File: build/dbconfig.sh
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Boiler Framework
Web application framework that implements MVC
Author: By
Last change:
Date: 4 years ago
Size: 1,022 bytes
 

 

Contents

Class file image Download
DB=$1
USER=$2
PASSWD=$3
HOST=$4
PORT=$5

if [ -e "../config.php" ]; then
	exit;
fi;

echo -n "Server Name [$HOST]: ";
read NEW_HOST;
echo -n "Server Port [$PORT]: ";
read NEW_PORT;
echo -n "Server User [$USER]: ";
read NEW_USER;
echo -n "Server Password [$PASSWD]: ";
read NEW_PASSWD;
echo -n "Database Name [$DB]: ";
read NEW_DB;

if [ -n "$NEW_HOST" ]; then
	HOST=$NEW_HOST;
fi;

if [ -n "$NEW_PORT" ]; then
	PORT=$NEW_PORT;
fi;

if [ -n "$NEW_USER" ]; then
	USER=$NEW_USER;
fi;

if [ -n "$NEW_PASSWD" ]; then
	PASSWD=$NEW_PASSWD;
fi;

if [ -n "$NEW_DB" ]; then
	DB=$NEW_DB;
fi;

echo "<?php \$settings=array();" > ../config.php
echo "\$settings['database'] = array();" >> ../config.php
echo "\$settings['database']['user'] = '$USER';" >> ../config.php
echo "\$settings['database']['passwd'] = '$PASSWD';" >> ../config.php
echo "\$settings['database']['server'] = '$HOST';" >> ../config.php
echo "\$settings['database']['port'] = '$PORT';" >> ../config.php
echo "\$settings['database']['db'] = '$DB';" >> ../config.php