Commit 425b419f authored by skummer's avatar skummer

ZP-106

- fixed: the count of messages exported is not consistent after exporter->Synchronize() so we need to count the messages in the stream importer

git-svn-id: https://z-push.org/svn/z-push/trunk@1311 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent f974562f
......@@ -45,6 +45,7 @@ class ImportChangesStream implements IImportChanges {
private $encoder;
private $objclass;
private $seenObjects;
private $importedMsgs;
/**
* Constructor of the StreamImporter
......@@ -59,6 +60,7 @@ class ImportChangesStream implements IImportChanges {
$this->objclass = $class;
$this->classAsString = (is_object($class))?get_class($class):'';
$this->seenObjects = array();
$this->importedMsgs = 0;
}
/**
......@@ -88,6 +90,7 @@ class ImportChangesStream implements IImportChanges {
return true;
}
$this->importedMsgs++;
$this->seenObjects[] = $id;
// checks if the next message may cause a loop or is broken
......@@ -121,6 +124,7 @@ class ImportChangesStream implements IImportChanges {
* @return boolean
*/
public function ImportMessageDeletion($id) {
$this->importedMsgs++;
$this->encoder->startTag(SYNC_REMOVE);
$this->encoder->startTag(SYNC_SERVERENTRYID);
$this->encoder->content($id);
......@@ -144,6 +148,8 @@ class ImportChangesStream implements IImportChanges {
if(!($this->objclass instanceof SyncMail))
return false;
$this->importedMsgs++;
$this->encoder->startTag(SYNC_MODIFY);
$this->encoder->startTag(SYNC_SERVERENTRYID);
$this->encoder->content($id);
......@@ -216,5 +222,15 @@ class ImportChangesStream implements IImportChanges {
return true;
}
/**
* Returns the number of messages which were changed, deleted and had changed read status
*
* @access public
* @return int
*/
public function GetImportedMessages() {
return $this->importedMsgs;
}
}
?>
\ No newline at end of file
......@@ -812,9 +812,9 @@ class Sync extends RequestProcessor {
while(1) {
try {
$progress = $exporter->Synchronize();
$n++;
if(!is_array($progress))
break;
$n++;
}
catch (SyncObjectBrokenException $mbe) {
$brokenSO = $mbe->GetSyncObject();
......@@ -836,6 +836,13 @@ class Sync extends RequestProcessor {
}
}
// $progress is not an array when exporting the last message
// so we get the number to display from the streamimporter
if (isset($streamimporter)) {
$n = $streamimporter->GetImportedMessages();
}
self::$encoder->endTag();
self::$topCollector->AnnounceInformation(sprintf("Outgoing %d objects%s", $n, ($n >= $windowSize)?" of ".$changecount:""), true);
}
......
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