aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-06-24 01:57:39 +0200
committerThomas Lange <code@nerdmind.de>2021-06-24 01:57:39 +0200
commitbf26d7b44035722f21b6af13c098f1bb2720eb63 (patch)
treec2d9f92a3a66d380c8902f8c51eefa65aa4d9b47
parent40bd9ebb0fa5e566a8da1c8345259b1f922d9fec (diff)
downloadblog-bf26d7b44035722f21b6af13c098f1bb2720eb63.tar.gz
blog-bf26d7b44035722f21b6af13c098f1bb2720eb63.tar.xz
blog-bf26d7b44035722f21b6af13c098f1bb2720eb63.zip
Set Database attribute in Application class
-rw-r--r--core/application.php13
-rw-r--r--core/namespace/Application.php14
2 files changed, 13 insertions, 14 deletions
diff --git a/core/application.php b/core/application.php
index e4c481f..21ab203 100644
--- a/core/application.php
+++ b/core/application.php
@@ -142,19 +142,6 @@ $Language = Application::getLanguage();
$Database = Application::getDatabase();
#===============================================================================
-# Set Database attributes
-#===============================================================================
-$Database->setAttribute(
- $Database::ATTR_DEFAULT_FETCH_MODE,
- $Database::FETCH_ASSOC
-);
-
-$Database->setAttribute(
- $Database::ATTR_ERRMODE,
- $Database::ERRMODE_EXCEPTION
-);
-
-#===============================================================================
# Check if "304 Not Modified" and ETag header should be sent
#===============================================================================
if(Application::get('CORE.SEND_304') === TRUE AND !defined('ADMINISTRATION')) {
diff --git a/core/namespace/Application.php b/core/namespace/Application.php
index 1597801..3cecf3b 100644
--- a/core/namespace/Application.php
+++ b/core/namespace/Application.php
@@ -44,7 +44,19 @@ class Application {
$username = self::get('DATABASE.USERNAME');
$password = self::get('DATABASE.PASSWORD');
- self::$Database = new Database($hostname, $basename, $username, $password);
+ $Database = new Database($hostname, $basename, $username, $password);
+
+ $Database->setAttribute(
+ $Database::ATTR_DEFAULT_FETCH_MODE,
+ $Database::FETCH_ASSOC
+ );
+
+ $Database->setAttribute(
+ $Database::ATTR_ERRMODE,
+ $Database::ERRMODE_EXCEPTION
+ );
+
+ self::$Database = $Database;
}
return self::$Database;