/** * Initialize a Propel connection to the database * * @param bool $root wheter to also initialize a root connection * @return the Propel connection */ public function initPropel($root = false) { if ($this->initPropel && !$root || $this->initPropelRoot && $root) { return; } $wfDetails = $this->getDBCredentials("wf"); $rbDetails = $this->getDBCredentials("rb"); $rpDetails = $this->getDBCredentials("rp"); $config = array('datasources' => array('workflow' => array('connection' => $wfDetails["dsn"], 'adapter' => $wfDetails["adapter"]), 'rbac' => array('connection' => $rbDetails["dsn"], 'adapter' => $rbDetails["adapter"]), 'rp' => array('connection' => $rpDetails["dsn"], 'adapter' => $rpDetails["adapter"]))); if ($root) { $dbHash = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH)); $dbInfo = $this->getDBInfo(); $host = $dbHash[0]; $user = $dbHash[1]; $pass = $dbHash[2]; $dbName = $dbInfo["DB_NAME"]; $rootConfig = array('datasources' => array('root' => array('connection' => "mysql://{$user}:{$pass}@{$host}/{$dbName}?encoding=utf8", 'adapter' => "mysql"))); $config["datasources"] = array_merge($config["datasources"], $rootConfig["datasources"]); $this->initPropelRoot = true; } $this->initPropel = true; require_once "propel/Propel.php"; require_once "creole/Creole.php"; Propel::initConfiguration($config); }