Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4KB

  1. <?php
  2. use Friendica\App;
  3. use Friendica\Core\Config;
  4. require_once("boot.php");
  5. if (empty($a)) {
  6. $a = new App(dirname(__DIR__));
  7. }
  8. @include(".htconfig.php");
  9. $lang = get_browser_language();
  10. load_translation_table($lang);
  11. require_once("include/dba.php");
  12. dba::connect($db_host, $db_user, $db_pass, $db_data, false);
  13. unset($db_host, $db_user, $db_pass, $db_data);
  14. Config::load();
  15. $maint_mode = 1;
  16. if ($argc > 1) {
  17. $maint_mode = intval($argv[1]);
  18. }
  19. Config::set('system', 'maintenance', $maint_mode);
  20. if ($maint_mode && ($argc > 2)) {
  21. $reason_arr = $argv;
  22. array_shift($reason_arr);
  23. array_shift($reason_arr);
  24. $reason = implode(' ', $reason_arr);
  25. Config::set('system', 'maintenance_reason', $reason);
  26. } else {
  27. Config::set('system', 'maintenance_reason', '');
  28. }
  29. if ($maint_mode) {
  30. $mode_str = "maintenance mode";
  31. } else {
  32. $mode_str = "normal mode";
  33. }
  34. echo "\n\tSystem set in $mode_str\n";
  35. if ($reason != '') {
  36. echo "\tMaintenance reason: $reason\n\n";
  37. } else {
  38. echo "\n";
  39. }
  40. echo "Usage:\n\n";
  41. echo "\tphp {$argv[0]} [1] [Maintenance reason|redirection url]\n";
  42. echo "\t\tSet the system in maintenance mode\n\n";
  43. echo "\t\tIf the optionally entered maintenance reason is an url\n";
  44. echo "\t\tthe visitor is redirected to that page.\n";
  45. echo "\n";
  46. echo "\t\tExamples:\n";
  47. echo "\t\t\tphp {$argv[0]} 1 System upgrade\n";
  48. echo "\t\t\tphp {$argv[0]} 1 http://domain.tld/downtime\n";
  49. echo "\n";
  50. echo "\tphp {$argv[0]} 0\n";
  51. echo "\t\tSet the system in normal mode\n\n";