mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 12:21:26 +02:00
Optimize SyncML device information handling
This commit is contained in:
parent
58dfaac768
commit
dc1fa86a9a
@ -458,6 +458,7 @@ class Horde_SyncML_State {
|
|||||||
function setClientDeviceInfo($clientDeviceInfo)
|
function setClientDeviceInfo($clientDeviceInfo)
|
||||||
{
|
{
|
||||||
$this->_clientDeviceInfo = $clientDeviceInfo;
|
$this->_clientDeviceInfo = $clientDeviceInfo;
|
||||||
|
$this->_clientDeviceInfo['persistent'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDeletedItems($_type, $_deletedItems)
|
function setDeletedItems($_type, $_deletedItems)
|
||||||
@ -1131,13 +1132,16 @@ class Horde_SyncML_State {
|
|||||||
*/
|
*/
|
||||||
function writeClientDeviceInfo()
|
function writeClientDeviceInfo()
|
||||||
{
|
{
|
||||||
if (!isset($this->_clientDeviceInfo) || !is_array($this->_clientDeviceInfo)) {
|
if (!isset($this->_clientDeviceInfo) ||
|
||||||
|
!is_array($this->_clientDeviceInfo) ||
|
||||||
|
!empty($this->_clientDeviceInfo['persistent'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dt = &$this->getDataTree();
|
$dt = &$this->getDataTree();
|
||||||
|
|
||||||
$s = $this->_locName . $this->_sourceURI . 'deviceInfo';
|
$s = $this->_locName . $this->_sourceURI . 'deviceInfo';
|
||||||
|
$this->_clientDeviceInfo['persistent'] = true;
|
||||||
|
|
||||||
// Set $locid.
|
// Set $locid.
|
||||||
$info = new DataTreeObject($s);
|
$info = new DataTreeObject($s);
|
||||||
|
@ -238,6 +238,7 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
'tzid' => $syncml_prefs[$deviceTimezone],
|
'tzid' => $syncml_prefs[$deviceTimezone],
|
||||||
'charset' => $syncml_prefs[$deviceCharSet],
|
'charset' => $syncml_prefs[$deviceCharSet],
|
||||||
'devId' => $deviceID,
|
'devId' => $deviceID,
|
||||||
|
'persistent' => true,
|
||||||
'dataStore' => unserialize($row['dev_datastore']),
|
'dataStore' => unserialize($row['dev_datastore']),
|
||||||
);
|
);
|
||||||
return $this->_clientDeviceInfo;
|
return $this->_clientDeviceInfo;
|
||||||
@ -634,6 +635,9 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($this->_clientDeviceInfo['persistent'])) {
|
||||||
|
// the device information was updated
|
||||||
|
|
||||||
if(!isset($this->size_dev_hwversion)) {
|
if(!isset($this->size_dev_hwversion)) {
|
||||||
$tableDefDevInfo = $GLOBALS['egw']->db->get_table_definitions('syncml',$this->table_devinfo);
|
$tableDefDevInfo = $GLOBALS['egw']->db->get_table_definitions('syncml',$this->table_devinfo);
|
||||||
$this->size_dev_hwversion = $tableDefDevInfo['fd']['dev_hwversion']['precision'];
|
$this->size_dev_hwversion = $tableDefDevInfo['fd']['dev_hwversion']['precision'];
|
||||||
@ -679,21 +683,19 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
$deviceID = $GLOBALS['egw']->db->get_last_insert_id('egw_syncmldevinfo', 'dev_id');
|
$deviceID = $GLOBALS['egw']->db->get_last_insert_id('egw_syncmldevinfo', 'dev_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = array (
|
$this->_clientDeviceInfo['persistent'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $where = array (
|
||||||
'owner_locname' => $this->_locName,
|
'owner_locname' => $this->_locName,
|
||||||
'owner_deviceid' => $this->_sourceURI,
|
'owner_deviceid' => $this->_sourceURI,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($GLOBALS['egw']->db->select('egw_syncmldeviceowner', 'owner_devid', $where,
|
|
||||||
__LINE__, __FILE__, false, '', 'syncml')->fetchColumn()) {
|
|
||||||
$GLOBALS['egw']->db->delete('egw_syncmldeviceowner', $where,
|
$GLOBALS['egw']->db->delete('egw_syncmldeviceowner', $where,
|
||||||
__LINE__, __FILE__, 'syncml');
|
__LINE__, __FILE__, 'syncml');
|
||||||
}
|
|
||||||
$data = array (
|
$data['owner_devid'] = $deviceID;
|
||||||
'owner_locname' => $this->_locName,
|
|
||||||
'owner_deviceid' => $this->_sourceURI,
|
|
||||||
'owner_devid' => $deviceID,
|
|
||||||
);
|
|
||||||
$GLOBALS['egw']->db->insert('egw_syncmldeviceowner', $data, $where,
|
$GLOBALS['egw']->db->insert('egw_syncmldeviceowner', $data, $where,
|
||||||
__LINE__, __FILE__, 'syncml');
|
__LINE__, __FILE__, 'syncml');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user