1
0
mirror of https://github.com/mbirth/tcl_update_db.git synced 2024-12-26 12:34:07 +00:00

Moved helper scripts to bin/ dir.

This commit is contained in:
Markus Birth 2017-12-18 15:02:24 +01:00
parent 9d3ad675ef
commit f37b98cbee
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
11 changed files with 25 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/data/ /data/
/config.ini
/otadb.db3 /otadb.db3

View File

@ -1,7 +1,7 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
$bkup_dir = __DIR__ . '/data/'; $bkup_dir = __DIR__ . '/../data/';
$file_list = glob($bkup_dir . '*.xml'); $file_list = glob($bkup_dir . '*.xml');

5
bin/get_data.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
MYDIR=$(dirname "$(readlink -f "$0")")
. "${MYDIR}/../config.ini"
rsync -av "${SYNC_REMOTE_DIR}/data/*" "${MYDIR}/../data/"

3
bin/initdb.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
MYDIR=$(dirname "$(readlink -f "$0")")
sqlite3 "${MYDIR}/../otadb.db3" < "${MYDIR}/../sql/dbschema.sql"

View File

@ -1,13 +1,13 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
require_once __DIR__ . '/lib/autoloader.php'; require_once __DIR__ . '/../lib/autoloader.php';
use \TclUpdates\GotuObject; use \TclUpdates\GotuObject;
use \TclUpdates\XmlParser; use \TclUpdates\XmlParser;
use \TclUpdates\SQLiteWriter; use \TclUpdates\SQLiteWriter;
$bkup_dir = __DIR__ . '/data/'; $bkup_dir = __DIR__ . '/../data/';
$file_list = glob($bkup_dir . '*.xml'); $file_list = glob($bkup_dir . '*.xml');
$sqlw = new SQLiteWriter(); $sqlw = new SQLiteWriter();

5
bin/put_data.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
MYDIR=$(dirname "$(readlink -f "$0")")
. "${MYDIR}/../config.ini"
rsync -av "${MYDIR}/../data" "${SYNC_REMOTE_DIR}/"

4
bin/put_db.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "${MYDIR}/../config.ini"
rsync -av "${MYDIR}/../otadb.db3" "${SYNC_REMOTE_DIR}/"

2
config.ini.example Executable file
View File

@ -0,0 +1,2 @@
SYNC_REMOTE_DIR=myhost.example.com:/var/www/htdocs/
NOTIFY_WEBHOOK=https://discordapp.com/api/webhooks/123456789012345678/aZZbGdefRghFTijgg6klmnXoIp--3qrsPD5L2t_Qwx0EyLzU-123ABCkk578Dq2d1GEJ

View File

@ -1,2 +0,0 @@
#!/bin/sh
sqlite3 otadb.db3 < sql/dbschema.sql

View File

@ -12,7 +12,7 @@ class SQLiteReader
public function __construct() public function __construct()
{ {
$this->dbFile = 'otadb.db3'; $this->dbFile = __DIR__ . '/../../otadb.db3';
$this->pdo = new \PDO('sqlite:' . $this->dbFile); $this->pdo = new \PDO('sqlite:' . $this->dbFile);
if ($this->pdo === false) { if ($this->pdo === false) {
return false; return false;

View File

@ -9,7 +9,7 @@ class SQLiteWriter
public function __construct() public function __construct()
{ {
$this->dbFile = 'otadb.db3'; $this->dbFile = __DIR__ . '/../../otadb.db3';
$this->pdo = new \PDO('sqlite:' . $this->dbFile); $this->pdo = new \PDO('sqlite:' . $this->dbFile);
if ($this->pdo === false) { if ($this->pdo === false) {
return false; return false;