Skip to content

Commit 467dcf3

Browse files
authored
Merge pull request #454 from exussum12/dockerSupport
Add Docker Support
2 parents 5318f36 + b592204 commit 467dcf3

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

scripts/patchdb.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ if [ "$DBPORT" != "" ]
8585
then
8686
DBCMD="$DBCMD -P$DBPORT"
8787
fi
88-
DBCMD="$DBCMD $DBNAME"
8988

9089
###
9190
#
@@ -96,7 +95,7 @@ if [ "$INITDB" ]
9695
then
9796
PATCH_LEVEL=0
9897
else
99-
PATCH_LEVEL=$($DBCMD -e 'select max(patch_number) as num from patch_history' | grep -v num)
98+
PATCH_LEVEL=$($DBCMD $DBNAME -e 'select max(patch_number) as num from patch_history' | grep -v num)
10099

101100
if [ $? -gt 0 ]
102101
then
@@ -118,13 +117,15 @@ MAX_PATCH_LEVEL=$(ls $PATCH_DIR/patch*.sql | egrep -o 'patch[0-9]*.sql' | egrep
118117
if [ "$INITDB" ]
119118
then
120119
echo -n "Dropping and recreating DB before initialising it..."
121-
$($DBCMD -e "drop database $DBNAME; create database $DBNAME;")
120+
echo $DBCMD;
121+
$($DBCMD -e "drop database if exists $DBNAME; create database $DBNAME;")
122122
echo -n "Initialising DB..."
123-
$($DBCMD < $PATCH_DIR/init_db.sql)
124-
$($DBCMD < $PATCH_DIR/init_data.sql)
123+
$($DBCMD $DBNAME < $PATCH_DIR/init_db.sql)
124+
$($DBCMD $DBNAME < $PATCH_DIR/init_data.sql)
125125
echo " Ok"
126126
fi
127127

128+
DBCMD="$DBCMD $DBNAME"
128129

129130
for ((i=$(($PATCH_LEVEL + 1)); i <= $(($MAX_PATCH_LEVEL)); i++));
130131
do

src/database.php.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ if (! defined('BASEPATH')) {
5151
$active_group = "default";
5252
$active_record = true;
5353

54-
$db['default']['hostname'] = "localhost";
55-
$db['default']['username'] = "joind_in";
56-
$db['default']['password'] = "pleasechangeme";
54+
$db['default']['hostname'] = getenv('MYSQL_HOST') ?: "localhost";
55+
$db['default']['username'] = getenv('MYSQL_USER') ?: "joindin";
56+
$db['default']['password'] = getenv('MYSQL_PASSWORD') ?: "password";
5757
$db['default']['database'] = "joindin";
5858
$db['default']['dbdriver'] = "mysql";
5959
$db['default']['dbprefix'] = "";

src/public/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
if (!function_exists('apache_request_headers')) {
77
include '../inc/nginx-helper.php';
88
}
9-
9+
if(!ini_get('date.timezone')) {
10+
date_default_timezone_set('UTC');
11+
}
1012
// Add exception handler
1113
function handle_exception($e)
1214
{

0 commit comments

Comments
 (0)