1*a1a3b679SAndreas Boehler<?php 2*a1a3b679SAndreas Boehler 3*a1a3b679SAndreas Boehlernamespace Sabre\DAV\Sync; 4*a1a3b679SAndreas Boehler 5*a1a3b679SAndreas Boehleruse Sabre\DAV; 6*a1a3b679SAndreas Boehler 7*a1a3b679SAndreas Boehler/** 8*a1a3b679SAndreas Boehler * If a class extends ISyncCollection, it supports WebDAV-sync. 9*a1a3b679SAndreas Boehler * 10*a1a3b679SAndreas Boehler * You are responsible for maintaining a changelist for this collection. This 11*a1a3b679SAndreas Boehler * means that if any child nodes in this collection was created, modified or 12*a1a3b679SAndreas Boehler * deleted in any way, you should maintain an updated changelist. 13*a1a3b679SAndreas Boehler * 14*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/). 15*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/) 16*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License 17*a1a3b679SAndreas Boehler */ 18*a1a3b679SAndreas Boehlerinterface ISyncCollection extends DAV\ICollection { 19*a1a3b679SAndreas Boehler 20*a1a3b679SAndreas Boehler /** 21*a1a3b679SAndreas Boehler * This method returns the current sync-token for this collection. 22*a1a3b679SAndreas Boehler * This can be any string. 23*a1a3b679SAndreas Boehler * 24*a1a3b679SAndreas Boehler * If null is returned from this function, the plugin assumes there's no 25*a1a3b679SAndreas Boehler * sync information available. 26*a1a3b679SAndreas Boehler * 27*a1a3b679SAndreas Boehler * @return string|null 28*a1a3b679SAndreas Boehler */ 29*a1a3b679SAndreas Boehler function getSyncToken(); 30*a1a3b679SAndreas Boehler 31*a1a3b679SAndreas Boehler /** 32*a1a3b679SAndreas Boehler * The getChanges method returns all the changes that have happened, since 33*a1a3b679SAndreas Boehler * the specified syncToken and the current collection. 34*a1a3b679SAndreas Boehler * 35*a1a3b679SAndreas Boehler * This function should return an array, such as the following: 36*a1a3b679SAndreas Boehler * 37*a1a3b679SAndreas Boehler * [ 38*a1a3b679SAndreas Boehler * 'syncToken' => 'The current synctoken', 39*a1a3b679SAndreas Boehler * 'added' => [ 40*a1a3b679SAndreas Boehler * 'new.txt', 41*a1a3b679SAndreas Boehler * ], 42*a1a3b679SAndreas Boehler * 'modified' => [ 43*a1a3b679SAndreas Boehler * 'modified.txt', 44*a1a3b679SAndreas Boehler * ], 45*a1a3b679SAndreas Boehler * 'deleted' => array( 46*a1a3b679SAndreas Boehler * 'foo.php.bak', 47*a1a3b679SAndreas Boehler * 'old.txt' 48*a1a3b679SAndreas Boehler * ) 49*a1a3b679SAndreas Boehler * ]; 50*a1a3b679SAndreas Boehler * 51*a1a3b679SAndreas Boehler * The syncToken property should reflect the *current* syncToken of the 52*a1a3b679SAndreas Boehler * collection, as reported getSyncToken(). This is needed here too, to 53*a1a3b679SAndreas Boehler * ensure the operation is atomic. 54*a1a3b679SAndreas Boehler * 55*a1a3b679SAndreas Boehler * If the syncToken is specified as null, this is an initial sync, and all 56*a1a3b679SAndreas Boehler * members should be reported. 57*a1a3b679SAndreas Boehler * 58*a1a3b679SAndreas Boehler * The modified property is an array of nodenames that have changed since 59*a1a3b679SAndreas Boehler * the last token. 60*a1a3b679SAndreas Boehler * 61*a1a3b679SAndreas Boehler * The deleted property is an array with nodenames, that have been deleted 62*a1a3b679SAndreas Boehler * from collection. 63*a1a3b679SAndreas Boehler * 64*a1a3b679SAndreas Boehler * The second argument is basically the 'depth' of the report. If it's 1, 65*a1a3b679SAndreas Boehler * you only have to report changes that happened only directly in immediate 66*a1a3b679SAndreas Boehler * descendants. If it's 2, it should also include changes from the nodes 67*a1a3b679SAndreas Boehler * below the child collections. (grandchildren) 68*a1a3b679SAndreas Boehler * 69*a1a3b679SAndreas Boehler * The third (optional) argument allows a client to specify how many 70*a1a3b679SAndreas Boehler * results should be returned at most. If the limit is not specified, it 71*a1a3b679SAndreas Boehler * should be treated as infinite. 72*a1a3b679SAndreas Boehler * 73*a1a3b679SAndreas Boehler * If the limit (infinite or not) is higher than you're willing to return, 74*a1a3b679SAndreas Boehler * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. 75*a1a3b679SAndreas Boehler * 76*a1a3b679SAndreas Boehler * If the syncToken is expired (due to data cleanup) or unknown, you must 77*a1a3b679SAndreas Boehler * return null. 78*a1a3b679SAndreas Boehler * 79*a1a3b679SAndreas Boehler * The limit is 'suggestive'. You are free to ignore it. 80*a1a3b679SAndreas Boehler * 81*a1a3b679SAndreas Boehler * @param string $syncToken 82*a1a3b679SAndreas Boehler * @param int $syncLevel 83*a1a3b679SAndreas Boehler * @param int $limit 84*a1a3b679SAndreas Boehler * @return array 85*a1a3b679SAndreas Boehler */ 86*a1a3b679SAndreas Boehler function getChanges($syncToken, $syncLevel, $limit = null); 87*a1a3b679SAndreas Boehler 88*a1a3b679SAndreas Boehler} 89