$data['text']='Cleaning up tables:'.PHP_EOL.implode(PHP_EOL,$infos);
Request::sendMessage($data);
$rows=0;
$pdo=DB::getPdo();
try{
$pdo->beginTransaction();
foreach($queriesas$query){
if($dbq=$pdo->query($query)){
$rows+=$dbq->rowCount();
}else{
TelegramLog::error('Error while executing query: '.$query);
}
}
$pdo->commit();// commit changes to the database and end transaction
}catch(PDOException$e){
$pdo->rollBack();// rollback changes on exception (useful if you want to track down error - you can't replicate it when some of the data is already deleted...)
$data['text']='*Database cleanup failed!* _(check your error logs)_';