Skip to content

Conversation

@phisch
Copy link
Contributor

@phisch phisch commented May 22, 2017

Description

As themes are now apps, and no apps are loaded during errors, the error messages are shown with the default theme. This loads any theme that has the default_enable tag active for all error pages (not requests without errors). I reused the functionality that was used for the installation/update screen.

Related Issue

https://github.com/owncloud/enterprise/issues/1984

How Has This Been Tested?

This has been tested by hand. I manually triggered all exceptions that run into error pages, and the theme loads successfully.

Sadly this brought my attention to another bug that was undetected until now:
Any theme that does not have the default_enable tag, that is activated during an error, is not loaded.

For 10.0.2 we should find a solution for this problem. We cannot rely on any database connection or whatever here. So the only way we can guarantee theme loading in every case, is if we save the enabled theme into the config file and use this one to enable the theme, and use the enabled apps (through database) as fallback.

I will create a tech-debt ticket for that with 10.0.2 milestone.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@phisch phisch added this to the 10.0.1 milestone May 22, 2017
@phisch phisch requested review from PVince81 and davitol May 22, 2017 13:23
@phisch phisch self-assigned this May 22, 2017
@phisch phisch requested a review from DeepDiver1975 May 22, 2017 13:40
@PVince81
Copy link
Contributor

does looks a bit risky. if the info.xml parsing itself also fails, then we'll get a white page. would need to catch an exception within the exception

@phisch
Copy link
Contributor Author

phisch commented May 22, 2017

It's the same code we are using for the install/update page. Also the same applies to printExceptionErrorPage if something fails there, we would have a whitepage too.

If the instance runs into an exception and then gets another exception while parsing the info.xml, then something went extremely horribly wrong.

@PVince81 PVince81 modified the milestones: 10.0.3, 10.0.1 May 30, 2017
OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN);
OC_Template::printErrorPage($ex->getMessage());
} catch (Exception $ex) {
\OC::loadDefaultEnabledAppTheme();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm you are loading the theme because OC_Template needs it when rendering output to the browser ... how about moving \OC::loadDefaultEnabledAppTheme(); to https://github.com/owncloud/core/blob/master/lib/private/legacy/template.php#L102? Loading will then be triggered by the OC_Template constructor itself.

Or you get the DI sortetd out for templates and inject it ... but that's something for 10.1 not 10.0.3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We got proper loading for normal pages. For error pages we have to parse the info.xml files, and that's something we should not do for all pages. That's why i had to do this hacky way.

The best way imo would be to store the path to the enabled theme in a local config file which can be accessed through a config object. But currently we do not support dynamic writing to config files and the enabled theme is the activated theme app.

Once we cleaned up db/local config we could think about a better solution for this, but the scope is too big for just this right now.

@felixboehm
Copy link
Contributor

I'd like to have a configuration like @phisch suggested, yet for now this is working well.

@felixboehm felixboehm merged commit 450cf0e into master Jul 18, 2017
@felixboehm felixboehm deleted the load-default-enabled-theme-for-error-pages branch July 18, 2017 16:08
@PVince81 PVince81 added backport-request p1-urgent Critical issue, need to consider hotfix with just that issue labels Aug 15, 2017
@PVince81
Copy link
Contributor

@phisch please backport, we need this in stable10

@phil-davis
Copy link
Contributor

phil-davis commented Aug 15, 2017

@PVince81 It should already be in stable10 #28622 because I noticed it missing a week ago.

@PVince81
Copy link
Contributor

ah ok. I discarded the changelog entry because I believed it was a testing thing.

I'll add it

@PVince81
Copy link
Contributor

added here #28694 (comment)

@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

2 - Developing p1-urgent Critical issue, need to consider hotfix with just that issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants