@@ -53,12 +53,10 @@ discard block |
||
53 | 53 | $zpt->run(); |
54 | 54 | $zpt->scrClear(); |
55 | 55 | system("stty sane"); |
56 | - } |
|
57 | - else { |
|
56 | + } else { |
|
58 | 57 | echo "grommunio-sync interprocess communication (IPC) is not available or TopCollector is disabled.\n"; |
59 | 58 | } |
60 | - } |
|
61 | - catch (GSyncException $zpe) { |
|
59 | + } catch (GSyncException $zpe) { |
|
62 | 60 | fwrite(STDERR, get_class($zpe) . ": " . $zpe->getMessage() . "\n"); |
63 | 61 | |
64 | 62 | exit(1); |
@@ -173,8 +171,7 @@ discard block |
||
173 | 171 | if ($this->scrSize['width'] != $s['width']) { |
174 | 172 | if ($s['width'] > 180) { |
175 | 173 | $this->wide = true; |
176 | - } |
|
177 | - else { |
|
174 | + } else { |
|
178 | 175 | $this->wide = false; |
179 | 176 | } |
180 | 177 | } |
@@ -260,15 +257,12 @@ discard block |
||
260 | 257 | $lastUpdate = $this->currenttime - $line["update"]; |
261 | 258 | if ($this->currenttime - $line["update"] < 2) { |
262 | 259 | $this->linesActive[$line["update"] . $line["pid"]] = $line; |
263 | - } |
|
264 | - elseif (($line['push'] === true && $lastUpdate > ($this->pingInterval + 2)) || ($line['push'] !== true && $lastUpdate > 4)) { |
|
260 | + } elseif (($line['push'] === true && $lastUpdate > ($this->pingInterval + 2)) || ($line['push'] !== true && $lastUpdate > 4)) { |
|
265 | 261 | $this->linesUnknown[$line["update"] . $line["pid"]] = $line; |
266 | - } |
|
267 | - else { |
|
262 | + } else { |
|
268 | 263 | $this->linesOpen[$line["update"] . $line["pid"]] = $line; |
269 | 264 | } |
270 | - } |
|
271 | - else { |
|
265 | + } else { |
|
272 | 266 | // do not show terminated + expired connections |
273 | 267 | if ($this->currenttime > $line['ended'] + $this->showTermSec) { |
274 | 268 | continue; |
@@ -490,51 +484,40 @@ discard block |
||
490 | 484 | $this->topCollector->ClearLatest(true); |
491 | 485 | |
492 | 486 | $this->terminate = true; |
493 | - } |
|
494 | - elseif ($cmds[0] == "clear") { |
|
487 | + } elseif ($cmds[0] == "clear") { |
|
495 | 488 | $this->topCollector->ClearLatest(true); |
496 | 489 | $this->topCollector->CollectData(true); |
497 | 490 | $this->topCollector->ReInitIPC(); |
498 | - } |
|
499 | - elseif ($cmds[0] == "filter" || $cmds[0] == "f") { |
|
491 | + } elseif ($cmds[0] == "filter" || $cmds[0] == "f") { |
|
500 | 492 | if (!isset($cmds[1]) || $cmds[1] == "") { |
501 | 493 | $this->filter = false; |
502 | 494 | $this->status = "No filter"; |
503 | 495 | $this->statusexpire = $this->currenttime + 5; |
504 | - } |
|
505 | - else { |
|
496 | + } else { |
|
506 | 497 | $this->filter = $cmds[1]; |
507 | 498 | $this->status = false; |
508 | 499 | } |
509 | - } |
|
510 | - elseif ($cmds[0] == "option" || $cmds[0] == "o") { |
|
500 | + } elseif ($cmds[0] == "option" || $cmds[0] == "o") { |
|
511 | 501 | if (!isset($cmds[1]) || $cmds[1] == "") { |
512 | 502 | $this->status = "Option value needs to be specified. See 'help' or 'h' for instructions"; |
513 | 503 | $this->statusexpire = $this->currenttime + 5; |
514 | - } |
|
515 | - elseif ($cmds[1] == "p" || $cmds[1] == "push" || $cmds[1] == "ping") { |
|
504 | + } elseif ($cmds[1] == "p" || $cmds[1] == "push" || $cmds[1] == "ping") { |
|
516 | 505 | $this->showPush = !$this->showPush; |
517 | - } |
|
518 | - elseif ($cmds[1] == "a" || $cmds[1] == "active") { |
|
506 | + } elseif ($cmds[1] == "a" || $cmds[1] == "active") { |
|
519 | 507 | $this->showOption = self::SHOW_ACTIVE_ONLY; |
520 | - } |
|
521 | - elseif ($cmds[1] == "u" || $cmds[1] == "unknown") { |
|
508 | + } elseif ($cmds[1] == "u" || $cmds[1] == "unknown") { |
|
522 | 509 | $this->showOption = self::SHOW_UNKNOWN_ONLY; |
523 | - } |
|
524 | - elseif ($cmds[1] == "d" || $cmds[1] == "default") { |
|
510 | + } elseif ($cmds[1] == "d" || $cmds[1] == "default") { |
|
525 | 511 | $this->showOption = self::SHOW_DEFAULT; |
526 | 512 | $this->showTermSec = self::SHOW_TERM_DEFAULT_TIME; |
527 | 513 | $this->showPush = true; |
528 | - } |
|
529 | - elseif (is_numeric($cmds[1])) { |
|
514 | + } elseif (is_numeric($cmds[1])) { |
|
530 | 515 | $this->showTermSec = $cmds[1]; |
531 | - } |
|
532 | - else { |
|
516 | + } else { |
|
533 | 517 | $this->status = sprintf("Option '%s' unknown", $cmds[1]); |
534 | 518 | $this->statusexpire = $this->currenttime + 5; |
535 | 519 | } |
536 | - } |
|
537 | - elseif ($cmds[0] == "reset" || $cmds[0] == "r") { |
|
520 | + } elseif ($cmds[0] == "reset" || $cmds[0] == "r") { |
|
538 | 521 | $this->filter = false; |
539 | 522 | $this->wide = false; |
540 | 523 | $this->helpexpire = 0; |
@@ -546,16 +529,14 @@ discard block |
||
546 | 529 | $this->wide = !$this->wide; |
547 | 530 | $this->status = ($this->wide) ? "w i d e view" : "normal view"; |
548 | 531 | $this->statusexpire = $this->currenttime + 2; |
549 | - } |
|
550 | - elseif ($cmds[0] == "help" || $cmds[0] == "h") { |
|
532 | + } elseif ($cmds[0] == "help" || $cmds[0] == "h") { |
|
551 | 533 | $this->helpexpire = $this->currenttime + 20; |
552 | 534 | } |
553 | 535 | // grep the log file |
554 | 536 | elseif (($cmds[0] == "log" || $cmds[0] == "l") && isset($cmds[1])) { |
555 | 537 | if (!file_exists(LOGFILE)) { |
556 | 538 | $this->status = "Logfile can not be found: " . LOGFILE; |
557 | - } |
|
558 | - else { |
|
539 | + } else { |
|
559 | 540 | system('bash -c "fgrep -a ' . escapeshellarg($cmds[1]) . ' ' . LOGFILE . ' | less +G" > `tty`'); |
560 | 541 | $this->status = "Returning from log, updating data"; |
561 | 542 | } |
@@ -565,8 +546,7 @@ discard block |
||
565 | 546 | elseif (($cmds[0] == "tail" || $cmds[0] == "t")) { |
566 | 547 | if (!file_exists(LOGFILE)) { |
567 | 548 | $this->status = "Logfile can not be found: " . LOGFILE; |
568 | - } |
|
569 | - else { |
|
549 | + } else { |
|
570 | 550 | $this->doingTail = true; |
571 | 551 | $this->scrClear(); |
572 | 552 | $this->scrPrintAt(1, 0, $this->scrAsBold("Press CTRL+C to return to grommunio-sync-top\n\n")); |
@@ -584,8 +564,7 @@ discard block |
||
584 | 564 | elseif (($cmds[0] == "error" || $cmds[0] == "e")) { |
585 | 565 | if (!file_exists(LOGERRORFILE)) { |
586 | 566 | $this->status = "Error logfile can not be found: " . LOGERRORFILE; |
587 | - } |
|
588 | - else { |
|
567 | + } else { |
|
589 | 568 | $this->doingTail = true; |
590 | 569 | $this->scrClear(); |
591 | 570 | $this->scrPrintAt(1, 0, $this->scrAsBold("Press CTRL+C to return to grommunio-sync-top\n\n")); |
@@ -598,8 +577,7 @@ discard block |
||
598 | 577 | $this->status = "Returning from tail, updating data"; |
599 | 578 | } |
600 | 579 | $this->statusexpire = time() + 5; // it might be much "later" now |
601 | - } |
|
602 | - elseif ($cmds[0] != "") { |
|
580 | + } elseif ($cmds[0] != "") { |
|
603 | 581 | $this->status = sprintf("Command '%s' unknown", $cmds[0]); |
604 | 582 | $this->statusexpire = $this->currenttime + 8; |
605 | 583 | } |
@@ -77,8 +77,7 @@ discard block |
||
77 | 77 | // TODO: a special status code needed? |
78 | 78 | SLog::Write(LOGLEVEL_WARN, sprintf("This property ('%s') is not allowed to use get in request", $propertyName)); |
79 | 79 | } |
80 | - } |
|
81 | - elseif (self::$decoder->getElementStartTag(SYNC_SETTINGS_SET)) { |
|
80 | + } elseif (self::$decoder->getElementStartTag(SYNC_SETTINGS_SET)) { |
|
82 | 81 | // set is available for OOF, device password and device information |
83 | 82 | switch ($propertyName) { |
84 | 83 | case SYNC_SETTINGS_OOF: |
@@ -108,8 +107,7 @@ discard block |
||
108 | 107 | if (!self::$decoder->getElementEndTag()) { |
109 | 108 | return false; |
110 | 109 | } // SYNC_SETTINGS_SET |
111 | - } |
|
112 | - else { |
|
110 | + } else { |
|
113 | 111 | SLog::Write(LOGLEVEL_WARN, sprintf("Neither get nor set found for property '%s'", $propertyName)); |
114 | 112 | |
115 | 113 | return false; |
@@ -24,8 +24,7 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | // TODO execute $data->Check() to see if SyncObject is valid |
27 | - } |
|
28 | - catch (StatusException $ex) { |
|
27 | + } catch (StatusException $ex) { |
|
29 | 28 | return false; |
30 | 29 | } |
31 | 30 |
@@ -49,11 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | // there are no SyncParameters for the hierarchy, but we use it to save the latest synckeys |
51 | 51 | $spa = self::$deviceManager->GetStateManager()->GetSynchedFolderState(false); |
52 | - } |
|
53 | - catch (StateNotFoundException $snfex) { |
|
52 | + } catch (StateNotFoundException $snfex) { |
|
54 | 53 | $status = SYNC_FSSTATUS_SYNCKEYERROR; |
55 | - } |
|
56 | - catch (StateInvalidException $sive) { |
|
54 | + } catch (StateInvalidException $sive) { |
|
57 | 55 | $status = SYNC_FSSTATUS_SYNCKEYERROR; |
58 | 56 | } |
59 | 57 | |
@@ -116,13 +114,11 @@ discard block |
||
116 | 114 | $serverid = $changesMem->ImportFolderDeletion($folder); |
117 | 115 | break; |
118 | 116 | } |
119 | - } |
|
120 | - else { |
|
117 | + } else { |
|
121 | 118 | SLog::Write(LOGLEVEL_WARN, sprintf("Request->HandleFolderSync(): ignoring incoming folderchange for folder '%s' as status indicates problem.", $folder->displayname)); |
122 | 119 | self::$topCollector->AnnounceInformation("Incoming change ignored", true); |
123 | 120 | } |
124 | - } |
|
125 | - catch (StatusException $stex) { |
|
121 | + } catch (StatusException $stex) { |
|
126 | 122 | $status = $stex->getCode(); |
127 | 123 | } |
128 | 124 | } |
@@ -199,12 +195,10 @@ discard block |
||
199 | 195 | |
200 | 196 | // get the new state from the backend |
201 | 197 | $newsyncstate = (isset($exporter)) ? $exporter->GetState() : ""; |
202 | - } |
|
203 | - catch (StatusException $stex) { |
|
198 | + } catch (StatusException $stex) { |
|
204 | 199 | if ($stex->getCode() == SYNC_FSSTATUS_CODEUNKNOWN) { |
205 | 200 | $status = SYNC_FSSTATUS_SYNCKEYERROR; |
206 | - } |
|
207 | - else { |
|
201 | + } else { |
|
208 | 202 | $status = $stex->getCode(); |
209 | 203 | } |
210 | 204 | } |
@@ -26,11 +26,9 @@ discard block |
||
26 | 26 | $create = $update = $delete = false; |
27 | 27 | if ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERCREATE) { |
28 | 28 | $create = true; |
29 | - } |
|
30 | - elseif ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERUPDATE) { |
|
29 | + } elseif ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERUPDATE) { |
|
31 | 30 | $update = true; |
32 | - } |
|
33 | - elseif ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERDELETE) { |
|
31 | + } elseif ($el[EN_TAG] == SYNC_FOLDERHIERARCHY_FOLDERDELETE) { |
|
34 | 32 | $delete = true; |
35 | 33 | } |
36 | 34 | |
@@ -130,11 +128,9 @@ discard block |
||
130 | 128 | if (self::$deviceManager->GetFolderTypeFromCacheById($serverid) != SYNC_FOLDER_TYPE_UNKNOWN && !self::$backend->Setup(GSync::GetAdditionalSyncFolderStore((($parentBackendId != false) ? $parentBackendId : $backendid)))) { |
131 | 129 | throw new StatusException(sprintf("HandleFolderChange() could not Setup() the backend for folder id '%s'", (($parentBackendId != false) ? $parentBackendId : $backendid)), SYNC_FSSTATUS_SERVERERROR); |
132 | 130 | } |
133 | - } |
|
134 | - catch (StateNotFoundException $snfex) { |
|
131 | + } catch (StateNotFoundException $snfex) { |
|
135 | 132 | $status = SYNC_FSSTATUS_SYNCKEYERROR; |
136 | - } |
|
137 | - catch (StatusException $stex) { |
|
133 | + } catch (StatusException $stex) { |
|
138 | 134 | $status = $stex->getCode(); |
139 | 135 | } |
140 | 136 | |
@@ -169,13 +165,11 @@ discard block |
||
169 | 165 | if (!$delete) { |
170 | 166 | // when creating, $folder->serverid is false, and the returned id is already mapped by the backend |
171 | 167 | $folder = $changesMem->ImportFolderChange($folder); |
172 | - } |
|
173 | - else { |
|
168 | + } else { |
|
174 | 169 | // delete folder |
175 | 170 | $changesMem->ImportFolderDeletion($folder); |
176 | 171 | } |
177 | - } |
|
178 | - catch (StatusException $stex) { |
|
172 | + } catch (StatusException $stex) { |
|
179 | 173 | $status = $stex->getCode(); |
180 | 174 | } |
181 | 175 | } |
@@ -197,8 +191,7 @@ discard block |
||
197 | 191 | self::$encoder->endTag(); |
198 | 192 | |
199 | 193 | self::$encoder->endTag(); |
200 | - } |
|
201 | - elseif ($update) { |
|
194 | + } elseif ($update) { |
|
202 | 195 | self::$encoder->startTag(SYNC_FOLDERHIERARCHY_FOLDERUPDATE); |
203 | 196 | |
204 | 197 | self::$encoder->startTag(SYNC_FOLDERHIERARCHY_STATUS); |
@@ -210,8 +203,7 @@ discard block |
||
210 | 203 | self::$encoder->endTag(); |
211 | 204 | |
212 | 205 | self::$encoder->endTag(); |
213 | - } |
|
214 | - elseif ($delete) { |
|
206 | + } elseif ($delete) { |
|
215 | 207 | self::$encoder->startTag(SYNC_FOLDERHIERARCHY_FOLDERDELETE); |
216 | 208 | |
217 | 209 | self::$encoder->startTag(SYNC_FOLDERHIERARCHY_STATUS); |
@@ -92,12 +92,10 @@ |
||
92 | 92 | |
93 | 93 | $result = $importer->ImportMessageMove($move["srcmsgid"], self::$deviceManager->GetBackendIdForFolderId($move["dstfldid"])); |
94 | 94 | // We discard the standard importer state for now. |
95 | - } |
|
96 | - catch (StatusException $stex) { |
|
95 | + } catch (StatusException $stex) { |
|
97 | 96 | if ($stex->getCode() == SYNC_STATUS_FOLDERHIERARCHYCHANGED) { // same as SYNC_FSSTATUS_CODEUNKNOWN |
98 | 97 | $status = SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID; |
99 | - } |
|
100 | - else { |
|
98 | + } else { |
|
101 | 99 | $status = $stex->getCode(); |
102 | 100 | } |
103 | 101 | } |
@@ -29,8 +29,7 @@ |
||
29 | 29 | $checkpurpose = (defined('CAINFO') && CAINFO) ? openssl_x509_checkpurpose($cert_pem, X509_PURPOSE_SMIME_SIGN, [CAINFO]) : openssl_x509_checkpurpose($cert_pem, X509_PURPOSE_SMIME_SIGN); |
30 | 30 | if ($checkpurpose === true) { |
31 | 31 | $status = SYNC_VALIDATECERTSTATUS_SUCCESS; |
32 | - } |
|
33 | - else { |
|
32 | + } else { |
|
34 | 33 | $status = SYNC_VALIDATECERTSTATUS_CANTVALIDATESIG; |
35 | 34 | } |
36 | 35 |
@@ -30,27 +30,23 @@ discard block |
||
30 | 30 | // Load all collections - do load states, check permissions and allow unconfirmed states |
31 | 31 | try { |
32 | 32 | $sc->LoadAllCollections(true, true, true, true, false); |
33 | - } |
|
34 | - catch (StateInvalidException $siex) { |
|
33 | + } catch (StateInvalidException $siex) { |
|
35 | 34 | // if no params are present, indicate to send params, else do hierarchy sync |
36 | 35 | if (!$params_present) { |
37 | 36 | $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; |
38 | 37 | self::$topCollector->AnnounceInformation("StateInvalidException: require PingParameters", true); |
39 | - } |
|
40 | - elseif (self::$deviceManager->IsHierarchySyncRequired()) { |
|
38 | + } elseif (self::$deviceManager->IsHierarchySyncRequired()) { |
|
41 | 39 | // we could be in a looping - see LoopDetection->ProcessLoopDetectionIsHierarchySyncAdvised() |
42 | 40 | $pingstatus = SYNC_PINGSTATUS_FOLDERHIERSYNCREQUIRED; |
43 | 41 | self::$topCollector->AnnounceInformation("Potential loop detection: require HierarchySync", true); |
44 | - } |
|
45 | - else { |
|
42 | + } else { |
|
46 | 43 | // we do not have a ping status for this, but SyncCollections should have generated fake changes for the folders which are broken |
47 | 44 | $fakechanges = $sc->GetChangedFolderIds(); |
48 | 45 | $foundchanges = true; |
49 | 46 | |
50 | 47 | self::$topCollector->AnnounceInformation("StateInvalidException: force sync", true); |
51 | 48 | } |
52 | - } |
|
53 | - catch (StatusException $stex) { |
|
49 | + } catch (StatusException $stex) { |
|
54 | 50 | $pingstatus = SYNC_PINGSTATUS_FOLDERHIERSYNCREQUIRED; |
55 | 51 | self::$topCollector->AnnounceInformation("StatusException: require HierarchySync", true); |
56 | 52 | } |
@@ -103,8 +99,7 @@ discard block |
||
103 | 99 | |
104 | 100 | continue; |
105 | 101 | } |
106 | - } |
|
107 | - catch (NoHierarchyCacheAvailableException $nhca) { |
|
102 | + } catch (NoHierarchyCacheAvailableException $nhca) { |
|
108 | 103 | SLog::Write(LOGLEVEL_INFO, sprintf("HandlePing(): unknown collection '%s', triggering HierarchySync", $folderid)); |
109 | 104 | $pingstatus = SYNC_PINGSTATUS_FOLDERHIERSYNCREQUIRED; |
110 | 105 | } |
@@ -112,8 +107,7 @@ discard block |
||
112 | 107 | // Trigger a Sync request because then the device will be forced to resync this folder. |
113 | 108 | $fakechanges[$folderid] = 1; |
114 | 109 | $foundchanges = true; |
115 | - } |
|
116 | - elseif ($class == $spa->GetContentClass()) { |
|
110 | + } elseif ($class == $spa->GetContentClass()) { |
|
117 | 111 | $pingable[] = $folderid; |
118 | 112 | SLog::Write(LOGLEVEL_DEBUG, sprintf("HandlePing(): using saved sync state for '%s' id '%s'", $spa->GetContentClass(), $folderid)); |
119 | 113 | } |
@@ -127,8 +121,7 @@ discard block |
||
127 | 121 | // if the folderid is in $pingable, we should ping it, else remove the flag |
128 | 122 | if (in_array($folderid, $pingable)) { |
129 | 123 | $spa->SetPingableFlag(true); |
130 | - } |
|
131 | - else { |
|
124 | + } else { |
|
132 | 125 | $spa->DelPingableFlag(); |
133 | 126 | } |
134 | 127 | } |
@@ -152,8 +145,7 @@ discard block |
||
152 | 145 | if (!$sc->PingableFolders()) { |
153 | 146 | $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; |
154 | 147 | SLog::Write(LOGLEVEL_DEBUG, "HandlePing(): no pingable folders found and no initialization data sent. Returning SYNC_PINGSTATUS_FAILINGPARAMS."); |
155 | - } |
|
156 | - elseif (!$this->lifetimeBetweenBound($sc->GetLifetime())) { |
|
148 | + } elseif (!$this->lifetimeBetweenBound($sc->GetLifetime())) { |
|
157 | 149 | $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; |
158 | 150 | SLog::Write(LOGLEVEL_DEBUG, sprintf("HandlePing(): ping lifetime not between bound (higher bound:'%d' lower bound:'%d' current lifetime:'%d'. Returning SYNC_PINGSTATUS_FAILINGPARAMS.", PING_HIGHER_BOUND_LIFETIME, PING_LOWER_BOUND_LIFETIME, $sc->GetLifetime())); |
159 | 151 | } |
@@ -165,8 +157,7 @@ discard block |
||
165 | 157 | self::$deviceManager->DoAutomaticASDeviceSaving(false); |
166 | 158 | $foundchanges = $sc->CheckForChanges($sc->GetLifetime(), $interval, true); |
167 | 159 | } |
168 | - } |
|
169 | - catch (StatusException $ste) { |
|
160 | + } catch (StatusException $ste) { |
|
170 | 161 | switch ($ste->getCode()) { |
171 | 162 | case SyncCollections::ERROR_NO_COLLECTIONS: |
172 | 163 | $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; |
@@ -193,8 +184,7 @@ discard block |
||
193 | 184 | self::$encoder->startTag(SYNC_PING_STATUS); |
194 | 185 | if (isset($pingstatus) && $pingstatus) { |
195 | 186 | self::$encoder->content($pingstatus); |
196 | - } |
|
197 | - else { |
|
187 | + } else { |
|
198 | 188 | self::$encoder->content($foundchanges ? SYNC_PINGSTATUS_CHANGES : SYNC_PINGSTATUS_HBEXPIRED); |
199 | 189 | } |
200 | 190 | self::$encoder->endTag(); |
@@ -204,8 +194,7 @@ discard block |
||
204 | 194 | |
205 | 195 | if (empty($fakechanges)) { |
206 | 196 | $changes = $sc->GetChangedFolderIds(); |
207 | - } |
|
208 | - else { |
|
197 | + } else { |
|
209 | 198 | $changes = $fakechanges; |
210 | 199 | } |
211 | 200 | |
@@ -222,8 +211,7 @@ discard block |
||
222 | 211 | if (empty($fakechanges)) { |
223 | 212 | self::$topCollector->AnnounceInformation(sprintf("Found change in %s", $sc->GetCollection($folderid)->GetContentClass()), true); |
224 | 213 | } |
225 | - } |
|
226 | - else { |
|
214 | + } else { |
|
227 | 215 | $announceAggregated += $changecount; |
228 | 216 | } |
229 | 217 | self::$deviceManager->AnnounceProcessStatus($folderid, SYNC_PINGSTATUS_CHANGES); |
@@ -233,13 +221,11 @@ discard block |
||
233 | 221 | self::$topCollector->AnnounceInformation(sprintf("Found %d changes in %d folders", $announceAggregated, count($changes)), true); |
234 | 222 | } |
235 | 223 | self::$encoder->endTag(); |
236 | - } |
|
237 | - elseif ($pingstatus == SYNC_PINGSTATUS_HBOUTOFRANGE) { |
|
224 | + } elseif ($pingstatus == SYNC_PINGSTATUS_HBOUTOFRANGE) { |
|
238 | 225 | self::$encoder->startTag(SYNC_PING_LIFETIME); |
239 | 226 | if ($sc->GetLifetime() > PING_HIGHER_BOUND_LIFETIME) { |
240 | 227 | self::$encoder->content(PING_HIGHER_BOUND_LIFETIME); |
241 | - } |
|
242 | - else { |
|
228 | + } else { |
|
243 | 229 | self::$encoder->content(PING_LOWER_BOUND_LIFETIME); |
244 | 230 | } |
245 | 231 | self::$encoder->endTag(); |
@@ -39,13 +39,11 @@ discard block |
||
39 | 39 | $fetch = true; |
40 | 40 | $operation['operation'] = SYNC_ITEMOPERATIONS_FETCH; |
41 | 41 | self::$topCollector->AnnounceInformation("Fetch", true); |
42 | - } |
|
43 | - elseif ($el[EN_TAG] == SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS) { |
|
42 | + } elseif ($el[EN_TAG] == SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS) { |
|
44 | 43 | $efc = true; |
45 | 44 | $operation['operation'] = SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS; |
46 | 45 | self::$topCollector->AnnounceInformation("Empty Folder", true); |
47 | - } |
|
48 | - elseif ($el[EN_TAG] == SYNC_ITEMOPERATIONS_MOVE) { |
|
46 | + } elseif ($el[EN_TAG] == SYNC_ITEMOPERATIONS_MOVE) { |
|
49 | 47 | $move = true; |
50 | 48 | $operation['operation'] = SYNC_ITEMOPERATIONS_MOVE; |
51 | 49 | self::$topCollector->AnnounceInformation("Move", true); |
@@ -315,24 +313,20 @@ discard block |
||
315 | 313 | try { |
316 | 314 | self::$topCollector->AnnounceInformation("Get attachment data from backend with file reference"); |
317 | 315 | $data = self::$backend->GetAttachmentData($operation['filereference']); |
318 | - } |
|
319 | - catch (StatusException $stex) { |
|
316 | + } catch (StatusException $stex) { |
|
320 | 317 | $status = $stex->getCode(); |
321 | 318 | } |
322 | - } |
|
323 | - else { |
|
319 | + } else { |
|
324 | 320 | try { |
325 | 321 | if (isset($operation['folderid'], $operation['serverid'])) { |
326 | 322 | self::$topCollector->AnnounceInformation("Fetching data from backend with item and folder id"); |
327 | 323 | $data = self::$backend->Fetch($operation['backendfolderid'], $operation['serverid'], $operation["cpo"]); |
328 | - } |
|
329 | - elseif (isset($operation['longid'])) { |
|
324 | + } elseif (isset($operation['longid'])) { |
|
330 | 325 | self::$topCollector->AnnounceInformation("Fetching data from backend with long id"); |
331 | 326 | $tmp = explode(":", $operation['longid']); |
332 | 327 | $data = self::$backend->Fetch(self::$deviceManager->GetBackendIdForFolderId($tmp[0]), $tmp[1], $operation["cpo"]); |
333 | 328 | } |
334 | - } |
|
335 | - catch (StatusException $stex) { |
|
329 | + } catch (StatusException $stex) { |
|
336 | 330 | // the only option to return is that we could not retrieve it |
337 | 331 | $status = SYNC_ITEMOPERATIONSSTATUS_CONVERSIONFAILED; |
338 | 332 | } |
@@ -396,8 +390,7 @@ discard block |
||
396 | 390 | |
397 | 391 | // send request to backend |
398 | 392 | self::$backend->EmptyFolder($operation['backendfolderid'], $operation['deletesubfolders']); |
399 | - } |
|
400 | - catch (StatusException $stex) { |
|
393 | + } catch (StatusException $stex) { |
|
401 | 394 | $status = $stex->getCode(); |
402 | 395 | } |
403 | 396 |
@@ -249,7 +249,7 @@ |
||
249 | 249 | if (self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_DELETESUBFOLDERS)) { |
250 | 250 | $operation['deletesubfolders'] = true; |
251 | 251 | if (($dsf = self::$decoder->getElementContent()) !== false) { |
252 | - $operation['deletesubfolders'] = (bool) $dsf; |
|
252 | + $operation['deletesubfolders'] = (bool)$dsf; |
|
253 | 253 | if (!self::$decoder->getElementEndTag()) { |
254 | 254 | return false; |
255 | 255 | } |