Changeset 2372 for sandbox/workflow/trunk/inc/engine/src/common/Base.php
- Timestamp:
- 03/29/10 14:46:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/workflow/trunk/inc/engine/src/common/Base.php
r2165 r2372 39 39 var $child_name = 'Base'; 40 40 41 /** 42 * @var object $db_shared_obj The database abstraction object shared between 43 * all instances of this class. 44 * @acess private 45 * @static 46 */ 47 private static $db_shared_obj = null; 48 41 49 /** 42 50 * Constructor receiving a database abstraction object … … 46 54 * @access public 47 55 */ 48 function Base( &$db)56 function Base() 49 57 { 50 if(!$db) { 58 /** 59 * New Stuff! 60 * We decided to get here the database object. In a recent past, 61 * all the classes that specialize this one passed a db object. 62 * Now, to simplify and save memory, we store the database object 63 * into a single and static atribute shared among each instance 64 * of this class. 65 * 66 * To prevent to modify all sub-classes to use "self::$db" instead 67 * of "this->db", we made a very tiny workaround here. In the first 68 * instantiation of this class, we instantiate the database object 69 * and store it into 'self::$db_shared_obj'. Any subsequent 70 * instantiations will just point to the static one. 71 */ 72 if (!self::$db_shared_obj) 73 self::$db_shared_obj = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 74 75 $this->db = &self::$db_shared_obj; 76 77 78 if(!$this->db) { 51 79 die('Invalid db object passed to '.$this->child_name.' constructor'); 52 80 } 53 81 //Force transactionnal mysql (Innodb) -> mysqlt 54 if ($ db->databaseType=='mysql')82 if ($this->db->databaseType=='mysql') 55 83 { 56 84 $GLOBALS['phpgw']->db->disconnect(); 57 $ db = $GLOBALS['phpgw']->db->connect(85 $this->db = $GLOBALS['phpgw']->db->connect( 58 86 $GLOBALS['phpgw_info']['server']['db_name'], 59 87 $GLOBALS['phpgw_info']['server']['db_host'], … … 64 92 ); 65 93 } 66 $this->db = &$db;67 94 } 68 95
Note: See TracChangeset
for help on using the changeset viewer.