1
1
Fork 0

Merge pull request #9587 from annando/initial

Fix: Only echo on verbose
This commit is contained in:
Hypolite Petovan 2020-11-23 15:10:56 -05:00 committed by GitHub
commit 6fac2fc2a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1090,9 +1090,9 @@ class DBStructure
echo "Zero user added\n"; echo "Zero user added\n";
} }
} }
} elseif (self::existsTable('user')) { } elseif (self::existsTable('user') && $verbose) {
echo "Zero user already added\n"; echo "Zero user already added\n";
} else { } elseif ($verbose) {
echo "user: Table not found\n"; echo "user: Table not found\n";
} }
@ -1105,12 +1105,27 @@ class DBStructure
echo "Zero contact added\n"; echo "Zero contact added\n";
} }
} }
} elseif (self::existsTable('contact')) { } elseif (self::existsTable('contact') && $verbose) {
echo "Zero contact already added\n"; echo "Zero contact already added\n";
} else { } elseif ($verbose) {
echo "contact: Table not found\n"; echo "contact: Table not found\n";
} }
if (self::existsTable('tag') && !DBA::exists('tag', ['id' => 0])) {
DBA::insert('tag', ['name' => '']);
$lastid = DBA::lastInsertId();
if ($lastid != 0) {
DBA::update('tag', ['id' => 0], ['id' => $lastid]);
if ($verbose) {
echo "Zero tag added\n";
}
}
} elseif (self::existsTable('tag') && $verbose) {
echo "Zero tag already added\n";
} elseif ($verbose) {
echo "tag: Table not found\n";
}
if (self::existsTable('permissionset')) { if (self::existsTable('permissionset')) {
if (!DBA::exists('permissionset', ['id' => 0])) { if (!DBA::exists('permissionset', ['id' => 0])) {
DBA::insert('permissionset', ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']); DBA::insert('permissionset', ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']);
@ -1118,7 +1133,7 @@ class DBStructure
if ($lastid != 0) { if ($lastid != 0) {
DBA::update('permissionset', ['id' => 0], ['id' => $lastid]); DBA::update('permissionset', ['id' => 0], ['id' => $lastid]);
if ($verbose) { if ($verbose) {
echo "Zero tag added\n"; echo "Zero permissionset added\n";
} }
} }
} elseif ($verbose) { } elseif ($verbose) {
@ -1149,21 +1164,6 @@ class DBStructure
echo "permissionset: Table not found\n"; echo "permissionset: Table not found\n";
} }
if (self::existsTable('tag') && !DBA::exists('tag', ['id' => 0])) {
DBA::insert('tag', ['name' => '']);
$lastid = DBA::lastInsertId();
if ($lastid != 0) {
DBA::update('tag', ['id' => 0], ['id' => $lastid]);
if ($verbose) {
echo "Zero tag added\n";
}
}
} elseif (self::existsTable('tag')) {
echo "Zero tag already added\n";
} else {
echo "tag: Table not found\n";
}
if (!self::existsForeignKeyForField('tokens', 'client_id')) { if (!self::existsForeignKeyForField('tokens', 'client_id')) {
$tokens = DBA::p("SELECT `tokens`.`id` FROM `tokens` $tokens = DBA::p("SELECT `tokens`.`id` FROM `tokens`
LEFT JOIN `clients` ON `clients`.`client_id` = `tokens`.`client_id` LEFT JOIN `clients` ON `clients`.`client_id` = `tokens`.`client_id`