Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
z-push
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Björn Fischer
z-push
Commits
8c098890
Commit
8c098890
authored
Feb 03, 2016
by
Sebastian Kummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZO-35 Define the chunkName in the SyncWorker class. The implementation
just saves/retrieves it.
parent
a7559190
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
18 deletions
+27
-18
syncworker.php
tools/gab-sync/lib/syncworker.php
+17
-8
zarafa.php
tools/gab-sync/lib/zarafa.php
+10
-10
No files found.
tools/gab-sync/lib/syncworker.php
View file @
8c098890
...
...
@@ -98,8 +98,11 @@ abstract class SyncWorker {
$maxSize
=
$size
;
// save/update the chunk data
if
(
$doWrite
)
$this
->
SetChunkData
(
$folderid
,
$chunkId
,
$amountEntries
,
$chunkData
);
if
(
$doWrite
)
{
$chunkName
=
$this
->
chunkType
.
"/"
.
$chunkId
;
$chunkCRC
=
md5
(
$chunkData
);
$this
->
SetChunkData
(
$folderid
,
$chunkName
,
$amountEntries
,
$chunkData
,
$chunkCRC
);
}
}
// Calc the ideal amount of chunks (round up to 5)
...
...
@@ -146,7 +149,8 @@ abstract class SyncWorker {
// get the data for the chunkId
$folderid
=
$this
->
getFolderId
();
$chunkId
=
$this
->
calculateChunkId
(
$key
);
$chunkdata
=
$this
->
GetChunkData
(
$folderid
,
$chunkId
);
$chunkName
=
$this
->
chunkType
.
"/"
.
$chunkId
;
$chunkdata
=
$this
->
GetChunkData
(
$folderid
,
$chunkName
);
$chunk
=
json_decode
(
$chunkdata
,
true
);
// update or remove the entry
...
...
@@ -173,7 +177,8 @@ abstract class SyncWorker {
$chunkData
=
json_encode
(
$chunk
);
// update the chunk data
$status
=
$this
->
SetChunkData
(
$folderid
,
$chunkId
,
$amountEntries
,
$chunkData
);
$chunkCRC
=
md5
(
$chunkData
);
$status
=
$this
->
SetChunkData
(
$folderid
,
$chunkName
,
$amountEntries
,
$chunkData
,
$chunkCRC
);
if
(
$status
)
{
$this
->
Log
(
"Success!"
);
}
...
...
@@ -364,24 +369,28 @@ abstract class SyncWorker {
* Returns the chunk data of the chunkId of the hidden folder.
*
* @param string $folderid
* @param int $chunkId The id of the chunk (used to find the chunk message).
* @param string $chunkName The name of the chunk (used to find the chunk message).
* The name is saved in the 'subject' of the chunk message.
*
* @access protected
* @return json string
*/
protected
abstract
function
GetChunkData
(
$folderid
,
$chunk
Id
);
protected
abstract
function
GetChunkData
(
$folderid
,
$chunk
Name
);
/**
* Updates the chunk data in the hidden folder if it changed.
* If the chunkId is not available, it's created.
*
* @param string $folderid
* @param int $chunkId The id of the chunk (used to find the chunk message).
* @param string $chunkName The name of the chunk (used to find/update the chunk message).
* The name is to be saved in the 'subject' of the chunk message.
* @param int $amountEntries Amount of entries in the chunkdata.
* @param string $chunkData The data containing all the data.
* @param string $chunkCRC A checksum of the chunk data. To be saved in the 'location' of
* the chunk message. Used to identify changed chunks.
*
* @access protected
* @return boolean
*/
protected
abstract
function
SetChunkData
(
$folderid
,
$chunk
Id
,
$amountEntries
,
$chunkData
);
protected
abstract
function
SetChunkData
(
$folderid
,
$chunk
Name
,
$amountEntries
,
$chunkData
,
$chunkCRC
);
}
\ No newline at end of file
tools/gab-sync/lib/zarafa.php
View file @
8c098890
...
...
@@ -283,14 +283,14 @@ class Zarafa extends SyncWorker {
* Returns the chunk data of the chunkId of the hidden folder.
*
* @param string $folderid
* @param int $chunkId The id of the chunk (used to find the chunk message).
* @param string $chunkName The name of the chunk (used to find the chunk message).
* The name is saved in the 'subject' of the chunk message.
*
* @access protected
* @return json string
*/
protected
function
GetChunkData
(
$folderid
,
$chunk
Id
)
{
protected
function
GetChunkData
(
$folderid
,
$chunk
Name
)
{
// find the chunk message in the folder
$chunkName
=
$this
->
chunkType
.
"-chunk-"
.
$chunkId
;
$chunkdata
=
$this
->
findChunk
(
$folderid
,
$chunkName
);
if
(
$chunkdata
[
PR_ENTRYID
])
{
...
...
@@ -308,21 +308,21 @@ class Zarafa extends SyncWorker {
* If the chunkId is not available, it's created.
*
* @param string $folderid
* @param int $chunkId The id of the chunk (used to find the chunk message).
* @param string $chunkName The name of the chunk (used to find/update the chunk message).
* The name is to be saved in the 'subject' of the chunk message.
* @param int $amountEntries Amount of entries in the chunkdata.
* @param string $chunkData The data containing all the data.
* @param string $chunkCRC A checksum of the chunk data. To be saved in the 'location' of
* the chunk message. Used to identify changed chunks.
*
* @access protected
* @return boolean
*/
protected
function
SetChunkData
(
$folderid
,
$chunkId
,
$amountEntries
,
$chunkData
)
{
// find the chunk message in the folder
$chunkName
=
$this
->
chunkType
.
"-chunk-"
.
$chunkId
;
$chunkCRC
=
md5
(
$chunkData
);
protected
function
SetChunkData
(
$folderid
,
$chunkName
,
$amountEntries
,
$chunkData
,
$chunkCRC
)
{
$log
=
sprintf
(
"Zarafa->SetChunkData: %s
\t
Entries: %d
\t
Size: %d B
\t
CRC: %s - "
,
$chunkName
,
$amountEntries
,
strlen
(
$chunkData
),
$chunkCRC
);
$chunkdata
=
$this
->
findChunk
(
$folderid
,
$chunkName
);
// find the chunk message in the folder
$chunkdata
=
$this
->
findChunk
(
$folderid
,
$chunkName
);
$message
=
false
;
// message not found, create it
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment