DBFarmRole::SetServiceConfiguration PHP Method

SetServiceConfiguration() public method

public SetServiceConfiguration ( $behavior, $config )
    public function SetServiceConfiguration($behavior, $config)
    {
        $this->DB->BeginTrans();
        try {
            $this->DB->Execute("DELETE FROM farm_role_config_presets WHERE farm_roleid = ? AND behavior = ?", array($this->ID, $behavior));
            foreach ($config as $configFile => $cfg) {
                foreach ($cfg as $k => $v) {
                    $this->DB->Execute("INSERT INTO farm_role_config_presets SET\n                        farm_roleid = ?,\n                        behavior = ?,\n                        cfg_filename = ?,\n                        cfg_key = ?,\n                        cfg_value =?\n                    ", array($this->ID, $behavior, $configFile, $k, $v));
                }
            }
        } catch (Exception $e) {
            $this->DB->RollbackTrans();
            throw $e;
        }
        $this->DB->CommitTrans();
        return true;
    }