function process_replace(&$response, &$session) { $somappings = new syncml_somappings(); $channel_id = $session->get_channel_id_from_cmd($this->cmdref, $this->msgref); if (!is_null($channel_id)) { switch ($this->data) { case SYNCML_STATUS_OK: $somappings->update_mapping($channel_id, $this->targetref, NULL, 0); break; case SYNCML_STATUS_ITEMADDED: // delete mapping now -- it will come back in MAP $somappings->delete_mapping($channel_id, $this->targetref, NULL, NULL); break; } } }
function execute(&$response, &$session) { $somappings = new syncml_somappings(); if ($response->has_global_status_code()) { $response->add_status($this->cmdid, $session->msgid, 'Map', NULL, NULL, $response->get_global_status_code()); return; } $open_channel = $session->get_open_channel($this->source['locuri'], $this->target['locuri']); foreach ($this->mapitem as $item) { $somappings->delete_mapping($open_channel['channel_id'], NULL, $item['target']['locuri'], NULL); $somappings->insert_mapping($open_channel['channel_id'], $item['source']['locuri'], $item['target']['locuri'], 0); } if (isset($this->noresp) && $this->noresp) { return; } $response->add_status($this->cmdid, $session->msgid, 'Map', $this->target['locuri'], $this->source['locuri'], SYNCML_STATUS_OK); }
/** * Remove mappings for items not touched by the client so they can * be sent like regular ADDs during next phase of the session. * * @param $channel_id ID of channel to prepare the slow * sync for. * @param $all_client_modified_luids All LUIDs client modified. */ function prepare_slowsync($channel_id, $all_client_modified_luids) { $somappings = new syncml_somappings(); // get mappings to items not modified by client $luids_to_kill = array_diff($somappings->get_all_mapped_luids($channel_id), $all_client_modified_luids); // remove mappings not modified by client foreach ($luids_to_kill as $luid) { $somappings->delete_mapping($channel_id, $luid, NULL, NULL); } }