summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-08-25 12:19:21 (GMT)
committerAleksander Machniak <alec@alec.pl>2014-08-25 12:19:21 (GMT)
commit813c7becb7f561e5af6c5ed2641703bf66235059 (patch)
tree3a5968923891b6ad6b7ed7d5987aa1ebc3896404
parentc6f3c1e31e93bba51b1ff86f5e180f8cb943500d (diff)
downloadkolab-syncroton-813c7becb7f561e5af6c5ed2641703bf66235059.tar.gz
Change syncroton_modseq.synctime column type to datetime
-rw-r--r--docs/SQL/mysql.initial.sql2
-rw-r--r--docs/SQL/mysql/2014082500.sql1
-rw-r--r--lib/kolab_sync_backend.php8
3 files changed, 6 insertions, 5 deletions
diff --git a/docs/SQL/mysql.initial.sql b/docs/SQL/mysql.initial.sql
index 750d514..71106b9 100644
--- a/docs/SQL/mysql.initial.sql
+++ b/docs/SQL/mysql.initial.sql
@@ -98,7 +98,7 @@ CREATE TABLE IF NOT EXISTS `syncroton_data_folder` (
CREATE TABLE IF NOT EXISTS `syncroton_modseq` (
`device_id` varchar(40) NOT NULL,
`folder_id` varchar(40) NOT NULL,
- `synctime` varchar(14) NOT NULL,
+ `synctime` datetime NOT NULL,
`data` longblob,
PRIMARY KEY (`device_id`,`folder_id`,`synctime`),
KEY `syncroton_modseq::device_id` (`device_id`),
diff --git a/docs/SQL/mysql/2014082500.sql b/docs/SQL/mysql/2014082500.sql
new file mode 100644
index 0000000..80309e4
--- /dev/null
+++ b/docs/SQL/mysql/2014082500.sql
@@ -0,0 +1 @@
+ALTER TABLE `syncroton_modseq` CHANGE `synctime` `synctime` datetime DEFAULT NULL;
diff --git a/lib/kolab_sync_backend.php b/lib/kolab_sync_backend.php
index 3fbf6cb..363351e 100644
--- a/lib/kolab_sync_backend.php
+++ b/lib/kolab_sync_backend.php
@@ -818,7 +818,7 @@ class kolab_sync_backend
*/
public function modseq_set($deviceid, $folderid, $synctime, $data)
{
- $synctime = $synctime->format('Ymdhis');
+ $synctime = $synctime->format('Y-m-d h:i:s');
$rcube = rcube::get_instance();
$db = $rcube->get_dbh();
@@ -840,7 +840,7 @@ class kolab_sync_backend
public function modseq_get($deviceid, $folderid, $synctime)
{
- $synctime = $synctime->format('Ymdhis');
+ $synctime = $synctime->format('Y-m-d h:i:s');
if (!isset($this->modseq[$deviceid]) || !isset($this->modseq[$deviceid][$folderid])
|| !isset($this->modseq[$deviceid][$folderid][$synctime])
@@ -854,8 +854,8 @@ class kolab_sync_backend
0, 2, $deviceid, $folderid, $synctime);
if ($row = $db->fetch_assoc()) {
- $current = $row['synctime'];
- $this->modseq[$deviceid][$folderid][$synctime] = json_decode($row['data']);
+ // @TODO: make sure synctime from sql is in "Y-m-d h:i:s" format
+ $this->modseq[$deviceid][$folderid][$row['synctime']] = json_decode($row['data']);
// Cleanup: remove old records (keep last two)
if ($row = $db->fetch_assoc()) {