Open only one DB connection per PHP call
This commit is contained in:
parent
e270333055
commit
7fc7a002e3
6 changed files with 34 additions and 84 deletions
|
|
@ -4,7 +4,7 @@ if(!defined('ONYX')) exit;
|
|||
|
||||
function remove_themes($id)
|
||||
{
|
||||
$db = new BDD();
|
||||
global $db;
|
||||
$res = $db->query("SELECT id FROM exercices WHERE id_theme = ".$id);
|
||||
foreach($res as $r)
|
||||
{
|
||||
|
|
@ -17,7 +17,6 @@ function remove_themes($id)
|
|||
|
||||
$db->query("DELETE FROM exercices WHERE id_theme = ".$id);
|
||||
$db->query("DELETE FROM themes WHERE id = ".$id);
|
||||
$db->deconnexion();
|
||||
|
||||
Cache::del("ordered_th".$id);
|
||||
}
|
||||
|
|
@ -33,14 +32,13 @@ if (!empty($_GET["delete"]))
|
|||
}
|
||||
else if (isset($_GET["drop"]))
|
||||
{
|
||||
$db = new BDD();
|
||||
global $db;
|
||||
$db->query("TRUNCATE exercice_files");
|
||||
$db->query("TRUNCATE exercice_keys");
|
||||
$db->query("TRUNCATE exercice_tries");
|
||||
$db->query("TRUNCATE exercices");
|
||||
$db->query("TRUNCATE themes");
|
||||
$db->query("TRUNCATE solved");
|
||||
$db->deconnexion();
|
||||
|
||||
header("Location: /".SALT_ADMIN."/themes");
|
||||
exit;
|
||||
|
|
|
|||
Reference in a new issue