3 * @file util/maintenance.php
6 use Friendica\Core\Config;
7 use Friendica\Core\L10n;
9 require_once 'boot.php';
10 require_once 'include/dba.php';
13 $a = new App(dirname(__DIR__));
16 @include(".htconfig.php");
18 $lang = L10n::getBrowserLanguage();
19 L10n::loadTranslationTable($lang);
21 dba::connect($db_host, $db_user, $db_pass, $db_data, false);
22 unset($db_host, $db_user, $db_pass, $db_data);
28 $maint_mode = intval($argv[1]);
31 Config::set('system', 'maintenance', $maint_mode);
33 if ($maint_mode && ($argc > 2)) {
35 array_shift($reason_arr);
36 array_shift($reason_arr);
38 $reason = implode(' ', $reason_arr);
39 Config::set('system', 'maintenance_reason', $reason);
41 Config::set('system', 'maintenance_reason', '');
45 $mode_str = "maintenance mode";
47 $mode_str = "normal mode";
50 echo "\n\tSystem set in $mode_str\n";
53 echo "\tMaintenance reason: $reason\n\n";
59 echo "\tphp {$argv[0]} [1] [Maintenance reason|redirection url]\n";
60 echo "\t\tSet the system in maintenance mode\n\n";
61 echo "\t\tIf the optionally entered maintenance reason is an url\n";
62 echo "\t\tthe visitor is redirected to that page.\n";
64 echo "\t\tExamples:\n";
65 echo "\t\t\tphp {$argv[0]} 1 System upgrade\n";
66 echo "\t\t\tphp {$argv[0]} 1 http://domain.tld/downtime\n";
68 echo "\tphp {$argv[0]} 0\n";
69 echo "\t\tSet the system in normal mode\n\n";