mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-10 16:58:34 +02:00
Small automation script improvements
This commit is contained in:
parent
eb6e0e02af
commit
20565df739
2 changed files with 10 additions and 2 deletions
|
@ -222,7 +222,7 @@ try {
|
||||||
$stmt_contact = null;
|
$stmt_contact = null;
|
||||||
$dbh->commit();
|
$dbh->commit();
|
||||||
$log->info('job finished successfully.');
|
$log->info('job finished successfully.');
|
||||||
} catch (PDOException $e) {
|
} catch (Exception $e) {
|
||||||
$dbh->rollBack();
|
$dbh->rollBack();
|
||||||
$log->error('Database error: ' . $e->getMessage());
|
$log->error('Database error: ' . $e->getMessage());
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
|
|
@ -17,6 +17,8 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$dbh->beginTransaction();
|
||||||
|
|
||||||
// Prepare and execute the SQL statement to select unused hosts
|
// Prepare and execute the SQL statement to select unused hosts
|
||||||
$stmt = $dbh->prepare("SELECT h.id, h.name FROM host AS h
|
$stmt = $dbh->prepare("SELECT h.id, h.name FROM host AS h
|
||||||
LEFT JOIN domain_host_map AS m ON h.id = m.host_id
|
LEFT JOIN domain_host_map AS m ON h.id = m.host_id
|
||||||
|
@ -56,11 +58,17 @@ try {
|
||||||
$dbh->prepare("DELETE FROM contact_authInfo WHERE contact_id IN ($placeholders)")->execute($contact_ids);
|
$dbh->prepare("DELETE FROM contact_authInfo WHERE contact_id IN ($placeholders)")->execute($contact_ids);
|
||||||
$dbh->prepare("DELETE FROM contact WHERE id IN ($placeholders)")->execute($contact_ids);
|
$dbh->prepare("DELETE FROM contact WHERE id IN ($placeholders)")->execute($contact_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dbh->commit();
|
||||||
$log->info('job finished successfully.');
|
$log->info('job finished successfully.');
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$dbh->rollBack();
|
||||||
|
$log->error('Database error: ' . $e->getMessage());
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
$dbh->rollBack();
|
||||||
$log->error('Database error: ' . $e->getMessage());
|
$log->error('Database error: ' . $e->getMessage());
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
|
$dbh->rollBack();
|
||||||
$log->error('Error: ' . $e->getMessage());
|
$log->error('Error: ' . $e->getMessage());
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue