diff options
| author | 2013-10-26 16:37:02 +0200 | |
|---|---|---|
| committer | 2013-10-26 16:37:02 +0200 | |
| commit | 94a887f321e7ed35b0a7d052e93d9ffe0e3c0b9b (patch) | |
| tree | 32194b01bd43f68a06ee3daa94564a842e8e45b9 /lib | |
| parent | 3ac2495f49ef0e5ef62030c97ecfd931ce7e4a8b (diff) | |
| parent | 410b47603a72947b33ae3cbe92968c8c824e194e (diff) | |
Merge branch 'sqlOptimisation' of https://github.com/Alkarex/FreshRSS into Alkarex-sqlOptimisation
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/minz/dao/Model_pdo.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/minz/dao/Model_pdo.php b/lib/minz/dao/Model_pdo.php index fa44038db..343b7004a 100755 --- a/lib/minz/dao/Model_pdo.php +++ b/lib/minz/dao/Model_pdo.php @@ -9,6 +9,14 @@ * Seul la connexion MySQL est prise en charge pour le moment */ class Model_pdo { + + /** + * Partage la connexion à la base de données entre toutes les instances. + */ + public static $useSharedBd = true; + private static $sharedBd = null; + private static $sharedPrefix; + /** * $bd variable représentant la base de données */ @@ -21,6 +29,12 @@ class Model_pdo { * HOST, BASE, USER et PASS définies dans le fichier de configuration */ public function __construct () { + if (self::$useSharedBd && self::$sharedBd != null) { + $this->bd = self::$sharedBd; + $this->prefix = self::$sharedPrefix; + return; + } + $db = Configuration::dataBase (); $driver_options = null; @@ -46,8 +60,10 @@ class Model_pdo { $db['password'], $driver_options ); + self::$sharedBd = $this->bd; $this->prefix = $db['prefix']; + self::$sharedPrefix = $this->prefix; } catch (Exception $e) { throw new PDOConnectionException ( $string, |
