Fixed themes drop
This commit is contained in:
parent
0f7c1bc7e9
commit
01624d389c
@ -8,9 +8,11 @@ function remove_themes($id)
|
||||
$res = $db->query("SELECT id FROM exercices WHERE id_theme = ".$id);
|
||||
foreach($res as $r)
|
||||
{
|
||||
$db->query("DELETE FROM exercice_files WHERE id_exercice = ".$id);
|
||||
$db->query("DELETE FROM exercice_keys WHERE id_exercice = ".$id);
|
||||
$db->query("DELETE FROM solved WHERE id_exercice = ".$id);
|
||||
$id_ex = $r['id'];
|
||||
$db->escape($id_ex);
|
||||
$db->query("DELETE FROM exercice_files WHERE id_exercice = '".$id_ex."'");
|
||||
$db->query("DELETE FROM exercice_keys WHERE id_exercice = '".$id_ex."'");
|
||||
$db->query("DELETE FROM solved WHERE id_exercice = '".$id_ex."'");
|
||||
}
|
||||
|
||||
$db->query("DELETE FROM exercices WHERE id_theme = ".$id);
|
||||
@ -29,10 +31,13 @@ if (!empty($_GET["delete"]))
|
||||
}
|
||||
else if (isset($_GET["drop"]))
|
||||
{
|
||||
foreach(Theme::get_themes() as $thm)
|
||||
{
|
||||
remove_themes($thm->get_id());
|
||||
}
|
||||
$db = new BDD();
|
||||
$db->query("TRUNCATE exercice_files");
|
||||
$db->query("TRUNCATE exercice_keys");
|
||||
$db->query("TRUNCATE exercices");
|
||||
$db->query("TRUNCATE themes");
|
||||
$db->query("TRUNCATE solved");
|
||||
$db->deconnexion();
|
||||
|
||||
header("Location: /".SALT_ADMIN."/themes");
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user