Odyssey
Public Member Functions | Protected Attributes | List of all members
updXDITrustedMaster Class Reference
Inheritance diagram for updXDITrustedMaster:

Public Member Functions

 up ()
 
 down ()
 

Protected Attributes

 $trusted_table = "cutrustedmaster"
 
 $trusted_default
 

Detailed Description

Updates trusted master to include testers for DMI

Definition at line 13 of file 2019102100_updXDITrustedMaster.php.

Member Function Documentation

◆ down()

updXDITrustedMaster::down ( )

No Down

Returns
void

Definition at line 109 of file 2019102100_updXDITrustedMaster.php.

109  {
110  }

◆ up()

updXDITrustedMaster::up ( )

See if row defined above exists in trusted master. If so, update it to force the content defined above

Since trustedid is unique key to table, counting on only one entry

Returns
void

Definition at line 74 of file 2019102100_updXDITrustedMaster.php.

74  {
75 
76  if ($this->hasTable($this->trusted_table)) {
77 
78  $def = $this->trusted_default;
79  $sql = "select * from {$this->trusted_table} where trustedid = '{$def['trustedid']}'";
80 
81  # note appears that fetchRow always returns count of 1, even if no row is found.
82  # using fetchAll even though I expect max 1 record (trustedid is unique key)
83 
84  $trusted_row = $this->fetchAll($sql);
85 
86  if (count($trusted_row) > 0) {
87  $sql = "update {$this->trusted_table} set trustedfields = E'"
88  . json_encode($def['trustedfields'])
89  . "' where trustedid = '{$def['trustedid']}'";
90 
91  echo " updating {$def['trustedid']} trusted master\n";
92  $this->query($sql);
93 
94  } else {
95 
96  $sql = "insert into {$this->trusted_table} (trustedid, trustedvendor, trustedtype, hcuinterface, trustedfields)"
97  . " values('{$def['trustedid']}', '{$def['trustedvendor']}', '{$def['trustedtype']}',"
98  . " E'{$def['hcuinterface']}', E'" . json_encode($def['trustedfields']) . "')";
99 
100  echo " inserting {$def['trustedid']} trusted master\n";
101  $this->query($sql);
102  }
103  }
104  }

The documentation for this class was generated from the following file: