Compare commits
2 Commits
97a95c9a91
...
69aef9fb9f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69aef9fb9f | ||
|
|
e38d98b1a1 |
@ -6,6 +6,8 @@ module.exports = {
|
|||||||
// chez ultracc par exemple la commande est app-ports free
|
// chez ultracc par exemple la commande est app-ports free
|
||||||
port: Voir indications ci dessus,
|
port: Voir indications ci dessus,
|
||||||
|
|
||||||
|
// choisir mysql ou sqlite
|
||||||
|
dbtype: 'sqlite',
|
||||||
// Chemin vers le fichier de base de données SQLite
|
// Chemin vers le fichier de base de données SQLite
|
||||||
dbFile: path.join(__dirname, 'base_autopost.db'),
|
dbFile: path.join(__dirname, 'base_autopost.db'),
|
||||||
|
|
||||||
|
|||||||
14
bin/postauto
14
bin/postauto
@ -7,14 +7,20 @@ source /home/$USER/autopost/common.sh
|
|||||||
checkdb() {
|
checkdb() {
|
||||||
if [ "$dbtype" = "sqlite" ]; then
|
if [ "$dbtype" = "sqlite" ]; then
|
||||||
if [ ! -f "$DB_FILE" ]; then
|
if [ ! -f "$DB_FILE" ]; then
|
||||||
echo "La base de données n'existe pas. Création..."
|
echo "La base de données SQLite n'existe pas. Création…"
|
||||||
do_createdb
|
do_createdb
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Vérifie si la table existe, sinon crée-la
|
# Échapper _ et % pour LIKE
|
||||||
exists=$(db_query "SHOW TABLES LIKE \`$MYSQL_TABLE\`;")
|
local pattern=${MYSQL_TABLE//_/\\_}
|
||||||
|
pattern=${pattern//%/\\%}
|
||||||
|
|
||||||
|
# Assure-toi que db_query utilise `mysql -N -B` pour ne pas avoir d'entêtes
|
||||||
|
local exists
|
||||||
|
exists=$(db_query "SHOW TABLES LIKE '${pattern}';" | tr -d '[:space:]')
|
||||||
|
|
||||||
if [ -z "$exists" ]; then
|
if [ -z "$exists" ]; then
|
||||||
echo "La table 'release' n'existe pas. Création..."
|
echo "La table '${MYSQL_TABLE}' n'existe pas. Création…"
|
||||||
do_createdb
|
do_createdb
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user