Renderers overridden during upgrade

Renderers overridden during upgrade

David Scotson -
回帖数:5
Hi all,

I seem to recall that recently some work being done broke upgrade and install, and as a result now renderers get overidden in some special way during updates.

Does anyone know about this, or can point me to somewhere documenting this? I've tried Googling but I'm not finding anything relevant. Currently I seem to get upgrade screens that are half my theme, and half... something else.
回复David Scotson

Re: Renderers overridden during upgrade

Mary Evans -

Hi David,

is this what you are meaning?

Read comments at start of document about API

https://github.com/moodle/moodle/blob/master/theme/bootstrapbase/layout/maintenance.php

Cheers

Mary

回复Mary Evans

Re: Renderers overridden during upgrade

David Scotson -
Thanks Mary,

it's not that exactly, but I think it's related. The bit of comment text that says "It's ultra important that this layout file makes no use of API's unless it absolutely needs to.", I seem to recall that got enforced by some code that swaps out theme renderers with other ones and that's what I'm hitting.

By looking up that bug, I found a link to this related bug which is what I was looking for,

https://tracker.moodle.org/browse/MDL-42057

regards,

dave
回复David Scotson

Re: Renderers overridden during upgrade

Gareth J Barnard -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

I would have thought that the code that instigates the themeoverriddenfactorymanager (or something like that) would change to the standardthemefactorymanager - search on 'factorymanager' would be the area that controls what set of renderers are being used.

回复Gareth J Barnard

Re: Renderers overridden during upgrade

David Scotson -
I'm not sure what does it, but when in maintenance/upgrade/install the core_renderer gets swapped with core_renderer_maintenance (and not core_maintenance_renderer as the documentation in the theme/upgrade.txt calls it).

To achieve what I want, I want to extend this renderer in my theme the same way as I intend to extend the normal core_renderer (an unfortunate bit of code duplication, but there appear to be reasons for this). I've not tried it yet but I assume it will work, I just have to be careful.
回复David Scotson

Re: Renderers overridden during upgrade

Gareth J Barnard -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

Oh ok,

The thing that does this is set by the line in the config.php file:

$THEME->rendererfactory = 'theme_overridden_renderer_factory';

And its the class 'theme_overridden_renderer_factory' that performs the class auto-loading of the theme renderers by looking for the file 'renderers.php' in the themes root folder.  If that class has been swapped out in favour of the standard core one then overriding will not work.