Fixes directory structure

main
Yasen Pramatarov 2024-08-13 17:53:52 +03:00
parent 2cdfbe6e86
commit 8eed6afd46
18 changed files with 19 additions and 17 deletions

View File

@ -49,7 +49,7 @@ You can install it in the following ways:
- download the latest release from the **"Releases"** section here - download the latest release from the **"Releases"** section here
```bash ```bash
tar -xzf jilo-web_*.tgz tar -xzf jilo-web_*.tgz
cd jilo-web cd jilo-web/doc/
./install.sh ./install.sh
``` ```
- clone the **git repo**: - clone the **git repo**:
@ -66,7 +66,7 @@ cd jilo-web
- "sqlite_file" is the sqlite db file for jilo-web itself, it goes to `app/jilo-web.db`, create it with - "sqlite_file" is the sqlite db file for jilo-web itself, it goes to `app/jilo-web.db`, create it with
```bash ```bash
cd app cd app
cat doc/jilo-web.schema | sqlite3 jilo-web.db cat ../doc/jilo-web.schema | sqlite3 jilo-web.db
``` ```
- "jilo_database" is the sqlite db file for jilo, with data from the Jitsi logs - "jilo_database" is the sqlite db file for jilo, with data from the Jitsi logs

View File

@ -1,6 +1,6 @@
<?php <?php
$config = [ return [
// edit to customize // edit to customize
'domain' => 'localhost', // domain for the web app 'domain' => 'localhost', // domain for the web app
'folder' => '/jilo-web/', // subfolder for the web app, if any 'folder' => '/jilo-web/', // subfolder for the web app, if any
@ -10,8 +10,10 @@ $config = [
'login_message' => '', // will be displayed on login screen 'login_message' => '', // will be displayed on login screen
// edit only if needed for tests or debugging // edit only if needed for tests or debugging
'db' => [
'db_type' => 'sqlite', // DB type for the web app, currently only "sqlite" is used 'db_type' => 'sqlite', // DB type for the web app, currently only "sqlite" is used
'sqlite_file' => '../app/jilo-web.db', // default is ../app/jilo-web.db 'sqlite_file' => '../app/jilo-web.db', // default is ../app/jilo-web.db
],
'version' => '0.1.1', // system info 'version' => '0.1.1', // system info
]; ];

View File

@ -18,11 +18,11 @@ function connectDB($config, $database = '') {
} else { } else {
// sqlite database file // sqlite database file
if ($config['db_type'] === 'sqlite') { if ($config['db']['db_type'] === 'sqlite') {
try { try {
$db = new Database([ $db = new Database([
'type' => $config['db_type'], 'type' => $config['db']['db_type'],
'dbFile' => $config['sqlite_file'], 'dbFile' => $config['db']['sqlite_file'],
]); ]);
$pdo = $db->getConnection(); $pdo = $db->getConnection();
} catch (Exception $e) { } catch (Exception $e) {
@ -31,15 +31,15 @@ function connectDB($config, $database = '') {
exit(); exit();
} }
// mysql/mariadb database // mysql/mariadb database
} elseif ($config['db_type'] === 'mysql' || $config['db_type'] === 'mariadb') { } elseif ($config['db']['db_type'] === 'mysql' || $config['db']['db_type'] === 'mariadb') {
try { try {
$db = new Database([ $db = new Database([
'type' => $config['db_type'], 'type' => $config['db']['db_type'],
'host' => $config['sql_host'] ?? 'localhost', 'host' => $config['db']['sql_host'] ?? 'localhost',
'port' => $config['sql_port'] ?? '3306', 'port' => $config['db']['sql_port'] ?? '3306',
'dbname' => $config['sql_database'], 'dbname' => $config['db']['sql_database'],
'user' => $config['sql_username'], 'user' => $config['db']['sql_username'],
'password' => $config['sql_password'], 'password' => $config['db']['sql_password'],
]); ]);
$pdo = $db->getConnection(); $pdo = $db->getConnection();
} catch (Exception $e) { } catch (Exception $e) {
@ -49,7 +49,7 @@ function connectDB($config, $database = '') {
} }
// unknown database // unknown database
} else { } else {
$error = "Error: unknow database type \"{$config['db_type']}\""; $error = "Error: unknow database type \"{$config['db']['db_type']}\"";
include '../app/templates/block-message.php'; include '../app/templates/block-message.php';
exit(); exit();
} }

View File

@ -48,7 +48,7 @@ foreach ($config_file_locations as $location) {
} }
// if found, use it // if found, use it
if ($config_file) { if ($config_file) {
require_once $config_file; $config = require $config_file;
} else { } else {
die('Config file not found'); die('Config file not found');
} }