Commit 24b275a2 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-771 Indicate changed additional folderdata in

DeviceManager->IsHierarchySyncRequired().

Released under the Affero GNU General Public License (AGPL) version 3.
parent 423d9d31
......@@ -67,6 +67,7 @@ class DeviceManager {
private $loopdetection;
private $hierarchySyncRequired;
private $additionalFoldersHash;
/**
* Constructor
......@@ -97,6 +98,8 @@ class DeviceManager {
$this->stateManager = new StateManager();
$this->stateManager->SetDevice($this->device);
$this->additionalFoldersHash = $this->getAdditionalFoldersHash();
}
/**
......@@ -608,13 +611,20 @@ class DeviceManager {
}
/**
* Indicates if the hierarchy should be resynchronized
* e.g. during PING
* Indicates if the hierarchy should be resynchronized based on the general folder state and
* if additional folders changed.
*
* @access public
* @return boolean
*/
public function IsHierarchySyncRequired() {
$this->loadDeviceData();
// if the hash of the additional folders changed, we have to sync the hierarchy
if ($this->additionalFoldersHash != $this->getAdditionalFoldersHash()) {
$this->hierarchySyncRequired = true;
}
// check if a hierarchy sync might be necessary
if ($this->device->GetFolderUUID(false) === false)
$this->hierarchySyncRequired = true;
......@@ -622,6 +632,10 @@ class DeviceManager {
return $this->hierarchySyncRequired;
}
private function getAdditionalFoldersHash() {
return md5(serialize($this->device->GetAdditionalFolders()));
}
/**
* Indicates if a full hierarchy resync should be triggered due to loops
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment