Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
32 righe
1.5 KiB
32 righe
1.5 KiB
<? |
|
if (!empty($elabora_coda)) { |
|
alertManager::printCliInfo("Creazione db tenant"); |
|
$enti = $pdo->go("SELECT codice FROM b_enti WHERE db = 'W'")->fetchAll(PDO::FETCH_ASSOC); |
|
if (!empty($enti)) { |
|
$found = []; |
|
$updateStato = $pdo->prepare("UPDATE b_enti SET db = :stato WHERE codice = :codice"); |
|
foreach($enti AS $ente) { |
|
$updateStato->bindValue(":codice",$ente["codice"]); |
|
if ($pdo->go("SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '{$config["prefix_db"]}_ente{$ente["codice"]}'")->rowCount() === 0) { |
|
shell_exec("php {$config["cmds_folder"]}/artisan tenantdb:create {$ente["codice"]} --force 2>&1"); |
|
} |
|
if ($pdo->go("SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '{$config["prefix_db"]}_ente{$ente["codice"]}'")->rowCount() === 0) { |
|
$updateStato->bindValue(":stato","E"); |
|
$mailer = new Communicator(); |
|
$mailer->oggetto = "ERRORE CREAZIONE DB" . $ente["codice"]; |
|
$mailer->corpo = "ERRORE CREAZIONE DB" . $ente["codice"]; |
|
$mailer->codice_pec = -2; |
|
$mailer->comunicazione = false; |
|
$mailer->coda = false; |
|
$mailer->intestazione = false; |
|
$mailer->destinatari = "assistenza@studioamica.it"; |
|
$esito = $mailer->send(); |
|
alertManager::printCliAlert($mailer->oggetto); |
|
} else { |
|
$updateStato->bindValue(":stato","S"); |
|
} |
|
$updateStato->execute(); |
|
} |
|
} |
|
} |
|
?>
|
|
|