|
106 | 106 |
|
107 | 107 | //* Resyncing Databases |
108 | 108 | if(isset($_POST['resync_db']) && $_POST['resync_db'] == 1) { |
| 109 | + $db_table = 'web_database_user'; |
| 110 | + $index_field = 'database_user_id'; |
| 111 | + $sql = "SELECT * FROM ".$db_table." WHERE 1"; |
| 112 | + $records = $app->db->queryAllRecords($sql); |
| 113 | + if(is_array($records)) { |
| 114 | + foreach($records as $rec) { |
| 115 | + $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); |
| 116 | + $msg .= "Resynced Database user: ".$rec['database_user'].'<br />'; |
| 117 | + } |
| 118 | + } |
109 | 119 | $db_table = 'web_database'; |
110 | 120 | $index_field = 'database_id'; |
111 | 121 | $sql = "SELECT * FROM ".$db_table." WHERE active = 'y'"; |
|
144 | 154 | $msg .= "Resynced Mailbox: ".$rec['email'].'<br />'; |
145 | 155 | } |
146 | 156 | } |
| 157 | + $db_table = 'mail_forwarding'; |
| 158 | + $index_field = 'forwarding_id'; |
| 159 | + $sql = "SELECT * FROM ".$db_table; |
| 160 | + $records = $app->db->queryAllRecords($sql); |
| 161 | + if(is_array($records)) { |
| 162 | + foreach($records as $rec) { |
| 163 | + $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); |
| 164 | + $msg .= "Resynced Alias: ".$rec['source'].'<br />'; |
| 165 | + } |
| 166 | + } |
147 | 167 | } |
148 | 168 |
|
149 | 169 | //* Resyncing dns zones |
|
169 | 189 |
|
170 | 190 | } |
171 | 191 |
|
| 192 | +//* Resyncing Clients |
| 193 | +if(isset($_POST['resync_client']) && $_POST['resync_client'] == 1) { |
| 194 | + $tform_def_file = "form/client.tform.php"; |
| 195 | + $app->uses('tpl,tform,tform_actions'); |
| 196 | + $app->load('tform_actions'); |
| 197 | + |
| 198 | + $db_table = 'client'; |
| 199 | + $index_field = 'client_id'; |
| 200 | + $sql = "SELECT * FROM ".$db_table; |
| 201 | + $records = $app->db->queryAllRecords($sql); |
| 202 | + if(is_array($records)) { |
| 203 | + foreach($records as $rec) { |
| 204 | + $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); |
| 205 | + $tmp = new tform_actions; |
| 206 | + $tmp->id = $rec[$index_field]; |
| 207 | + $tmp->dataRecord = $rec; |
| 208 | + $tmp->oldDataRecord = $rec; |
| 209 | + $app->plugin->raiseEvent('client:client:on_after_update', $tmp); |
| 210 | + $msg .= "Resynced Client: ".$rec['contact_name'].'<br />'; |
| 211 | + unset($tmp); |
| 212 | + } |
| 213 | + } |
| 214 | +} |
| 215 | + |
| 216 | + |
172 | 217 | $app->tpl->setVar('msg', $msg); |
173 | 218 | $app->tpl->setVar('error', $error); |
174 | 219 |
|
|
0 commit comments