summaryrefslogtreecommitdiffstats
path: root/build/prepareTestsOracle.sh
blob: 65a590366591a0f3da6818b51a0c068342afa333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#
# ownCloud - prepareTestOracle.sh
#
# @author Morris Jobke
# @copyright 2014 Morris Jobke hey@morrisjobke.de
#

DATABASENAME=$1
DATABASEUSER=$2
ADMINLOGIN=$3
DATADIR=$4

# set oracle home if it is not set
TRAVIS_ORACLE_HOME="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server"
[ -z "$ORACLE_HOME" ] && ORACLE_HOME=$TRAVIS_ORACLE_HOME

echo "Load Oracle environment variables so that we can run 'sqlplus'."
 . $ORACLE_HOME/bin/oracle_env.sh

echo "drop the database"
sqlplus64 -s -l / as sysdba <<EOF
	drop user $DATABASENAME cascade;
EOF

echo "create the database"
sqlplus64 -s -l / as sysdba <<EOF
	create user $DATABASENAME identified by owncloud;
	alter user $DATABASENAME default tablespace users
	temporary tablespace temp
	quota unlimited on users;
	grant create session
	, create table
	, create procedure
	, create sequence
	, create trigger
	, create view
	, create synonym
	, alter session
	to $DATABASENAME;
	exit;
EOF

# there was a maximum cursor limit exceed
# therefore increase the limit
sqlplus64 -s -l / as sysdba <<EOF
	ALTER SYSTEM SET open_cursors = 1000 SCOPE=BOTH;
EOF

cat > ./config/autoconfig.php <<DELIM
<?php
\$AUTOCONFIG = array (
  'installed' => false,
  'dbtype' => 'oci',
  'dbtableprefix' => 'oc_',
  'adminlogin' => '$ADMINLOGIN',
  'adminpass' => 'admin',
  'directory' => '$DATADIR',
  'dbuser' => '$DATABASEUSER',
  'dbname' => 'XE',
  'dbhost' => 'localhost',
  'dbpass' => 'owncloud',
);
DELIM