Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
apisub
Commits
def15d51
Commit
def15d51
authored
Feb 01, 2019
by
Stéphane Crozat
Browse files
Fixing install issues
parent
0d9b16c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
INSTALL
View file @
def15d51
# Create user and db
sql/db_init.sh (edit password first)
# PostgreSQL
# Connect
## Create user and db
sudo su postgres
sql/db_init.sh (edit path and password first)
## Test
psql -h localhost -U apisub -d apisub
# PHP
On Ubuntu, add XML lib to PHP
## Install
apt install php-pgsql
apt install php-xml
## Connexion
cp lib/connexion-sample.php lib/connexion.php
index.php
View file @
def15d51
<?php
session_start
();
if
(
!
isset
(
$_SESSION
[
'ticket'
]))
{
$DEVMODE
=
True
;
if
(
!
$DEVMODE
&&
!
isset
(
$_SESSION
[
'ticket'
]))
{
/* If session is already open for current PHP file, user is already logged in, do nothing
If session is not open on current PHP file, check if it is open on CAS server
If it is open on CAS server retrieve session informations
...
...
@@ -23,6 +25,13 @@ if (!isset($_SESSION['ticket'])) {
}
$_SESSION
[
'localcopy'
]
=
true
;
//call localcopy once per session
}
else
{
$_SESSION
[
'ticket'
]
=
'-1'
;
$_SESSION
[
'utclogin'
]
=
'crozatst'
;
$_SESSION
[
'mail'
]
=
'dev@mail.fr'
;
$_SESSION
[
'surname'
]
=
'Crozat/dev'
;
$_SESSION
[
'firstname'
]
=
'Stéphane/dev'
;
}
include
'lib/db.php'
;
include
'lib/views.php'
;
...
...
sql/db_init.sh
View file @
def15d51
#!/bin/bash
sqlfiles
=
'/
media/stc/data
/git/apisub/sql'
psql
-c
"DROP DATABASE apisub"
psql
-c
"DROP USER apisub"
sqlfiles
=
'/
home/stc
/git/apisub/sql'
psql
-c
"DROP DATABASE
IF EXISTS
apisub"
psql
-c
"DROP USER
IF EXISTS
apisub"
psql
-c
"CREATE USER apisub WITH ENCRYPTED PASSWORD 'password'"
psql
-c
"CREATE DATABASE apisub WITH OWNER apisub"
psql
-d
apisub
-f
"
$sqlfiles
/apisub_functions.sql"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment