Page MenuHomePhabricator

Set wikitech-static sitenotice via $wgSitenotice
Closed, ResolvedPublic

Description

We would like this notice to be displayed on wikitech-static:

You are browsing a read-only backup copy of Wikitech. The primary site can be found at [https://wikitech.wikimedia.org wikitech.wikimedia.org]

When we have an active sitenotice for the main wikitech site this can be done with some parser function magic:

MediaWiki:Sitenotice
<!-- NOTE: replace page content with "-" when removing notice from Wikitech -->
{{#ifeq: {{SERVERNAME}} | wikitech-static.wikimedia.org | 
<!--special banner for wikitech-static-->
You are browsing a read-only backup copy of Wikitech. The primary site can be found at [https://wikitech.wikimedia.org wikitech.wikimedia.org] |

<!--normal banner for actual wikitech-->
...
}}

There is a bugfeature however when we don't have site notice text on the main site that makes MediaWiki display an empty div and the [dismiss] link. This is gross and makes @Krinkle sad, so lets find another way.

@Legoktm pointed out that we can set $wgSitenotice in LocalSettings. This will be displayed unless MediaWiki:Sitenotice is also non-empty. We will need to keep this in mind when posting a MediaWiki:Sitenotice banner and then remember to add the parser function magic back in.

Event Timeline

Change 449178 had a related patch set uploaded (by Andrew Bogott; owner: Andrew Bogott):
[operations/wikitech-static@master] Local.php: Add $wgSitenotice for when no notice is specified on Wikitech

https://gerrit.wikimedia.org/r/449178

Change 449178 merged by Andrew Bogott:
[operations/wikitech-static@master] Local.php: Add $wgSitenotice for when no notice is specified on Wikitech

https://gerrit.wikimedia.org/r/449178

I've configured the static site with:

$wgSitenotice = "You are browsing a read-only backup copy of Wikitech. The live site can be found at [https://wikitech.wikimedia.org wikitech.wikimedia.org]";

Note the slight wording change, 'live' vs. 'primary' so we can tell which setting is in effect.

It looks like the site notice on wikitech has already been blanked out. I'm not sure why that wasn't reflected on wikitech-static already.

It looks like the site notice on wikitech has already been blanked out. I'm not sure why that wasn't reflected on wikitech-static already.

Something is not quite right with the content syncing to wikitech-static. One example:

I will open a separate ticket about this.

bd808 triaged this task as Medium priority.Aug 31 2018, 12:05 AM

Change 464435 had a related patch set uploaded (by Andrew Bogott; owner: Andrew Bogott):
[operations/wikitech-static@master] Fix the variable name of $wgSitenotice to $wgSiteNotice

https://gerrit.wikimedia.org/r/464435

Change 464435 merged by Andrew Bogott:
[operations/wikitech-static@master] Fix the variable name of $wgSitenotice to $wgSiteNotice

https://gerrit.wikimedia.org/r/464435

The variable I needed to set was $wgSiteNotice, not $wgSitenotice. This works now.

Reopening because it seems that the site notice in config has been lost somehow. https://wikitech-static.wikimedia.org/wiki/Main_Page is not showing any site notice in an incognito browser session when https://wikitech-static.wikimedia.org/wiki/MediaWiki:Sitenotice is a blank page.

I just reverted the page blanking at https://wikitech.wikimedia.org/wiki/MediaWiki:Sitenotice which should restore the site message on wikitech-static on the next content sync, but this returns us to the original state of this ticket where a dangling "[dismiss]" is shown on the real wikitech site until clicked by the user to set the "dismissSiteNotice" cookie.

bd808 added a subscriber: Andrew.

I may have just "fixed" this by setting the content of https://wikitech-static.wikimedia.org/wiki/MediaWiki:Sitenotice to "-" rather than a blank page. The next content sync to wikitech-static will resolve this issue again if that is correct. Assigning to myself as a reminder to verify this.

I have now been able to confirm that the problem in this second iteration was the content of https://wikitech.wikimedia.org/wiki/MediaWiki:Sitenotice and specifically that that page's text must be "-" to disable the message override rather than a blanked page when we remove any transient site notice on the 'live' wikitech.wikimedia.org site.

bd808 updated the task description. (Show Details)

I have finally realized that we can use https://wikitech.wikimedia.org/wiki/MediaWiki:Editnotice-8-Sitenotice to give instructions right in the edit interface. MediaWiki is pretty cool stuff. :)