mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48:29 +00:00
Close database connection at the end of a table recovery.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -59,7 +59,7 @@ function archive_add_table($name, $table)
|
||||
*/
|
||||
function archive_restore_table($file, $table, $flush=false)
|
||||
{
|
||||
global $archive, $db;
|
||||
global $db;
|
||||
|
||||
$json_string = file_get_contents($file);
|
||||
// Return early if we cannot extract the JSON string
|
||||
@@ -128,12 +128,17 @@ function archive_restore_table($file, $table, $flush=false)
|
||||
$stmt->bindValue(":comment", $row["comment"], $type);
|
||||
}
|
||||
|
||||
$stmt->execute();
|
||||
$stmt->reset();
|
||||
$stmt->clear();
|
||||
$num++;
|
||||
if($stmt->execute() && $stmt->reset() && $stmt->clear())
|
||||
$num++;
|
||||
else
|
||||
{
|
||||
$stmt->close();
|
||||
return $num;
|
||||
}
|
||||
}
|
||||
|
||||
// Close database connection and return number or processed rows
|
||||
$stmt->close();
|
||||
return $num;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user