| @@ -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 | |
| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 |      throw new \Exception('Please, configure "telegram_chat_id" parameter.'); | 
| 26 | 26 | }); | 
| 27 | 27 |  set('telegram_url', function () { | 
| 28 | -   return 'https://api.telegram.org/bot' . get('telegram_token') . '/sendmessage'; | |
| 28 | +    return 'https://api.telegram.org/bot' . get('telegram_token') . '/sendmessage'; | |
| 29 | 29 | }); | 
| 30 | 30 | |
| 31 | 31 | // Deploy message | 
| @@ -65,61 +65,61 @@ discard block | ||
| 65 | 65 | ->shallow() | 
| 66 | 66 | ->hidden(); | 
| 67 | 67 | |
| 68 | -  desc('Notifying Telegram about deploy finish'); | |
| 69 | -  task('telegram:notify:success', function () { | |
| 70 | -      if (!get('telegram_token', false)) { | |
| 71 | - return; | |
| 72 | - } | |
| 68 | +    desc('Notifying Telegram about deploy finish'); | |
| 69 | +    task('telegram:notify:success', function () { | |
| 70 | +        if (!get('telegram_token', false)) { | |
| 71 | + return; | |
| 72 | + } | |
| 73 | 73 | |
| 74 | -      if (!get('telegram_chat_id', false)) { | |
| 75 | - return; | |
| 76 | - } | |
| 74 | +        if (!get('telegram_chat_id', false)) { | |
| 75 | + return; | |
| 76 | + } | |
| 77 | 77 | |
| 78 | -      $telegramUrl = get('telegram_url') . '?' . http_build_query ( | |
| 79 | - Array ( | |
| 80 | -              'chat_id' => get('telegram_chat_id'), | |
| 81 | -              'text' => get('telegram_success_text'), | |
| 82 | - 'parse_mode' => 'Markdown', | |
| 83 | - ) | |
| 84 | - ); | |
| 78 | +        $telegramUrl = get('telegram_url') . '?' . http_build_query ( | |
| 79 | + Array ( | |
| 80 | +                'chat_id' => get('telegram_chat_id'), | |
| 81 | +                'text' => get('telegram_success_text'), | |
| 82 | + 'parse_mode' => 'Markdown', | |
| 83 | + ) | |
| 84 | + ); | |
| 85 | 85 | |
| 86 | - $httpie = Httpie::get($telegramUrl); | |
| 86 | + $httpie = Httpie::get($telegramUrl); | |
| 87 | 87 | |
| 88 | -      if (get('telegram_proxy', '') !== '') { | |
| 89 | -          $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); | |
| 90 | - } | |
| 88 | +        if (get('telegram_proxy', '') !== '') { | |
| 89 | +            $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); | |
| 90 | + } | |
| 91 | 91 | |
| 92 | - $httpie->send(); | |
| 92 | + $httpie->send(); | |
| 93 | 93 | }) | 
| 94 | 94 | ->once() | 
| 95 | 95 | ->shallow() | 
| 96 | 96 | ->hidden(); | 
| 97 | 97 | |
| 98 | -  desc('Notifying Telegram about deploy failure'); | |
| 99 | -  task('telegram:notify:failure', function () { | |
| 100 | -      if (!get('telegram_token', false)) { | |
| 101 | - return; | |
| 102 | - } | |
| 98 | +    desc('Notifying Telegram about deploy failure'); | |
| 99 | +    task('telegram:notify:failure', function () { | |
| 100 | +        if (!get('telegram_token', false)) { | |
| 101 | + return; | |
| 102 | + } | |
| 103 | 103 | |
| 104 | -      if (!get('telegram_chat_id', false)) { | |
| 105 | - return; | |
| 106 | - } | |
| 104 | +        if (!get('telegram_chat_id', false)) { | |
| 105 | + return; | |
| 106 | + } | |
| 107 | 107 | |
| 108 | -      $telegramUrl = get('telegram_url') . '?' . http_build_query ( | |
| 109 | - Array ( | |
| 110 | -              'chat_id' => get('telegram_chat_id'), | |
| 111 | -              'text' => get('telegram_failure_text'), | |
| 112 | - 'parse_mode' => 'Markdown', | |
| 113 | - ) | |
| 114 | - ); | |
| 108 | +        $telegramUrl = get('telegram_url') . '?' . http_build_query ( | |
| 109 | + Array ( | |
| 110 | +                'chat_id' => get('telegram_chat_id'), | |
| 111 | +                'text' => get('telegram_failure_text'), | |
| 112 | + 'parse_mode' => 'Markdown', | |
| 113 | + ) | |
| 114 | + ); | |
| 115 | 115 | |
| 116 | - $httpie = Httpie::get($telegramUrl); | |
| 116 | + $httpie = Httpie::get($telegramUrl); | |
| 117 | 117 | |
| 118 | -      if (get('telegram_proxy', '') !== '') { | |
| 119 | -          $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); | |
| 120 | - } | |
| 118 | +        if (get('telegram_proxy', '') !== '') { | |
| 119 | +            $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); | |
| 120 | + } | |
| 121 | 121 | |
| 122 | - $httpie->send(); | |
| 122 | + $httpie->send(); | |
| 123 | 123 | }) | 
| 124 | 124 | ->once() | 
| 125 | 125 | ->shallow() | 
| @@ -17,8 +17,8 @@ | ||
| 17 | 17 | }); | 
| 18 | 18 |  set('cimonitor_user', function () { | 
| 19 | 19 | return [ | 
| 20 | -      'name' => runLocally('git config --get user.name'), | |
| 21 | -      'email' => runLocally('git config --get user.email'), | |
| 20 | +        'name' => runLocally('git config --get user.name'), | |
| 21 | +        'email' => runLocally('git config --get user.email'), | |
| 22 | 22 | ]; | 
| 23 | 23 | }); | 
| 24 | 24 | |
| @@ -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 | } | 
| @@ -11,30 +11,30 @@ | ||
| 11 | 11 | |
| 12 | 12 |  set('shared_files', ['config/settings.inc.php', '.htaccess']); | 
| 13 | 13 |  set('shared_dirs', [ | 
| 14 | - 'img', | |
| 15 | - 'log', | |
| 16 | - 'download', | |
| 17 | - 'upload', | |
| 18 | - 'translations', | |
| 19 | - 'mails', | |
| 20 | - 'themes/default-bootstrap/lang', | |
| 21 | - 'themes/default-bootstrap/mails', | |
| 22 | - 'themes/default-bootstrap/pdf/lang', | |
| 14 | + 'img', | |
| 15 | + 'log', | |
| 16 | + 'download', | |
| 17 | + 'upload', | |
| 18 | + 'translations', | |
| 19 | + 'mails', | |
| 20 | + 'themes/default-bootstrap/lang', | |
| 21 | + 'themes/default-bootstrap/mails', | |
| 22 | + 'themes/default-bootstrap/pdf/lang', | |
| 23 | 23 | ] | 
| 24 | 24 | ); | 
| 25 | 25 |  set('writable_dirs', [ | 
| 26 | - 'img', | |
| 27 | - 'log', | |
| 28 | - 'cache', | |
| 29 | - 'download', | |
| 30 | - 'upload', | |
| 31 | - 'translations', | |
| 32 | - 'mails', | |
| 33 | - 'themes/default-bootstrap/lang', | |
| 34 | - 'themes/default-bootstrap/mails', | |
| 35 | - 'themes/default-bootstrap/pdf/lang', | |
| 36 | - 'themes/default-bootstrap/cache', | |
| 37 | - ] | |
| 26 | + 'img', | |
| 27 | + 'log', | |
| 28 | + 'cache', | |
| 29 | + 'download', | |
| 30 | + 'upload', | |
| 31 | + 'translations', | |
| 32 | + 'mails', | |
| 33 | + 'themes/default-bootstrap/lang', | |
| 34 | + 'themes/default-bootstrap/mails', | |
| 35 | + 'themes/default-bootstrap/pdf/lang', | |
| 36 | + 'themes/default-bootstrap/cache', | |
| 37 | + ] | |
| 38 | 38 | ); | 
| 39 | 39 | |
| 40 | 40 |  task('deploy', [ | 
| @@ -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 | 
| @@ -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 |