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

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 2019101800_updDMITrustedMaster.php.

Member Function Documentation

◆ down()

updDMITrustedMaster::down ( )

Assuming the previous state was properly added without testers, re-add it as such.

Returns
void

Definition at line 124 of file 2019101800_updDMITrustedMaster.php.

124  {
125 
126  $def = $this->trusted_default;
127  unset ($def['trustedfields']['testers']);
128 
129  $sql = "update {$this->trusted_table} set trustedfields = E'"
130  . json_encode($def['trustedfields'])
131  . "' where trustedid = '{$def['trustedid']}'";
132 
133  echo " reversing update {$def['trustedid']} trusted master\n";
134  $this->query($sql);
135  }

◆ up()

updDMITrustedMaster::up ( )

See if Dovenmuehle DMI exists, if so, update it to force the testers entry and updated default values for URLS

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

Returns
void

Definition at line 88 of file 2019101800_updDMITrustedMaster.php.

88  {
89 
90  if ($this->hasTable($this->trusted_table)) {
91 
92  $def = $this->trusted_default;
93  $sql = "select * from {$this->trusted_table} where trustedid = '{$def['trustedid']}'";
94 
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)
97 
98  $trusted_row = $this->fetchAll($sql);
99 
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']}'";
104 
105  echo " updating {$def['trustedid']} trusted master\n";
106  $this->query($sql);
107 
108  } else {
109 
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']) . "')";
113 
114  echo " inserting {$def['trustedid']} trusted master\n";
115  $this->query($sql);
116  }
117  }
118  }

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