Since the theme can now be initialized without the database, I'd like to make the maintenance pages themable, and move the maintenance specific stuff into garland.
Changing the maintenance theme will require making a change in settings.php and I think profiles should also be able to specify the maintenance theme.
It should be possible to discover a theme without the database just with its name, so:
$conf['maintenance_theme'] = 'garland';
Using drupal_system_listing on the themes directories, we can find garland pretty easily and read its .info file. (In fact, we can probably add an argument to system_theme_data to ignore the system table entirely...or break up the function so that the part that doesn't need the database is handled independently, and that part can move into theme.inc)
drupal_maintenance_theme() can, then, discover the theme based upon the name, load the abbreviated registry. We could possibly go an additional step and specifically mark theme functions that don't require the database, but I think that should probably only be done as a documentation issue. i.e, create a maintenance theme @group and @ingroup theme implementations that can be used during maintenance (to make it easy to tell).
Once that's set up, the existing maintenance themes just need to be converted to use the newer philosophies. They're actually fairly close, since they do a bunch of variables settings and call out to templates already.
I intend to work on this as I have time, but I dunno how much time I have. Discussion on the topic is welcome.
Comment | File | Size | Author |
---|---|---|---|
#94 | custom_maintenance.diff | 470 bytes | Dave Cohen |
#87 | maintenance_update_fix_b.patch | 7.44 KB | dvessel |
#85 | maintenance_update_fix.patch | 6.57 KB | dvessel |
#74 | drupal-HEAD.maintenance-edge1.patch | 1.19 KB | sun |
#74 | drupal-HEAD.maintenance-edge2.patch | 807 bytes | sun |
Comments
Comment #1
dvessel CreditAttribution: dvessel commentedsubscribing
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedYou can already hook these functions in your theme. I forget now where I found out. When I run across it again I'll post. But you basically just garland_maintenance_theme, i.e. replacing the drupal_ part of the function with your themes name.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedLook at theme_maintenance_page API documentation.
So,
and the Maintenance Page has your themed maintenance page.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedEarnie, what are you talking about? Drupal always calls theme_maintenance_page or theme_install_page or the like, never theme('maintenance_page') or theme('install_page'). You're confusing things.
Comment #5
add1sun CreditAttribution: add1sun commentedsubscribe
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commented@merlinofchaos: Sorry, that is often the case. The title misled me to think the track that I did especially in light of the fact that I went searching for ways to themeize the site maintenance UI and that is what I came up with. I haven't done too much with theme coding but looking at the theme() API documentation I now know what you are after. I'll look further at the API and see what else I can think of.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedFor a little more clarity of what I was talking about in my first post I'm posting the entire phptemplate_maintenance_page() function I used for an antique_white theme. This gives the site maintenance page the theme to match the site. So if the same function for the garland them existed then the Site Maintenance page would be themed to the garland theme.
Comment #8
dvessel CreditAttribution: dvessel commentedearnie: Yeah, the maintenance page can be themed but that would depend on the db being setup and active. Merlins' proposal bypasses the need for a db.
+1 to the idea. I've tried some crazy hacks to get this done before and I've seen others too attempt it too. They are all dirty.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedI don't get it. The DB must be setup before the pages can be displayed. You do the install, you create the first account, you go to the administration page and set the site in maintenance mode and your done. If the garland theme already contained the phptemplate_maintenance_page it would be themed. So the change needs to happen with the theme/garland/template.php file.
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedThe maintenance theme includes all of the installer pages.
So it is more than just the "Site is in maintenance mode" page. The DB may not exist for several of the maintenace pages (including "OH MY GOD YOUR SITE IS HOSED error messages, which *must* be themeable, IMO, for corporate sites).
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedI get it now. Site up for months or years and the DB crashes. Now pages are not served except in limited form. So we need a method to identify JEOPARDY_MAINTENANCE and display the Site Maintenance page. Since this may happen with multi-site setup a DB crash can affect more than one site. Does sites/all/settings.php get loaded, if not we could cause that to happen and define JEOPARDY_MAINTENANCE and display the Site Maintenance if set. For individual sites that may have corrupted tables where the outage is localized to the one site the JEOPARDY_MAINTENANCE would be defined in the site/mysite/settings.php file. Then change the bootstrap process to check it. The value of JEOPARDY_MAINTENACE could be the value of the theme, true or false.
Comment #12
merlinofchaos CreditAttribution: merlinofchaos commentedFinally, here's a patch. This does everything I really wanted this patch to do:
1) It promotes maintenance.tpl.php into a proper template, maintenance_page.tpl.php
2) It sets aside he maintenance theme code into maintenance.inc to make it easier to identify and can be conditionally loaded, since the maintenance theme isn't needed most of the time.
3) I had to move part of system_theme_data into the includes, and I also didn't want THAT to be loaded all of the time, so I made a theme.admin.inc -- I have to imagine more stuff can go into this, though nothing came up. We already do this with some other less used APIs as well.
This can be easily tested: copy maintenance_page.tpl.php into garland and modify. Or copy it into your theme, go to settings.php and set $conf['maintenance_theme'] = 'garland' (or the name of your theme). You will need to copy or symlink it to install_page.tpl.php to get the install page version. (I'm not sure how well the install page can even be themed, since no settings.php exists at that point. Further investigation into allowing the a profile to set the installer theme might be necessary).
I'm particularly proud of this piece of work. Corporate sites want to protect their branding. Since Steven made it even possible to theme the maintenance stuff, this advance makes it possible for sites to protect their branding when their site goes into maintenance mode.
Note that unrelated to this, I've discovered that maintenance mode currently does not work on HEAD. This is true with or without this patch.
Comment #13
add1sun CreditAttribution: add1sun commentedWell I went ahead and applied this and played around a bit. As for testing it is sort of hard to really see much with maintenance mode broken but I did change some stuff up on the install_page.tpl.php and it worked great. No errors or other funny business.
I think it would be a good idea for there to be some documentation perhaps on the Site Maintenance page that says you can customize this by blah blah blah.
This is one of those things that just bugs the crap out of a themer so I'm excited about this getting in along with the other cool theming changes.
Comment #14
merlinofchaos CreditAttribution: merlinofchaos commentedMaintenance mode has been restored, so it may now be tested as well. Since that mode didn't exist in Drupal 6, obviously I've done very little testing on it with this patch (actually none yet, as I haven't gotten back to it).
http://drupal.org/node/146937
Also, dmitrig01 did some testing on the patch and all worked as advertised, but he didn't post his results here. SO that's another successful test. I think that means we can probably RTBC this soon.
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commentedResult of my own code review, now that I've had a couple of days of distance. Fixed several minor code problems.
Comment #16
add1sun CreditAttribution: add1sun commentedLatest version of HEAD - the patch applies with a few offsets but then I get WSOD on install.php and also when trying to do update.php from an older version of HEAD. Reversing the patch let's me proceed. :( Also applying the patch after install and setting the site to maintenance mode gives WSOD as well.
So, I went ahead and applied the patch and copied garland's page.tpl.php to be maintenance_page.tpl.php on a successfully installed (that is just fresh HEAD) site and maintenance mode "worked" but was plain HTML with errors:
I also did the same (copy page.tpl.php) for the install_page.tpl.php and the installation worked (as well as the maintenence mode) BUT my modified template file (having a I'M AN INSTALL PAGE header) did not show. Just the standard install/maintenance page.
Now that I am sufficiently confused, hopefully you are not. :p
Comment #17
merlinofchaos CreditAttribution: merlinofchaos commentedmaintenance_page.tpl.php somehow got left out of the last page.
Getting the installer to use a different theme is al ittle different, because there is no settings.php. It turns out, though, that it's super easy. At the beginning of the .profile, right after the // $id line, just do this:
global $conf;
$conf['maintenance_theme'] = 'themename';
That'll automatically switch the installer to your theme.
I tried it with bluemarine which makes one hellaciously ugly installer theme, but it works.
Comment #18
add1sun CreditAttribution: add1sun commentedYep, that does the trick. So nice to be able to edit the maintenance page just like anything else. Kudos!
Comment #19
merlinofchaos CreditAttribution: merlinofchaos commentedI believe this is ready to go.
Comment #20
Dries CreditAttribution: Dries commentedI think this looks OK. The only thing I'm not sure about is theme.admin.inc (vs theme.inc). I'd actually prefer to put that in a separate patch after some more discussion. The maintenance.inc seems reasonable to me though.
Comment #21
Steven CreditAttribution: Steven commentedIf the patch says:
... why is the Garland maintenance_page.tpl.php still in the includes directory rather than in the Garland directory?
Comment #22
merlinofchaos CreditAttribution: merlinofchaos commentedActually, I think the only reason it will crash horribly is because there's no theme, so the object it's looking for will have no information at all. It's entirely possible that we could dummy something up to keep things working there, but it seems like a waste of code.
Even though the default installer is using Garland's style, it made more sense to keep the maintenance page tpl with Drupal itself rather than having it live in the theme.
Dries: The main reason for theme.admin.inc here is that a bunch of code is getting moved from system.module to theme.inc and I was growing concerned with how much code a minimal bootstrap was being forced to load. I can undo that and still all the code in theme.inc anyway, if you really want, but if anything I'd say an extra step there would be accomplished similarly be taking this version and then analyzing if we need to tweak it. I've tweaked it as much as I think I can right now. (Ok, and selfishly, it'd be extra work that I'm 100% sure no one else will do =)
Comment #23
eaton CreditAttribution: eaton commentedJust wanted to come in and give a HUGE +1 to this. Drupal is being used in more and more high-profile sites, where "what happens when there's an error" must be carefully managed and controlled as much as the everyday situations. In addition, the rise of distributions and profiles means that branding and/or massaging the install experience is important as well. I know of three clients we've had who required core hacks to achieve this functionality on their sites.
This is much needed. +1. Would RTBC if it weren't already. ;)
Comment #24
merlinofchaos CreditAttribution: merlinofchaos commentedDries: Is what's holding this up that I balked on folding theme.admin.inc back into theme.inc? I can do that and create a new issue to split it up again, if that's the only roadblock here.
Comment #25
dvessel CreditAttribution: dvessel commentedIs this going in? As it currently stands, the notes on theme_maintenance_page mentions that the function is *not* themeable but it's a registered function. Seems like it can be overridden.
And it's a bit odd that maintenance.tpl.php is inside the /misc folder for HEAD. Patch doesn't apply anymore. Tried to re-roll but the changes are too big.
Comment #26
merlinofchaos CreditAttribution: merlinofchaos commentedSince this sat RTBC for 2 months, and we're well past codefreeze now, I don't see any point in rerolling this without getting a core committer in here to say it's worth spending time on.
Comment #27
dvessel CreditAttribution: dvessel commentedI discovered that the maintenance is indeed not overridable. This is a serious regression.
What this patch does is let themers override and it also *does not* depend on the database to function.
I tried to keep it as simple as possible. Only the theme_maintenance_page() function + maintenance.tpl.php file were affected.
The way it works now is this. A handful of directories are checked for.
1. sites/example.com/maintenance
2. sites/default/maintenance
3. misc
From there the maintenance.tpl.php, style.css, logo and favicon.ico is checked for. If no overrides are found then the default behavior is maintained. Minnelli is also checked as a fallback for the logo and style.css.
Comment #28
dvessel CreditAttribution: dvessel commentedThis is critical IMO.
Comment #29
dvessel CreditAttribution: dvessel commentedAnd a bug..
Comment #30
dvessel CreditAttribution: dvessel commentedComment #31
dvessel CreditAttribution: dvessel commentedI was informed by greggles that this would not get in unfortunately.
Here's another anyway just to fix which folders are checked.
1. sites/example.com/maintenance or sites/default/maintenance. Wherever it's installed.
2. sites/all/maintenance -changed from sites/default/maintenance
3. misc
Comment #32
gregglesI believe this regression is actually part of http://drupal.org/node/117018 which changed the doxygen to say "note - not themeable"
I don't see in the discussion where it explains why those shouldn't be themeable, though.
Comment #33
dvessel CreditAttribution: dvessel commentedThanks for the pointer Greggles,
It looks like there's a bigger issue with viewing the maintenance page. The registry doesn't read from the db and even weirder is that the coded registry doesn't return proper results.
Here's an example from "page" when viewed in maintenance mode:
Expected results.. Note that I removed page.tpl.php from garland to show what gets registered outside the theme.
Comment #34
merlinofchaos CreditAttribution: merlinofchaos commentedOk, this is a bit of an ugly bug in that it means that maintenance page stuff can't be moved into template_preprocess functions because for those to work, the registry *must* go through the discovery process and not just use the current hack where it simply returns the basic results from drupal_common_themes.
I'm not exactly sure what to suggest on this one. I, for one, would really like to see this get fixed in Drupal 6, because I think it is a major problem that maintenance pages can't be themable even though it's fairly easy to do so.
But to do it, you're going to have to restore my code from my original patch that processes the theme registry in a database-safe (i.e, no db available) manner.
Comment #35
dvessel CreditAttribution: dvessel commentedWell, never mind that. I thought it still went through _theme_build_registry even without a db.
Either the patch I posted can be accepted or the _theme_load_registry has to be reworked so it works with and without a db connection. Not sure what to do there.
Comment #36
dvessel CreditAttribution: dvessel commented@merlinofchaos, Yeah, that looks like a lot of work and it'd take me forever to figure out.
Comment #37
dvessel CreditAttribution: dvessel commentedI decided to tackle this in a better way. Closer to what Merlinofchaos had in mind but I'll try change as little code as I can. I have a better idea now after a little IRC chatting.
Comment #38
Senpai CreditAttribution: Senpai commentedSubscribing.
Comment #39
dvessel CreditAttribution: dvessel commentedI'm still trying to get this done. It's not easy, and sorry for the delay.
Comment #40
xmacinfoSubscribing
Comment #41
chx CreditAttribution: chx commenteddvessel, try to share the ideas and whatever code you have. let us help.
Comment #42
dvessel CreditAttribution: dvessel commentedChx:
This definitely needs work but marking CNR just to get your and other opinions.
The patch works. Maintenance page is themable in situations where the site is explicitly set into offline mode. It also works when the database is dead but in order to use a custom theme when the databse is dead, you have to set the 'maintenance_theme' key for the $config array inside your settings.php file.
The theme registry is built only one way. Previously, it would go off on an alternate route to rebuild a custom registry just for the off line page. Now it just builds it anew when the db can't be touched. This is done with the new function "db_is_active()".
The install and update pages will always default to Minnelli.
The function list_theme_engines() has been removed. It seems to serve no purpose since the engine information is already attached to $theme->info. It's counterpart to save the theme engine information into the database was also removed from system_theme_data().
It needs more loving. I've spent too much time on this already so if anyone want's to jump in, it'd be great.
Comment #43
dvessel CreditAttribution: dvessel commentedI mean I'll jump back on this later. I'm not abandoning it. :)
Comment #44
dvessel CreditAttribution: dvessel commentedForgot to remove theme_maintenance_page which was replaced with the preprocessor.
Another note, the maintenance template and style sheets where moved to modules/system/ and it's based on the default page.tpl.php file. Previously, it was based on the markup from garland. So, the minnelli maintenance page was added inside Minnelli folder since that's the default.
Comment #45
BioALIEN CreditAttribution: BioALIEN commentedsubscribing
Comment #46
jleider CreditAttribution: jleider commentedSubscribing
Comment #47
keith.smith CreditAttribution: keith.smith commentedI'm pretty certain there is an existing issue in the documentation component queue for some of these strings, which I'll find and mark as a duplicate of this issue.
I know none of these items -- or very very few of them -- are changes in this patch, but can some string cleanup happen here:
Can this:
Be something like (change person):
There are several instances where an error message says something similar to this example:
Can that last sentence (on all those instances -- there are a bunch of them) be just (no "should probably"):
Where the error messages use "We", like in (change person):
Is there another alternative?
Just:
"
Or
to something like:
Comment #48
Gábor HojtsyI looked through the patch. Some comments:
- I agree that misc/maintenance.tpl.php and misc/maintenance.css are not well placed, so these could use some move to a more proper place (system module possibly). Their dependency on Minnelli is also evident. I see this patch does add a generic maintenance page and then a minnelli themed one.
- Why not make distinct themes for the install, update, error and offline maintenance pages, reusing the generic theme if no specific is available? That would save us from redoing lots of stuff around the install and update system, which there is no intention to make themeable as it seems, and admittedly, they should not be themeable for consistency.
- There is lots of stuff changed in the patch, both external and internal APIs.
- There was no progress on this issue for weeks.
Let me remind you that this issue is in the critical queue for Drupal 6 which means that as it stands now a Drupal 6 release is hold back in part by this issue. If there is no intention in pursuing this feature anymore, we can close the issue, or move to D7 if there is no progress to be done here in the D6 timeframe.
I agree that restoring the themeability of the maintenance page is desired, and I hope it will be doable in D6, but the release should not be hold back if there is no interest in pushing this forward.
Comment #49
dvessel CreditAttribution: dvessel commentedEveryone.. I'm sorry for the delay. I've been swamped with work.
Gábor, It now uses distinct themable function for update, install and maintenance but it shared a good deal of code.
theme_maintenance_page is a templated function while update and install are both "regular" functions but they tap into template_preprocess_maintenance_page to keep all the variables consistent. Also the variables in there mirror what's available inside the normal "page" hook. Again, for consistency.
A new template suggestion is also made available when the database is off-line. This allows the maintenance page to swap the content entirely so site visitors don't see db errors.
Comment #50
dvessel CreditAttribution: dvessel commentedBTW, while testing this you may run into a notice about trying to get a property of non-object while installing. It's not due to this patch. system.install uses the "t()" function all over the place before the global $language is available.
Comment #51
Dries CreditAttribution: Dries commentedI'm not sure this comment reflect reality. The active theme is something different from the 'maintenance_theme' not? Why should there be a maintenance theme when we're able to load the active theme?
The part in the code where you processes the theme_registry when the database is inactive, could use more documentation. It wasn't instantly clear what was going on in that code or why it matters. It could do with more verbose documentation (that is non-obvious).
+ /* Add favicon */
should be+ // Add favicon
I'm not sure I'd quality this issue as 'critical'. Regression or not, critical issues are issues that prevent your Drupal installation from working.
Comment #52
dvessel CreditAttribution: dvessel commentedDries, that's just passing in what's set inside settings.php when the db is inactive. It must use 'theme_default' so it properly initializes the theme within init_theme().
drupal_maintenance_theme() is run in only these cases:
1.) install page. -to force Minnelli.
2.) update page. -the same as install.
3.) db dies. -to read what's set as the 'maintenance_theme'.
When the site is set to off-line mode and the db is working, drupal_maintenance_theme() isn't run (I removed it). drupal_site_offline() is called and the theming system is intact so it will work without problems.
I'll get a patch up shortly.
Comment #53
dvessel CreditAttribution: dvessel commentedOkay, _theme_load_registry_offline() was moved into the main _theme_load_registry(). I realized it wasn't needed. Not sure if the docs are what you wanted in here. Hope it makes sense.
The other issues I changed. the comments using /* */ was simply copied from template_preprocess_page() so I changed that too to what you suggested.
Comment #54
ksenzeeSubscribing. Would this be possible to backport, or is it 6.x specific?
Comment #55
dvessel CreditAttribution: dvessel commentedksenzee, the theming system between the two versions is very different so it won't happen.
Any further feedback would be nice. Dries, Gábor: if there's anything else in here that doesn't seem satisfactory then please tell me. I'll try to clarify or fix it ASAP.
And anyone else looking over this, please review and verify that it works.
Comment #56
eaton CreditAttribution: eaton commentedThis may have been broken by the recent requirements changes, but when the patch is applied, error messages and notices during the installation process no longer appear. That's pretty critical since it means people get no indication of why they can't install. I'm taking a look to see if I can track it down but am not sure I'll have time to fix it.
Comment #57
dvessel CreditAttribution: dvessel commentedEaton, I accidentally flipped the 'show_message' flag to false inside theme_install_page(). That's a simple fix.
I'm in the process of reworking some areas so I'll roll it into the next patch.
Comment #58
dvessel CreditAttribution: dvessel commentedThe previous patch would use the currently selected theme when in offline mode. I changed this since some themes might not be setup for it and break the layout completely.
In drupal 5, it had to be themed explicitly, so, it's the same in here. First the theme must be explicitly enabled for off-line mode but this time it must be set through settings.php + the theme overrides if the theme needs it.
Pure CSS themes would just have to enable it through settings.php since the markup from maintenance-page.tpl.php and page.tpl.php is very similar.
I also moved alot of the functions into a new theme.maintenance.php.
Comment #59
eaton CreditAttribution: eaton commentedJust took this through its paces and it deals gracefully with a dead database and other similar situations. The approach appears to be clean and tidy, and I know of a number of our clients who will be thrilled that occasional DB issues don't result in a big splatter of 'stock theme' over their carefully tailored site branding...
Comment #60
dvessel CreditAttribution: dvessel commentedGreat Eaton! Thanks for your time. :)
Minor doc cleanup on this one but it's exactly the same.
Oh, and did I mention that theme inheritance work too now? Not sure I did. It was restricted before.
So if we wanted, we can clean up Minnelli a bit so it inherits Garlands styles instead of importing them. I think there was a problem with that.. Not sure. My mind has been on another project.
Thanks for your patients.
Comment #61
Gábor HojtsyGiven the size and timing of this change, I wrote Dries a mail to check back and review the patch. I definitely like this feature being kept, and proposed fixing this in other issues, but at the same time, the D6 release process went ahead a lot in the meantime.
Comment #62
sunA huge +1! As mentioned before, corporate websites can't live without this.
Added one-line descripiton (API).
Added this note to settings.php and moved phpdoc block right in front of the setting.
Was list_theme_engines() in theme.inc intentionally removed? Just curious. There is no reference in core.
Note: I don't know how to remove files in a local working copy, so I wasn't able to remove misc/maintenance.css and misc/maintenance.tpl.php in this patch.
Comment #63
Anonymous (not verified) CreditAttribution: Anonymous commentedThe only method I know of is to create a local repository and issuing the ``cvs remove ...'' command.
Comment #64
Gábor HojtsyEarnie: Grrrhm.
Earnie, sun: read the docs! http://drupal.org/patch/create
Comment #65
sunSorry for being dumb. Let's get back to focus.
Comment #66
merlinofchaos CreditAttribution: merlinofchaos commentedGoba: While this is not as flashy of a usability improvement as drag & drop, this really qualifies as an important one for a serious target market of Drupal; that is, large, high profile sites who are very keenly interested in retaining their brand identity. It can be a big deal when something breaks and suddenly a million people see the Druplicon rather than whatever corporate logo should've been there.
Also, work on this started long, long ago, but stagnated for several months awaiting responses. It's always unfortunate when that happens.
Comment #67
Gábor Hojtsymerlinofchaos: Maybe you have not seen but I have even postponed some API modifying drag and drop issues, before Dries came and "approved" them (getting them back to the 6.x queue), and also put a now RTBC looking drag and drop issue to his consideration because of the same reasons: big API breaking changes without Dries' prior approval. That's not about how flashy an issue is but how late it is going to be applied in the cycle. I did not receive privileges to say yes to these without consulting Dries.
Comment #68
Gábor HojtsyI reviewed this patch, found it nice for my taste, and wrote Dries an email yesterday afternoon, but did not receive a reply since then. Dries seemingly being mostly out of time to review bigger patches now, I slept one more on this patch, and being a low level issue which is not at all possible to fix in contrib, I decided to commit it.
Please understand that I am trying to watch the best interest of the community, and that sometimes conflicts with the interest of (your) customers. I would not like to offend highly valued people who work hard on completing a big fix they think is important. But at the same time I would not like to offend others who postponed their important fixes to D7 understanding that the community needs to agree on common rules on deadlines and focusing on stabilizing what is already there instead of looking into what is missing, to have a release in a reasonable timeframe. Additionally I do not like to provide grounds for finger pointing like "but you accepted drag and drop patches, and ours is just as important" (as demonstrated above) or "but you accepted the maintenance theming patch". This can go on forever if the focus is not agreed on.
So much for the background. As I said, I liked what I have seen in this patch, and would love to see you fine folks in the criticals issue queue (http://drupal.org/project/issues?projects=3060&versions=97368,184399,175...), now that this is resolved. There is a nice small theming bug there which would fly if you would take a look and approve / comment on the suggested fix: http://drupal.org/node/194026 (although all the other issues are just as interesting).
Thanks for all your time making Drupal 6 better, it is all highly respected.
Comment #69
Gábor HojtsyOK, this made the install theme buggy when the site is already installed, but the DB is not populated. Reproduce:
- install Drupal
- drop the database
- create the database empty
- visit install.php
All you get is:
This is an edge case, but might uncover other bugs introduced with this. Previously, the installer was possible to be used to populate the tables when the DB was cleaned as said above. Not good.
With display_errors = TRUE:
Comment #70
dvessel CreditAttribution: dvessel commentedGreat! this is finally in. :)
Wow, I never knew this. I'll look into this edge case..
Gábor, thanks for your hard work.
Comment #71
dvessel CreditAttribution: dvessel commentedThe problem is with how list_themes() was modified. The patch does a check with db_is_active() so simply dropping the tables is not caught.
Looks like I'll have to revert list_themes() and separate out the part listing the themes without calling the database. It'll be a simple fix.
Comment #72
dvessel CreditAttribution: dvessel commentedWell, I opted to just check for the table. Not sure it's the best way to go.
list_themes() is called in many places but the call from theme_get_settings() prevented me from reverting list_themes.
Comment #73
Gábor HojtsyGreat, this looks sensible to me. Thanks for the fix, committed.
Comment #74
sunIf list_themes() is called in many places, we should perhaps cache the database check. (first patch)
Or, at least add some notes to this non-obvious check. (second patch)
Comment #75
merlinofchaos CreditAttribution: merlinofchaos commentedPlease understand that I am trying to watch the best interest of the community, and that sometimes conflicts with the interest of (your) customers. I would not like to offend highly valued people who work hard
on completing a big fix they think is important. But at the same time I would not like to offend others who postponed their important fixes to D7 understanding that the community needs to agree on common rules on
deadlines and focusing on stabilizing what is already there instead of looking into what is missing, to have a release in a reasonable timeframe.
Goba: Sorry if I came off as upset about this one; when I read your comment I felt that this patch was teetering on the brink, and was trying to make a case that it should go in. I am still a little upset about this patch from way back, as I had the original patch RTBC for 2 months before the initial code freeze, and it was ignored. So if there's a deadline that was never met, it wasn't on my part; I had the original in well in advance, with a cushion for going back and making necessary changes, but without any real understanding of what changes needed to be made, nothing happened. It is at that point that frustration set in. I had actually emailed Dries directly about this patch, and he said he would look at it...and still no new commentary came.
All that said, my comment was not intended to reflect that frustration, but my belief that this patch is just as big of a usability enhancement as some of the drag & drop stuff that's going in. This one has been in process for a long, long time, and I felt that given your comment about maybe/maybe not, I wanted to add a little push toward 'yes, please commit'.
dvessel did a good job of redoing the whole thing from scratch and getting something workable in; I actually had quit working on it, myself, once the code freeze was well past, so at this point I am merely being a cheerleader for dvessel's hard work.
Comment #76
dvessel CreditAttribution: dvessel commentedThe theme list is already cached so caching the db check isn't needed. It's only checked once unless it needs a refresh.. not a common thing.
More docs the better but I still don't think that's clear.
Now one would ask, why would this situation arise? I know now but if I didn't I'd have no clue.
Comment #77
merlinofchaos CreditAttribution: merlinofchaos commentedsun: I like patch #1 -- the caching makes sense.
Comment #78
merlinofchaos CreditAttribution: merlinofchaos commentedEr. Ok, posted too soon. I withdraw my comment based on dvessel's. =)
Comment #79
sun@dvessel: I regularly encounter this situation when "re-setting" a local Drupal test site, for example. This is all about an edge case, absolutely. So I'd say, it's sufficient to just explain why we're doing this second check without giving any other reason than the one included in the patch.
Comment #80
webernet CreditAttribution: webernet commentedThis broke updates badly.
Comment #81
Gábor Hojtsywebernet: Please elaborate. I tried to run update.php (although without actual updates to run) and seen the progressbar go through to 100%, and then a message that my site is up to date, just as before. I would not commit this patch, if there would be an obvious bug which does not need explanation.
Comment #82
webernet CreditAttribution: webernet commented- First load of update.php throws a fatal error.
- Not all updates are run -- only those for system module.
- Updates fail at system update 6027.
Comment #83
Gábor HojtsyUh, huh. This could very well be closely related to the "developer edge case" I found. The error message is the same. Seems like although the database is set up, the system table is there, this code does not play nice with the tables not updated yet. Basically, it should use the file based theme code, not the database based theme code.
system_update_6027() looks like modifying both the global $theme and $custom_theme, and although $theme is restored, $custom_theme is not. So the theme is modified in the update code, and again, that breaks the update. Looks like the $custom_theme needs to be restored.
Comment #84
dvessel CreditAttribution: dvessel commentedCrap.. it's because of the use of module_list() inside _drupal_maintenance_theme(). It needs to be more selective.
It's needed for off-line mode and dead db's. install.php repeats that function. I didn't realize that update cannot have it run that way.
Sorry.. patch coming right up.
Comment #85
dvessel CreditAttribution: dvessel commentedOkay, I tested and it works for me.
Removed all the redundant calls to drupal_maintenance_theme() from install.php also. All the install functions go through install_main() so this is safe.
The db table check from the previous fix was swapped for the "MAINTENANCE_MODE" constant. Just to be on the safe side, have it read from the file system even when updating.
I also had to add in $theme->status to prevent notices. It didn't happen before due to the order it was run. Without it, notices occur from system_menu() where it registers theme config paths.
Comment #86
dvessel CreditAttribution: dvessel commenteder, broken on install..
Comment #87
dvessel CreditAttribution: dvessel commentedI mean, revisiting the install page after it's already been installed caused a fatal error..
Works now.
Comment #88
Gábor HojtsyAwaiting some testing. Would love to see what webernet has to say on this.
Edit: funny crosspost. :)
Comment #89
webernet CreditAttribution: webernet commented#87 seems to fix things for me after a quick test. Needs further testing/review though.
Comment #90
Gábor HojtsyI tested this on a 4.6 -> 6 upgrade which worked before this patch (yes, 1 have 2(!) custom modifications in the update code to make this run well, and a few lines of DB preparation SQL code). Also worked with the patch, so it seems the update is fixed. Committed, thanks.
Comment #91
Senpai CreditAttribution: Senpai commentedHooray for all of us on this one. Good work, gang!
Comment #92
dvessel CreditAttribution: dvessel commentedIndeed.. I only wish I could have been more focused. Bad timing when Merlin rolled his original patch and now. I wasn't around when it initially appeared but all wasn't lost since I learned from his example. Not exactly the same but still, it gave me a clue.
Time to let this issue die, finally..
Comment #93
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #94
Dave Cohen CreditAttribution: Dave Cohen commentedI hope it's OK etiquette to resurrect this thread. I wrote about this issue on the developer's email list and I wanted to post my patch somewhere. I submit it for consideration for Drupal 5.x, but I understand if this get's resolved as won't fix, since it appears to be addressed differently in Drupal 6.
My problem is that I needed the maintenance pages to be custom branded, especially when the database is unreachable. The attached patch to bootstrap.inc solves the problem. With the patch in place, I can write something like the following in my settings.php. This gives me control of the maintenance pages.
Comment #95
dvessel CreditAttribution: dvessel commentedIt looks reasonable but the install and update pages could have problems with custom themes. Accounting for that would require further changes. Alas, it is a feature so I doubt this would happen.
Comment #96
Anonymous (not verified) CreditAttribution: Anonymous commentedPlease create a new issue.
Comment #97
webchickhook_system_info_alter() was never documented. Please fix.
Comment #100
dvessel CreditAttribution: dvessel commentedhttp://api.drupal.org/api/function/hook_system_info_alter
Comment #101
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #102
Aren Cambre CreditAttribution: Aren Cambre commentedLooks like this patch may have caused a new issue: http://drupal.org/node/281997
EDIT: Disregard. Further investigation suggests a function provided by the result of this issue may be the first victim of a different bug and not a cause of the problem in the other issue.