aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/ModelPdo.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-31 16:57:11 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-31 16:57:11 +0100
commit54479a5027d83b5dc8deee5e2795c9d89c732ba0 (patch)
tree7ae55930f3ab6d5e2a548784e4d7561809f7c68c /lib/Minz/ModelPdo.php
parentcff8636e770b2072a41928cd918b37654c0dafbb (diff)
parent724e13f0a6419b046b33da71e66058e279551edd (diff)
Merge branch 'dev' into beta
Conflicts: CHANGELOG README.fr.md README.md app/Controllers/feedController.php app/Controllers/indexController.php app/i18n/en.php app/i18n/fr.php app/views/helpers/view/normal_view.phtml app/views/stats/index.phtml app/views/stats/repartition.phtml constants.php p/scripts/main.js
Diffstat (limited to 'lib/Minz/ModelPdo.php')
-rw-r--r--lib/Minz/ModelPdo.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php
index b4bfca746..6198cd85c 100644
--- a/lib/Minz/ModelPdo.php
+++ b/lib/Minz/ModelPdo.php
@@ -16,6 +16,8 @@ class Minz_ModelPdo {
public static $useSharedBd = true;
private static $sharedBd = null;
private static $sharedPrefix;
+ private static $has_transaction = false;
+ private static $sharedCurrentUser;
protected static $sharedDbType;
/**
@@ -23,6 +25,7 @@ class Minz_ModelPdo {
*/
protected $bd;
+ protected $current_user;
protected $prefix;
public function dbType() {
@@ -37,6 +40,7 @@ class Minz_ModelPdo {
if (self::$useSharedBd && self::$sharedBd != null && $currentUser === null) {
$this->bd = self::$sharedBd;
$this->prefix = self::$sharedPrefix;
+ $this->current_user = self::$sharedCurrentUser;
return;
}
@@ -45,6 +49,8 @@ class Minz_ModelPdo {
if ($currentUser === null) {
$currentUser = Minz_Session::param('currentUser', '_');
}
+ $this->current_user = $currentUser;
+ self::$sharedCurrentUser = $currentUser;
try {
$type = $db['type'];
@@ -91,12 +97,18 @@ class Minz_ModelPdo {
public function beginTransaction() {
$this->bd->beginTransaction();
+ self::$has_transaction = true;
+ }
+ public function hasTransaction() {
+ return self::$has_transaction;
}
public function commit() {
$this->bd->commit();
+ self::$has_transaction = false;
}
public function rollBack() {
$this->bd->rollBack();
+ self::$has_transaction = false;
}
public static function clean() {