8 use Phinx\Migration\AbstractMigration;
16 protected $trusted_table =
"cutrustedmaster";
18 protected $trusted_default = [
20 'trustedvendor' =>
'Dovenmuehle',
27 'Message' =>
'Client ID from DMI - production' 32 'Message' =>
'Client ID from DMI - testing' 37 'Message' =>
'1=testing 0=production' 41 'Default' =>
'https://mtgsvc.com/SSO/SSOLogin.aspx',
42 'Message' =>
'SSO URL - production' 46 'Default' =>
'https://mtgsvc.tv/SSO/SSOLogin.aspx',
47 'Message' =>
'SSO URL - testing' 51 'Default' =>
'https://mtgsvc.com/SSO/SSOCertify.aspx',
52 'Message' =>
'authentication URL - production' 56 'Default' =>
'https://mtgsvc.tv/SSO/SSOCertify.aspx',
57 'Message' =>
'authentication URL - testing' 65 'Default' =>
'prod/certs/homecu/HomeCUCF.crt',
66 'Message' =>
'HomeCU server certificate is passed as client cert.' 70 'Default' =>
'prod/certs/homecu/HomeCUCF.key',
71 'Message' =>
'HomeCU server certificate key to pass with server cert as client cert' 76 'Message' =>
'csv list of users to force test mode' 88 public function up() {
90 if ($this->hasTable($this->trusted_table)) {
92 $def = $this->trusted_default;
93 $sql =
"select * from {$this->trusted_table} where trustedid = '{$def['trustedid']}'";
95 # note appears that fetchRow always returns count of 1, even if no row is found. 96 # using fetchAll even though I expect max 1 record (trustedid is unique key) 98 $trusted_row = $this->fetchAll($sql);
100 if (count($trusted_row) > 0) {
101 $sql =
"update {$this->trusted_table} set trustedfields = E'" 102 . json_encode($def[
'trustedfields'])
103 .
"' where trustedid = '{$def['trustedid']}'";
105 echo
" updating {$def['trustedid']} trusted master\n";
110 $sql =
"insert into {$this->trusted_table} (trustedid, trustedvendor, trustedtype, hcuinterface, trustedfields)" 111 .
" values('{$def['trustedid']}', '{$def['trustedvendor']}', '{$def['trustedtype']}'," 112 .
" E'{$def['hcuinterface']}', E'" . json_encode($def[
'trustedfields']) .
"')";
114 echo
" inserting {$def['trustedid']} trusted master\n";
126 $def = $this->trusted_default;
127 unset ($def[
'trustedfields'][
'testers']);
129 $sql =
"update {$this->trusted_table} set trustedfields = E'" 130 . json_encode($def[
'trustedfields'])
131 .
"' where trustedid = '{$def['trustedid']}'";
133 echo
" reversing update {$def['trustedid']} trusted master\n";