[4898] | 1 | <?php |
---|
| 2 | /*********************************************** |
---|
| 3 | * File : memimporter.php |
---|
| 4 | * Project : Z-Push |
---|
| 5 | * Descr : Classes that collect changes |
---|
| 6 | * |
---|
| 7 | * Created : 01.10.2007 |
---|
| 8 | * |
---|
| 9 | * © Zarafa Deutschland GmbH, www.zarafaserver.de |
---|
| 10 | * This file is distributed under GPL v2. |
---|
| 11 | * Consult LICENSE file for details |
---|
| 12 | ************************************************/ |
---|
| 13 | |
---|
| 14 | class ImportContentsChangesMem extends ImportContentsChanges { |
---|
| 15 | function ImportContentsChangesMem() { |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | function ImportMessageChange($message) { return true; } |
---|
| 19 | |
---|
| 20 | function ImportMessageDeletion($message) { return true; } |
---|
| 21 | |
---|
| 22 | function ImportMessageReadFlag($message) { return true; } |
---|
| 23 | |
---|
| 24 | function ImportMessageMove($message) { return true; } |
---|
| 25 | }; |
---|
| 26 | |
---|
| 27 | // This simply collects all changes so that they can be retrieved later, for |
---|
| 28 | // statistics gathering for example |
---|
| 29 | class ImportHierarchyChangesMem extends ImportHierarchyChanges { |
---|
| 30 | var $changed; |
---|
| 31 | var $deleted; |
---|
| 32 | var $count; |
---|
| 33 | var $foldercache; |
---|
| 34 | |
---|
| 35 | function ImportHierarchyChangesMem($foldercache) { |
---|
| 36 | $this->foldercache = $foldercache; |
---|
| 37 | $this->changed = array(); |
---|
| 38 | $this->deleted = array(); |
---|
| 39 | $this->count = 0; |
---|
| 40 | |
---|
| 41 | return true; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | function ImportFolderChange($folder) { |
---|
| 45 | // The HierarchyExporter exports all kinds of changes. |
---|
| 46 | // Frequently these changes are not relevant for the mobiles, |
---|
| 47 | // as something changes but the relevant displayname and parentid |
---|
| 48 | // stay the same. These changes will be dropped and not sent |
---|
| 49 | if (array_key_exists($folder->serverid, $this->foldercache) && |
---|
| 50 | $this->foldercache[$folder->serverid]->displayname == $folder->displayname && |
---|
| 51 | $this->foldercache[$folder->serverid]->parentid == $folder->parentid && |
---|
| 52 | $this->foldercache[$folder->serverid]->type == $folder->type |
---|
| 53 | ) { |
---|
| 54 | debugLog("Change for folder '".$folder->displayname."' will not be sent as modification is not relevant"); |
---|
| 55 | return true; |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | array_push($this->changed, $folder); |
---|
| 59 | $this->count++; |
---|
| 60 | // temporarily add/update the folder to the cache so changes are not sent twice |
---|
| 61 | $this->foldercache[$folder->serverid] = $folder; |
---|
| 62 | return true; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | function ImportFolderDeletion($id) { |
---|
| 66 | array_push($this->deleted, $id); |
---|
| 67 | |
---|
| 68 | $this->count++; |
---|
| 69 | |
---|
| 70 | return true; |
---|
| 71 | } |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | ?> |
---|