Commit 7255faeb authored by mku's avatar mku

ZP-228 #comment Merge contribution - State in combined backend - rev 1392 #time 30m

git-svn-id: https://z-push.org/svn/z-push/trunk@1452 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 744a4840
...@@ -196,18 +196,8 @@ class ImportChangesCombined implements IImportChanges { ...@@ -196,18 +196,8 @@ class ImportChangesCombined implements IImportChanges {
$id = $this->backend->GetBackendFolder($id); $id = $this->backend->GetBackendFolder($id);
} }
$importer = $this->backend->getBackend($backendid)->GetImporter(); $this->icc = $this->backend->getBackend($backendid)->GetImporter();
$res = $this->icc->ImportFolderChange($folder);
if(isset($this->syncstates[$backendid])) {
$state = $this->syncstates[$backendid];
}
else {
$state = '';
}
$importer->Config($state);
$res = $importer->ImportFolderChange($folder);
$this->syncstates[$backendid] = $importer->GetState();
ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->ImportFolderChange() success'); ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->ImportFolderChange() success');
return $backendid.$this->backend->config['delimiter'].$res; return $backendid.$this->backend->config['delimiter'].$res;
} }
...@@ -235,18 +225,8 @@ class ImportChangesCombined implements IImportChanges { ...@@ -235,18 +225,8 @@ class ImportChangesCombined implements IImportChanges {
if($parent != '0') if($parent != '0')
$parent = $this->backend->GetBackendFolder($parent); $parent = $this->backend->GetBackendFolder($parent);
$importer = $backend->GetImporter(); $this->icc = $backend->GetImporter();
$res = $this->icc->ImportFolderDeletion($id, $parent);
if(isset($this->syncstates[$backendid])) {
$state = $this->syncstates[$backendid];
}
else {
$state = '';
}
$importer->Config($state);
$res = $importer->ImportFolderDeletion($id, $parent);
$this->syncstates[$backendid] = $importer->GetState();
ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->ImportFolderDeletion() success'); ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->ImportFolderDeletion() success');
return $res; return $res;
} }
...@@ -263,9 +243,11 @@ class ImportChangesCombined implements IImportChanges { ...@@ -263,9 +243,11 @@ class ImportChangesCombined implements IImportChanges {
*/ */
public function Config($state, $flags = 0) { public function Config($state, $flags = 0) {
ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->Config(...)'); ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->Config(...)');
$this->syncstates = $state; if (!$this->icc) {
if(!is_array($this->syncstates)) ZLog::Write(LOGLEVEL_ERROR, "ImportChangesCombined->Config() icc not configured");
$this->syncstates = array(); return false;
}
$this->icc->Config($state, $flags);
ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->Config() success'); ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->Config() success');
} }
...@@ -276,7 +258,11 @@ class ImportChangesCombined implements IImportChanges { ...@@ -276,7 +258,11 @@ class ImportChangesCombined implements IImportChanges {
* @return string * @return string
*/ */
public function GetState() { public function GetState() {
return $this->syncstates; if (!$this->icc) {
ZLog::Write(LOGLEVEL_ERROR, "ImportChangesCombined->GetState() icc not configured");
return false;
}
return $this->icc->GetState();
} }
} }
......
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