{"record":{"id":"a7ee5ef0c4fe1849","repo":"Dolibarr/dolibarr","slug":"sorry-your-application-is-offline","errorCode":null,"errorMessage":"Sorry, your application is offline.","messagePattern":"Sorry, your application is offline\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"htdocs/main.inc.php","lineNumber":192,"sourceCode":"// include DOL_DOCUMENT_ROOT.'/core/lib/phpsessionindb.inc.php\n\n// If software has been locked. Only login getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED') is allowed.\nif (getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')) {\n\t$ok = 0;\n\tif ((!session_id() || !isset($_SESSION[\"dol_login\"])) && !isset($_POST[\"username\"]) && !empty($_SERVER[\"GATEWAY_INTERFACE\"])) {\n\t\t$ok = 1; // We let working pages if not logged and inside a web browser (login form, to allow login by admin)\n\t} elseif (isset($_POST[\"username\"]) && in_array($_POST[\"username\"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {\n\t\t$ok = 1; // We let working pages that is a login submission (login submit, to allow login by admin)\n\t} elseif (defined('NOREQUIREDB')) {\n\t\t$ok = 1; // We let working pages that don't need database access (xxx.css.php)\n\t} elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) {\n\t\t$ok = 1; // We let working pages that ask to work even if only login enabled (logout.php)\n\t} elseif (session_id() && isset($_SESSION[\"dol_login\"]) && in_array($_SESSION[\"dol_login\"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {\n\t\t$ok = 1; // We let working if user is allowed admin\n\t}\n\tif (!$ok) {\n\t\tif (session_id() && isset($_SESSION[\"dol_login\"]) && !in_array($_SESSION[\"dol_login\"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {\n\t\t\tprint 'Sorry, your application is offline.'.\"\\n\";\n\t\t\tprint 'You are logged with user \"'.$_SESSION[\"dol_login\"].'\" and only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'.\"\\n\";\n\t\t\t$nexturl = dolBuildUrl(DOL_URL_ROOT . '/user/logout.php', [], true);\n\t\t\tprint 'Please try later or <a href=\"'.$nexturl.'\">click here to disconnect and change login user</a>...'.\"\\n\";\n\t\t} else {\n\t\t\tprint 'Sorry, your application is offline. Only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'.\"\\n\";\n\t\t\t$nexturl = dolBuildUrl(DOL_URL_ROOT . '/');\n\t\t\tprint 'Please try later or <a href=\"'.$nexturl.'\">click here to change login user</a>...'.\"\\n\";\n\t\t}\n\t\texit;\n\t}\n}\n\n\n// Activate end of page function\nregister_shutdown_function('dol_shutdown');\n\n// Load debugbar\nif (isModEnabled('debugbar') && !GETPOST('dol_use_jmobile') && empty($_SESSION['dol_use_jmobile'])) {","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/Dolibarr/dolibarr/blob/598aa4bdada683d17ca04b1842548821ff0eb6c6/htdocs/main.inc.php#L174-L210","documentation":"When MAIN_ONLY_LOGIN_ALLOWED is set, Dolibarr restricts access to only the listed logins (maintenance mode). This branch fires when there is no logged-in session at all (or the login check otherwise left $ok=0): the visitor is told the app is offline and that only the listed administrators may connect for the moment.","triggerScenarios":"MAIN_ONLY_LOGIN_ALLOWED global (e.g. 'admin') set in setup or conf.php; an anonymous visitor hits any page requiring main.inc.php, so session has no dol_login and $ok stays 0.","commonSituations":"Admin enabled maintenance mode after an upgrade and left it on; a user hit the site during a migration window; staging copies of production conf with the restriction still enabled.","solutions":["Remove or empty MAIN_ONLY_LOGIN_ALLOWED in Home > Setup > Other Setup (or conf.php) once maintenance is over","Log in as one of the allowed admin logins listed in the message","Wait/retry later if maintenance is intentional"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// check before deploy: SELECT value FROM llx_const WHERE name='MAIN_ONLY_LOGIN_ALLOWED';","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove MAIN_ONLY_LOGIN_ALLOWED once maintenance ends","Announce maintenance windows and verify the flag afterwards","Automate a post-upgrade check that clears the restriction"],"tags":["dolibarr","maintenance-mode","access-control"],"backgroundTag":"feature-not-enabled","analyzedSha":"598aa4bdada683d17ca04b1842548821ff0eb6c6","analyzedAt":"2026-09-14T11:12:15.309Z","contentChangedAt":"2026-09-14T11:12:15.309Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}