runmode if (tableHasColumn('location_roomplan', 'dedicatedmgr')) { if (!tableExists('runmode') || !tableExists('machine')) { $res[] = UPDATE_RETRY; } else { $ret = Database::simpleQuery('SELECT lr.locationid, lr.managerip, lr.dedicatedmgr, m.machineuuid FROM location_roomplan lr INNER JOIN machine m ON (m.clientip = lr.managerip)'); if ($ret === false) { $res[] = UPDATE_FAILED; } else { while ($row = $ret->fetch(PDO::FETCH_ASSOC)) { $dedi = $row['dedicatedmgr'] != 0; $data = json_encode(array('dedicatedmgr' => $dedi)); Database::exec("INSERT IGNORE INTO runmode (machineuuid, module, modeid, modedata, isclient) VALUES (:machineuuid, 'roomplanner', :locationid, :modedata, :isclient)", array( 'machineuuid' => $row['machineuuid'], 'locationid' => $row['locationid'], 'modedata' => $data, 'isclient' => ($dedi ? 0 : 1) )); } Database::exec('ALTER TABLE location_roomplan DROP COLUMN dedicatedmgr'); $res[] = UPDATE_DONE; } } } responseFromArray($res);