fix: database is not always needed

This commit is contained in:
Martin Ambrus
2017-10-22 22:04:11 +02:00
parent 5bcc00c903
commit 4c072951b5
2 changed files with 10 additions and 4 deletions
+9 -4
View File
@@ -4671,8 +4671,13 @@ References:
}
};
$database = new MYSQLi_DB;
$link = $database->return_link();
$GLOBALS['db'] = $database;
$GLOBALS['link'] = $database->return_link();
// database is not needed if we're displaying static pages
$req_file = basename($_SERVER['PHP_SELF']);
if (!in_array($req_file, ['tutorial.php', 'anleitung.php'])) {
$database = new MYSQLi_DB;
$link = $database->return_link();
$GLOBALS['db'] = $database;
$GLOBALS['link'] = $database->return_link();
}
?>