@@ -61,12 +61,10 @@ |
||
61 | 61 | if (!is_null ($cronJobData) && $cronJobData['skey'] == $syncJobData['skey']) { |
62 | 62 | // Job is exists and correct |
63 | 63 | writeLn($syncJobData['cmd'] . ': <fg=green;options=bold>OK</>'); |
64 | - } |
|
65 | - else { |
|
64 | + } else { |
|
66 | 65 | if (is_null ($cronJobData)) { |
67 | 66 | writeLn($syncJobData['cmd'] . ': <fg=yellow;options=bold>NEW</>'); |
68 | - } |
|
69 | - else { |
|
67 | + } else { |
|
70 | 68 | writeLn($syncJobData['cmd'] . ': <fg=red;options=bold>FIX</>'); |
71 | 69 | } |
72 | 70 |
@@ -99,8 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | if (!strpos ($dbServer['host']['$'], ':')) { |
101 | 101 | $dbHost = $dbServer['host']['$'] . ':3306'; |
102 | - } |
|
103 | - else { |
|
102 | + } else { |
|
104 | 103 | $dbHost = $dbServer['host']['$']; |
105 | 104 | } |
106 | 105 | |
@@ -188,8 +187,7 @@ discard block |
||
188 | 187 | if (isset ($dbInfo['dblist'][$dbLocation])) { |
189 | 188 | if (!isset ($config['createDatabase']['skipIfExist']) || !$config['createDatabase']['skipIfExist']) { |
190 | 189 | throw new Exception('Database already exists!'); |
191 | - } |
|
192 | - else { |
|
190 | + } else { |
|
193 | 191 | warning ('Database already exists - skipping'); |
194 | 192 | return true; |
195 | 193 | } |
@@ -210,12 +208,10 @@ discard block |
||
210 | 208 | |
211 | 209 | if ($dsnData['pass'] == '*') { |
212 | 210 | $dbCreateRequest['password'] = generatePassword (8); |
213 | - } |
|
214 | - else { |
|
211 | + } else { |
|
215 | 212 | $dbCreateRequest['password'] = $dsnData['pass']; |
216 | 213 | } |
217 | - } |
|
218 | - else { |
|
214 | + } else { |
|
219 | 215 | $dbCreateRequest['user'] = $dsnData['user']; |
220 | 216 | } |
221 | 217 | |
@@ -224,8 +220,7 @@ discard block |
||
224 | 220 | |
225 | 221 | if (isset ($response['doc']['error']['msg']['$'])) { |
226 | 222 | throw new Exception($response['doc']['error']['msg']['$']); |
227 | - } |
|
228 | - else { |
|
223 | + } else { |
|
229 | 224 | info ('Database successfully created'); |
230 | 225 | } |
231 | 226 | }); |
@@ -261,8 +256,7 @@ discard block |
||
261 | 256 | if (!isset ($dbInfo['dblist'][$dbLocation])) { |
262 | 257 | if (!isset ($config['deleteDatabase']['skipIfNotExist']) || !$config['deleteDatabase']['skipIfNotExist']) { |
263 | 258 | throw new Exception('Database not exist!'); |
264 | - } |
|
265 | - else { |
|
259 | + } else { |
|
266 | 260 | warning ('Database not exist - skipping'); |
267 | 261 | return true; |
268 | 262 | } |
@@ -277,8 +271,7 @@ discard block |
||
277 | 271 | |
278 | 272 | if (isset ($response['doc']['error']['msg']['$'])) { |
279 | 273 | throw new Exception($response['doc']['error']['msg']['$']); |
280 | - } |
|
281 | - else { |
|
274 | + } else { |
|
282 | 275 | info ('Database successfully deleted'); |
283 | 276 | } |
284 | 277 | }); |
@@ -302,8 +295,7 @@ discard block |
||
302 | 295 | if (in_array ($config['createDomain']['name'], $existDomains)) { |
303 | 296 | if (!isset ($config['createDomain']['skipIfExist']) || !$config['createDomain']['skipIfExist']) { |
304 | 297 | throw new Exception('Domain already exists!'); |
305 | - } |
|
306 | - else { |
|
298 | + } else { |
|
307 | 299 | warning1 ('Domain already exists - skipping'); |
308 | 300 | return true; |
309 | 301 | } |
@@ -325,8 +317,7 @@ discard block |
||
325 | 317 | |
326 | 318 | if (isset ($response['doc']['error']['msg']['$'])) { |
327 | 319 | throw new Exception($response['doc']['error']['msg']['$']); |
328 | - } |
|
329 | - else { |
|
320 | + } else { |
|
330 | 321 | info ('Domain successfully created'); |
331 | 322 | } |
332 | 323 | }); |
@@ -389,29 +380,25 @@ discard block |
||
389 | 380 | writeln(str_repeat('*', 32)); |
390 | 381 | if (!$versionData['php_mode_mod']) { |
391 | 382 | writeln('Apache module support (php_mode_mod) - <fg=red;options=bold>NO</>'); |
392 | - } |
|
393 | - else { |
|
383 | + } else { |
|
394 | 384 | writeln('Apache module support (php_mode_mod) - <fg=green;options=bold>YES</>'); |
395 | 385 | } |
396 | 386 | |
397 | 387 | if (!$versionData['php_mode_cgi']) { |
398 | 388 | writeln('CGI support (php_mode_cgi) - <fg=red;options=bold>NO</>'); |
399 | - } |
|
400 | - else { |
|
389 | + } else { |
|
401 | 390 | writeln('CGI support (php_mode_cgi) - <fg=green;options=bold>YES</>'); |
402 | 391 | } |
403 | 392 | |
404 | 393 | if (!$versionData['php_mode_fcgi_apache']) { |
405 | 394 | writeln('Apache fast-cgi support (php_mode_fcgi_apache) - <fg=red;options=bold>NO</>'); |
406 | - } |
|
407 | - else { |
|
395 | + } else { |
|
408 | 396 | writeln('Apache fast-cgi support (php_mode_fcgi_apache) - <fg=green;options=bold>YES</>'); |
409 | 397 | } |
410 | 398 | |
411 | 399 | if (!$versionData['php_mode_fcgi_nginxfpm']) { |
412 | 400 | writeln('nginx fast-cgi support (php_mode_fcgi_nginxfpm) - <fg=red;options=bold>NO</>'); |
413 | - } |
|
414 | - else { |
|
401 | + } else { |
|
415 | 402 | writeln('nginx fast-cgi support (php_mode_fcgi_nginxfpm) - <fg=green;options=bold>YES</>'); |
416 | 403 | } |
417 | 404 | |
@@ -469,19 +456,15 @@ discard block |
||
469 | 456 | |
470 | 457 | if ($newMode == 'php_mode_mod') { |
471 | 458 | $domainUpdateRequest['php_apache_version'] = $newVersion; |
472 | - } |
|
473 | - elseif ($newMode == 'php_mode_cgi') { |
|
459 | + } elseif ($newMode == 'php_mode_cgi') { |
|
474 | 460 | $domainUpdateRequest['php_cgi_version'] = $newVersion; |
475 | - } |
|
476 | - elseif ($newMode == 'php_mode_fcgi_apache') { |
|
461 | + } elseif ($newMode == 'php_mode_fcgi_apache') { |
|
477 | 462 | $domainUpdateRequest['php_cgi_version'] = $newVersion; |
478 | 463 | $domainUpdateRequest['php_apache_version'] = $newVersion; |
479 | - } |
|
480 | - elseif ($newMode == 'php_mode_fcgi_nginxfpm') { |
|
464 | + } elseif ($newMode == 'php_mode_fcgi_nginxfpm') { |
|
481 | 465 | $domainUpdateRequest['php_cgi_version'] = $newVersion; |
482 | 466 | $domainUpdateRequest['php_fpm_version'] = $newVersion; |
483 | - } |
|
484 | - else { |
|
467 | + } else { |
|
485 | 468 | throw new Exception('Unknown PHP mode!'); |
486 | 469 | } |
487 | 470 | |
@@ -489,8 +472,7 @@ discard block |
||
489 | 472 | |
490 | 473 | if (isset ($response['doc']['error']['msg']['$'])) { |
491 | 474 | throw new Exception($response['doc']['error']['msg']['$']); |
492 | - } |
|
493 | - else { |
|
475 | + } else { |
|
494 | 476 | info ('PHP successfully selected'); |
495 | 477 | } |
496 | 478 | }); |
@@ -536,8 +518,7 @@ discard block |
||
536 | 518 | if (in_array ($createAlias, $existAliases)) { |
537 | 519 | if (!isset ($config['createAlias']['skipIfExist']) || !$config['createAlias']['skipIfExist']) { |
538 | 520 | throw new Exception('Alias already exists!'); |
539 | - } |
|
540 | - else { |
|
521 | + } else { |
|
541 | 522 | warning ('Alias ' . $createAlias . ' already exists - skipping'); |
542 | 523 | continue; |
543 | 524 | } |
@@ -560,8 +541,7 @@ discard block |
||
560 | 541 | |
561 | 542 | if (isset ($response['doc']['error']['msg']['$'])) { |
562 | 543 | throw new Exception($response['doc']['error']['msg']['$']); |
563 | - } |
|
564 | - else { |
|
544 | + } else { |
|
565 | 545 | info ('Alias successfully created'); |
566 | 546 | } |
567 | 547 | }); |
@@ -606,8 +586,7 @@ discard block |
||
606 | 586 | if (!in_array($deleteAlias, $existAliases)) { |
607 | 587 | if (!isset ($config['deleteAlias']['skipIfNotExist']) || !$config['deleteAlias']['skipIfNotExist']) { |
608 | 588 | throw new Exception('Alias not exist!'); |
609 | - } |
|
610 | - else { |
|
589 | + } else { |
|
611 | 590 | warning ('Alias ' . $deleteAlias . ' not exist - skipping'); |
612 | 591 | continue; |
613 | 592 | } |
@@ -630,8 +609,7 @@ discard block |
||
630 | 609 | |
631 | 610 | if (isset ($response['doc']['error']['msg']['$'])) { |
632 | 611 | throw new Exception($response['doc']['error']['msg']['$']); |
633 | - } |
|
634 | - else { |
|
612 | + } else { |
|
635 | 613 | info ('Alias successfully deleted'); |
636 | 614 | } |
637 | 615 | }); |
@@ -655,8 +633,7 @@ discard block |
||
655 | 633 | if (!in_array ($config['deleteDomain']['name'], $existDomains)) { |
656 | 634 | if (!isset ($config['deleteDomain']['skipIfNotExist']) || !$config['deleteDomain']['skipIfNotExist']) { |
657 | 635 | throw new Exception('Domain not exist!'); |
658 | - } |
|
659 | - else { |
|
636 | + } else { |
|
660 | 637 | warning ('Domain not exist - skipping'); |
661 | 638 | return true; |
662 | 639 | } |
@@ -671,8 +648,7 @@ discard block |
||
671 | 648 | |
672 | 649 | if (!isset ($config['deleteDomain']['removeDir']) || !$config['deleteDomain']['removeDir']) { |
673 | 650 | $domainDeleteRequest['remove_directory'] = 'off'; |
674 | - } |
|
675 | - else { |
|
651 | + } else { |
|
676 | 652 | $domainDeleteRequest['remove_directory'] = 'on'; |
677 | 653 | } |
678 | 654 | |
@@ -680,8 +656,7 @@ discard block |
||
680 | 656 | |
681 | 657 | if (isset ($response['doc']['error']['msg']['$'])) { |
682 | 658 | throw new Exception($response['doc']['error']['msg']['$']); |
683 | - } |
|
684 | - else { |
|
659 | + } else { |
|
685 | 660 | info ('Domain successfully deleted'); |
686 | 661 | } |
687 | 662 | }); |
@@ -735,15 +710,13 @@ discard block |
||
735 | 710 | ->setopt(CURLOPT_SSL_VERIFYPEER, false) |
736 | 711 | ->setopt(CURLOPT_SSL_VERIFYHOST, false) |
737 | 712 | ->getJson(); |
738 | - } |
|
739 | - elseif ($method == 'get') { |
|
713 | + } elseif ($method == 'get') { |
|
740 | 714 | return Httpie::get($requestUrl) |
741 | 715 | ->query(prepareRequest($requestData)) |
742 | 716 | ->setopt(CURLOPT_SSL_VERIFYPEER, false) |
743 | 717 | ->setopt(CURLOPT_SSL_VERIFYHOST, false) |
744 | 718 | ->getJson(); |
745 | - } |
|
746 | - else { |
|
719 | + } else { |
|
747 | 720 | throw new Exception('Unknown request method'); |
748 | 721 | } |
749 | 722 | } |
@@ -763,8 +736,7 @@ discard block |
||
763 | 736 | |
764 | 737 | if (isset ($responseData['doc']['auth']['$id'])) { |
765 | 738 | set('ispmanager_session', $responseData['doc']['auth']['$id']); |
766 | - } |
|
767 | - else { |
|
739 | + } else { |
|
768 | 740 | throw new Exception('Error while create auth session'); |
769 | 741 | } |
770 | 742 | } |
@@ -779,8 +751,7 @@ discard block |
||
779 | 751 | |
780 | 752 | if (!$config['api']['secure']) { |
781 | 753 | $requestData['authinfo'] = $dsnData['user'] . ':' . $dsnData['pass']; |
782 | - } |
|
783 | - else { |
|
754 | + } else { |
|
784 | 755 | if (get('ispmanager_session') != '') { |
785 | 756 | $requestData['auth'] = get('ispmanager_session'); |
786 | 757 | } |
@@ -173,6 +173,4 @@ |
||
173 | 173 | $initializer->addTemplate('Drupal', new DrupalTemplate()); |
174 | 174 | $initializer->addTemplate('TYPO3', new Typo3Template()); |
175 | 175 | |
176 | - return $initializer; |
|
177 | - } |
|
178 | -} |
|
176 | + return $initializer |
|
179 | 177 | \ No newline at end of file |