diff --git a/src/App.php b/src/App.php
index 400ea15b19..f59b15d1db 100644
--- a/src/App.php
+++ b/src/App.php
@@ -705,7 +705,8 @@ class App
// Initialize module that can set the current theme in the init() method, either directly or via App->setProfileOwner
$page['page_title'] = $moduleName;
- if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
+ // The "view" module is required to show the theme CSS
+ if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'view') {
$module = $router->getModule(Maintenance::class);
} else {
// determine the module class and save it to the module instance
diff --git a/view/theme/duepuntozero/style.php b/view/theme/duepuntozero/style.php
index a56a012825..575f0dff58 100644
--- a/view/theme/duepuntozero/style.php
+++ b/view/theme/duepuntozero/style.php
@@ -25,13 +25,12 @@ if (file_exists("$THEMEPATH/style.css")) {
echo file_get_contents("$THEMEPATH/style.css");
}
-$uid = $_REQUEST['puid'] ?? 0;
-
-$s_colorset = DI::config()->get('duepuntozero', 'colorset');
-$colorset = DI::pConfig()->get($uid, 'duepuntozero', 'colorset');
-
-if (empty($colorset)) {
- $colorset = $s_colorset;
+/*
+ * This script can be included when the maintenance mode is on, which requires us to avoid any config call
+ */
+if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
+ $s_colorset = DI::config()->get('duepuntozero', 'colorset');
+ $colorset = DI::pConfig()->get($_REQUEST['puid'] ?? 0, 'duepuntozero', 'colorset', $s_colorset);
}
$setcss = '';
diff --git a/view/theme/duepuntozero/theme.php b/view/theme/duepuntozero/theme.php
index cc77e781bf..327a1e73ba 100644
--- a/view/theme/duepuntozero/theme.php
+++ b/view/theme/duepuntozero/theme.php
@@ -23,27 +23,36 @@ use Friendica\App;
use Friendica\Core\Renderer;
use Friendica\DI;
+/*
+ * This script can be included even when the app is in maintenance mode which requires us to avoid any config call
+ */
+
function duepuntozero_init(App $a) {
-Renderer::setActiveTemplateEngine('smarty3');
+ Renderer::setActiveTemplateEngine('smarty3');
- $colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
- if (!$colorset)
- $colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
- if ($colorset) {
- if ($colorset == 'greenzero')
- DI::page()['htmlhead'] .= ''."\n";
- if ($colorset == 'purplezero')
- DI::page()['htmlhead'] .= ''."\n";
- if ($colorset == 'easterbunny')
- DI::page()['htmlhead'] .= ''."\n";
- if ($colorset == 'darkzero')
- DI::page()['htmlhead'] .= ''."\n";
- if ($colorset == 'comix')
- DI::page()['htmlhead'] .= ''."\n";
- if ($colorset == 'slackr')
- DI::page()['htmlhead'] .= ''."\n";
- }
+ $colorset = null;
+
+ if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
+ $colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
+ if (!$colorset)
+ $colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
+ }
+
+ if ($colorset) {
+ if ($colorset == 'greenzero')
+ DI::page()['htmlhead'] .= '' . "\n";
+ if ($colorset == 'purplezero')
+ DI::page()['htmlhead'] .= '' . "\n";
+ if ($colorset == 'easterbunny')
+ DI::page()['htmlhead'] .= '' . "\n";
+ if ($colorset == 'darkzero')
+ DI::page()['htmlhead'] .= '' . "\n";
+ if ($colorset == 'comix')
+ DI::page()['htmlhead'] .= '' . "\n";
+ if ($colorset == 'slackr')
+ DI::page()['htmlhead'] .= '' . "\n";
+ }
DI::page()['htmlhead'] .= <<< EOT
';
DI::page()['htmlhead'] .= '';;
diff --git a/view/theme/smoothly/theme.php b/view/theme/smoothly/theme.php
index e20e9003f9..9cc5b4a224 100644
--- a/view/theme/smoothly/theme.php
+++ b/view/theme/smoothly/theme.php
@@ -14,6 +14,10 @@ use Friendica\App;
use Friendica\Core\Renderer;
use Friendica\DI;
+/*
+ * This script can be included even when the app is in maintenance mode which requires us to avoid any config call
+ */
+
function smoothly_init(App $a) {
Renderer::setActiveTemplateEngine('smarty3');
diff --git a/view/theme/vier/style.php b/view/theme/vier/style.php
index 8e31a14bfc..ff888dac61 100644
--- a/view/theme/vier/style.php
+++ b/view/theme/vier/style.php
@@ -23,16 +23,16 @@ use Friendica\Core\Logger;
use Friendica\DI;
use Friendica\Network\HTTPException\NotModifiedException;
-$uid = $_REQUEST['puid'] ?? 0;
+/*
+ * This script can be included when the maintenance mode is on, which requires us to avoid any config call and
+ * use the following hardcoded default
+ */
+$style = 'plus';
-$style = DI::pConfig()->get($uid, 'vier', 'style');
+if (DI::mode()->has(\Friendica\App\Mode::MAINTENANCEDISABLED)) {
+ $uid = $_REQUEST['puid'] ?? 0;
-if (empty($style)) {
- $style = DI::config()->get('vier', 'style');
-}
-
-if (empty($style)) {
- $style = "plus";
+ $style = DI::pConfig()->get($uid, 'vier', 'style', DI::config()->get('vier', 'style', $style));
}
$stylecss = '';
diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php
index c156298381..a548d0a7dc 100644
--- a/view/theme/vier/theme.php
+++ b/view/theme/vier/theme.php
@@ -19,6 +19,10 @@ use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\Strings;
+/*
+ * This script can be included even when the app is in maintenance mode which requires us to avoid any config call
+ */
+
function vier_init(App $a)
{
$a->setThemeInfoValue('events_in_profile', false);
@@ -27,7 +31,12 @@ function vier_init(App $a)
$args = DI::args();
- if ($args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '') || $args->get(0) === 'network' && local_user()
+ if (
+ DI::mode()->has(App\Mode::MAINTENANCEDISABLED)
+ && (
+ $args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '')
+ || $args->get(0) === 'network' && local_user()
+ )
) {
vier_community_info();