It's nice to close the site in off-line mode to test and change things as the administrator, but sometimes it is useful to log in as a normal user to check if that thing is working for a specific role, but then the site is in off-line mode. To test it you have to open the site and check. It would be nice to have an option to enable / open the site for some specific user id's. (special test users), while maintaining the site in off-line mode for the rest.
Comment | File | Size | Author |
---|---|---|---|
#45 | drupal.maintenance.45.patch | 14.95 KB | sun |
#42 | drupal.maintenance.43.patch | 14.96 KB | dropcube |
#41 | drupal.maintenance.42.patch | 14.89 KB | sun |
#39 | drupal.maintenance.38.patch | 14.8 KB | sun |
#37 | drupal.maintenance.patch | 14.78 KB | sun |
Comments
Comment #1
Gábor HojtsyNew features go to Drupal 7.
Comment #2
sunThis shortcoming hit me today. Regular users (e.g. "Site Editors" audience) should be able to access the site in offline mode to prepare, review and update content. You really do not want to grant them the "administer site configuration" permission.
I'll work on a patch.
Comment #3
sunHere we go.
Comment #4
sunOnce you encounter this issue, it is a true Drupal WTF issue.
Comment #5
Bojhan CreditAttribution: Bojhan commentedSo this is a permission?
Comment #6
sunpermissions.png: See "Access site in maintenance mode" permission.
site-maintenance.png: Slightly adapted form element description.
Comment #7
Dave ReidI don't think we have any site offline tests, so we could probably use them now since we're adding this feature. And probably use update_sql() instead of DBTNG until we can figure out what to do with update_sql.
/me ducks
Comment #8
sunYes, drupal_get_normal_path() is useless here - right 5 lines below plain $_GET['q'] is tested without it, @see http://api.drupal.org/api/function/_menu_site_is_offline/7
Comment #9
sunRe-rolled against latest HEAD. system_update_7021() was removed.
Comment #10
Dave ReidWe don't have any site offline tests, so we could probably use a little test. I can write it myself shortly.
Comment #11
sunSorry, I did not want to unset that term.
Given the plain, simple, killing concept in #394268: DIE update_sql() DIE!, I won't convert this query to update_sql() here. 1) It's a 1:1 copy of the existing system_update_7011(), and b) I'm confident that update_sql() will completely vanish.
Comment #12
sunComment #13
sunFor any reason, last patch did not go into test queue.
Comment #14
Bojhan CreditAttribution: Bojhan commentedThe description on site-maintenance is a bit overwhelming, what about : "Offline", will only allow users with "..."permission to acces your site.
The other descriptions seem fine to me, I havn't actually ran into this issue in any test or anything - but it sounds like a feature request that needs to be fixed.
Comment #15
sun@Bojhan: Parts of this message contain very valuable information. I could only see the following option:
- or - turn it into a simple checkbox and say:
I'd prefer the latter. Radio buttons are the wrong UI element here.
Comment #16
Dave ReidLet's change:
to:
That way we don't have to translate one part twice. :)
SystemSiteOfflineTestCase
should just beSiteOfflineFunctionalTest
as per the test guidelines.Should just be:
$this->drupalLogin($this->user);
since it uses the path /user to log inCan we just change all these assert(No)Text calls from
$this->assertNoText($offline_message, t('Site offline message not displayed.'));
to this (so much cleaner):
$this->assertNoText($offline_message);
And instead of starting with
in the test, why not login the admin user, turn on maintenance mode in the test using drupalPost(), then at the end, turn it off using drupalPost() and make sure the site is no longer in maintenance mode.
Comment #17
Dave Reid+1 for checkbox and a little slimmer description.
Comment #18
sunUpdated tests, code, UI, and everything.
Just did not alter the user login, because my intention was to specifically test whether the user gets the site maintenance mode message directly after login.
Comment #19
sunOh, hm - I also left out the split into "Go online.". Because I'm not sure whether translators are able to grasp the context this way. Opinions?
Gábor?
Comment #20
Dries CreditAttribution: Dries commentedLooks nice. The update function is really nice to have but wasn't strictly necessary, IMO.
Looking at the screenshot in #18 with fresh eyes, two things occured to me:
1. I think it would be good to rename 'Site maintenance' to 'Site offline mode' or something. The words 'site maintenance' are very generic, and to most website owners 'maintenance' is unlikely to be correlated with 'off-line'. I bet that for most people, revising content or tweaking taxonomy terms might also mean 'site maintenance' ...
2. We don't explain _why_ someone might want to take their website offline. That seems to be a bit of a problem.
I know, probably outside the scope of this patch but I figured I'd bring it up in the context of this patch. We could copy-paste it into a new issue if desired.
Comment #21
sunI accepted the scope creep in the first place, so I'll try to flesh this out with the usability team.
Comment #22
sunOne other thought is that I'd really like to see this maintenance message for privileged users vanish. It should be the job of the theme to (visually) indicate that a site runs in offline mode - having a message on each and every page looks and feels plain ugly.
Regarding the term in question, I've thought about cutting down "site maintenance mode" and "site offline mode" straight into "offline mode". As in "Enable offline mode".
Though I'm not too sure whether "offline mode" is translatable into all languages.
And I'm also not sure why someone would want to enable the offline mode.
Given the last sentence, I'm no longer sure whether "[enable] offline mode" is really the way to go.
Comment #23
sunI've tried.
However, a discussion in IRC revealed that the term "offline mode" or even "site offline mode" is not really translatable. People understand and can translate "maintenance mode", and that's most often also the meaning of the translated term, because "offline" is an unknown term to many languages.
Additionally, if we would want to change that term consistently, then we would have to alter many more parts of Drupal.
IMHO, we do not have to explain why someone would want to set a site offline. Site administrators will already know when and why. For me, it would be more important to be able to choose the maintenance theme on this very form (which can only be defined via settings.php at the moment - another DrupalWTF ? ;).
Let's defer those topics to another (usability-focused) issue - if at all.
Reverting to needs review. Actually, I think it's RTBC, but I need someone else to confirm.
Comment #25
sunRe-rolled.
Comment #26
sunOf course, that last one could only fail. Some paths and strings were renamed elsewhere.
Comment #27
moshe weitzman CreditAttribution: moshe weitzman commentedWell, it is a month later and update_sql() is still here. And it has had no progress in that month. I don't think it is OK to cut corners here because of a possible future patch ... I don't see the problem in renaming to offline mode as Dries suggests. Translators are welcome to call it maintenance mode in their language if thats most natural.
Comment #28
sunSorry for not being clear in my last follow-up:
- "offline mode" resp. "site offline" seems to have been completely replaced by "maintenance mode" by some other patch that was committed in the meantime. So this patch (now) follows that new wording.
- As stated earlier, system_update_7022() is a 1:1 copy of the existing system_update_7011(), which does not use update_sql() either.
Comment #30
wretched sinner - saved by grace CreditAttribution: wretched sinner - saved by grace commentedI noticed in 6.x that if you provide incorrect user credentials to login to your site in maintenance mode, you get no error, as Drupal will return the maintenance page instead of a 403. I've opened #461022: Incorrect login details rejected with no message when site is offline to mention this, but I'm not sure if it should be incorporated here. It is something that is understandable if you only have the site admin logging in whiloe in maintenance mode, but if you have a less technical savy user who may need to enter content while the site is offline, then they will need feedback if their credentials are incorrect.
Comment #31
webchickNote: Dries's comment at #20 was made before #430342: Change "Site maintenance" to "Maintenance mode" was committed. Over there we decided on "Maintenance mode" as the name of this setting, because "Offline mode" means something different in most applications.
I would therefore rather not include the hunk dealing with re-labeling those things and switching it to a checkbox, because the people concerning themselves with labels are over at the other issue. This issue should deal with adding the permission and testing it to make sure it works, and that's it. Let's mind the kittens.
I'd rather not link to the permission page. If someone has "access site configuration" permissions and not "administer users" permissions (a common configuration), they're going to get a 403 clicking that link.
I'm actually not really sure what the guideline is on update functions, but if we're copy/pasting from another update function that got committed, it's probably fine to leave it.
"Log in when the site is in maintenance mode." Let's keep the terminology consistent.
There's obviously a difference between these two users. The comments should not be identical.
t() this, probably.
Comment #32
sunNote that "Sorry, not online." is solely used within the test, so no t() required.
Comment #33
webchickCan you please explain how the patch ballooned from 9K to 14K when we were supposed to be taking *out* stuff? ;)
Comment #35
anacaona CreditAttribution: anacaona commentedHello,
Can I use this patch with Drupal 6? If so, how exactly would I apply it? (Which directory to I save it to, etc.)
Thanks for your help!
Comment #36
ktonini CreditAttribution: ktonini commentedI second the request for a D6 patch!
Comment #37
sunRe-roll against latest HEAD.
Comment #39
sunFixed the system update number.
@webchick: The size of the patch naturally increased after adding the tests ;)
Comment #41
sunFixed the tests as well. :)
Comment #42
dropcube CreditAttribution: dropcube commentedPatch seems OK, just a some minor issues.
This path admin/user/permissions no longer exists.
The tile shouldn't be t('site under maintenance'), for consistency?
- Added reference to the update function that removed the old variable.
The rest, seems OK.
Beer-o-mania starts in 9 days! Don't drink and patch.
Comment #43
sunyay, ready to fly then. :)
Comment #44
webchickThese don't get PHPDoc because they're inherited from the base class.
After all the trouble you went to rename everything, including a hidden variable to "maintenance" we should rename the test stuff too. :)
I'm on crack. Are you, too?
Comment #45
sunComment #46
webchickExcellent. :) Committed to HEAD!
Comment #48
chien_fu CreditAttribution: chien_fu commentedOkay... so what's a patch and how do you implement it?
Is there a stable version of this yet?
Comment #49
tstoeckler@chien_fu: This functionality will be part of Drupal 7. If you want to use it on production sites, you will have to wait for Drupal 7.0, otherwise you can test it out already (http://drupal.org/project/drupal). It will not be part of the Drupal 6 release series.
Comment #50
stephenls CreditAttribution: stephenls commentedIt's a bit disheartening that this will not be fixed for Drupal 6. Any reason why it can't be fixed in 6 as well?
Comment #51
markconroy CreditAttribution: markconroy commentedhttp://drupal.org/node/618402
VERY simple fix for Drupal 6
Comment #52
Lancer25 CreditAttribution: Lancer25 commented42: drupal.maintenance.43.patch queued for re-testing.