New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR display a theme while maintenance mode is active #40993
base: master
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
Please create a changelog entry in https://github.com/owncloud/core/tree/master/changelog/unreleased, see previous examples and README in https://github.com/owncloud/core/tree/master/changelog |
SonarCloud Quality Gate failed. 0 Bugs 0.0% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
@@ -272,7 +272,7 @@ public function match($url) { | |||
$this->loadRoutes($app); | |||
} elseif (\substr($url, 0, 6) === '/core/' or \substr($url, 0, 10) === '/settings/') { | |||
\OC::$REQUESTEDAPP = $url; | |||
if (!\OC::$server->getConfig()->getSystemValue('maintenance', false) && !Util::needUpgrade()) { | |||
if (!Util::needUpgrade()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're in maintenance mode, we want to load the minimum number of apps possible. I don't think we want to remove that check.
I think it's better something like
if (!\OC::$server->getConfig()->getSystemValue('maintenance', false) && !Util::needUpgrade()) {
\OC_Apps::loadApps();
} else {
$themeApp = \OC::$server->getConfig()->getSystemValue('maintenance.theme', '');
if ($themeApp !== '') {
\OC_Apps::loadApp($themeApp);
}
}
We might also want to check if we need to upgrade there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!\OC::$server->getConfig()->getSystemValue('maintenance', false)
is also present in loadApps()
right at the beginning. That's why I removed it and incorporated the theme functionality directly into the loadApps
function itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, that's fine, but there is another problem in the loadApps()
. The method is expected to load the type of apps provided, so if I want to load authentication apps, why the theming apps are loaded with them? If I wanted to load also the theming apps I'd requested them later. The method is doing more than what is requested.
This way is clearer that we're in maintenance mode and we just want to load that specific app. Note that the loadApp
method (singular) doesn't have the maintenance check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, loadApps()
will only allow you to load specific apps when you are not in maintenance mode. The theme will only be loaded if maintenance mode is active. However, this is just what I intended to code, and I'm not certain if this is indeed the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core/lib/private/legacy/app.php
Line 174 in 28f19ce
public static function loadApp($app, $checkUpgrade = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it problematic that there isn't a maintenance check? In my commit, "loadApp" will only be called with the theme if maintenance is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maintenance mode is whatever we want to define as maintenance mode. Usually, it should be just the base product, but we can extend it to be the base product + the theme, so loading the theme should be fine as long as it doesn't crash.
In any case, the maintenance check is in the "lib/private/Router/Router.php", in the piece you've changed.
The theme is not enabled in maintenance mode by intention. Any theme (just like any other app) can cause issues during upgrade (which is the main purpose of the maintenance mode). From my pov this would be an acceptable change to show the theme in maintenance mode if we are not upgrading. |
My main complain is that I think the "load maintenance app" piece is misplaced. If I call In addition, placing the check within the |
67c8b89
to
5a7929e
Compare
5a7929e
to
1177115
Compare
Quality Gate failedFailed conditions |
Description
This pull request enables our users to utilize a theme while maintenance mode is active, whether it's the currently loaded theme or a different one.
Motivation and Context
I consider this feature a 'nice-to-have,' especially since a recent customer requested it. It ensures that the Web UI always displays branding when available.
I made a change to an 'if' statement in the Router.php file that I believed was unnecessary, but I still marked it as a 'Breaking change' because I'm not a PHP developer, and this file seemed significant to me.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: