Extension:CentralNotice

From MediaWiki.org

Jump to: navigation, search

           

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
CentralNotice

Release status: stable

Implementation  Special page
Description Adds a central sitenotice
Author(s)  Brion Vibber, Tomasz Finc, Trevor Parscal
License GPL
Download Download snapshot

Subversion [Help]
Browse source code

check usage (experimental)

CentralNotice adds the possibility to manage sitenotices from one central wiki.

Contents

[edit] Installation

  1. Download the latest snapshot and extract it to your extensions directory.
  2. Run CentralNotice.sql
  3. Add rebuildTemplates.php to your periodic scheduler (cron).
  4. Add
    require_once( "$IP/extensions/CentralNotice/CentralNotice.php" );
    to LocalSettings.php
  5. The extension should be now active.

[edit] Design

The CentralNotice system consists of both campaigns and templates.

  • Template - a single text/css/image that will display at the top of all set wiki pages.
  • Notices - a collection of templates that are set to show at specified percentages.

You can configure as many notices at the same time as you want and each one will show with its configured templates at their own percentages.

  • Preferred - A notice with preferred set will always replace any other notice that happens to have the same language & wiki combo.

This was used during the 2008 fundraiser when we wanted a new notice to exist only for EN even though it overlapped with another for EN. This highlighted a limitation in the system because the old notice was set to all languages and any new notice would have shown all templates instead of just the new subset. This is currently only available for EN wiki.

  • Locked - A locked notice can not be deleted unless it is unset.
  • Enabled - when rebuildTemplates.php is run, only notices with enabled will be written out.

[edit] Usage

[edit] Required Settings

  • wgNoticeCentralDirectory - Where we store the static js files
  • wgNoticeInfrastructure - True if were using the extension

[edit] New Template

  1. Load Special:NoticeTemplate
  2. Click on the add template link at the bottom of the page.
  3. Enter in a name and the raw HTML for the given notice.
    1. If this notice is going to be translated then enclose any text lines with {{{FOO}}} triple parens.
  4. Submit

[edit] New Notice

  • Each template has its template definition stored in MediaWiki:Centralnotice-template_name
  • All of its messages are stored below the template def ala MediaWiki:Centralnotice-template_name-dismiss/language_code
  1. Load Special:CentralNotice
  2. Add a notice with a given start time at the bottom portion of the page and click submit.
    1. If this campaign is only run on a specific wiki and or language then select it from the pull downs.
  3. Click on the new notice and add the templates you want within this running notice and their respective percentages.
  4. If all looks well then set this notice to enabled and it will show at the corresponding time.

[edit] Centralized Message Store

It was quickly realized that we were duplicating work when messages were copied over for such strings as Dismiss to each template. Instead of this, the accepted practice to is to use a shared message notice for commonly used messages. Then use the following

{{int:centralnotice-shared-message-name}}

(only 2 parens) to reference it.

  • If there is a need to only do this for two messages then you might want to use the clone feature at the bottom of any template page.

[edit] Addendum

  • Each notice will be as fresh as the last run of rebuildTemplates.php

This extension is being used on one or more of Wikimedia's wikis. It means that the extension is stable and works well enough to be used by such high traffic websites. A full list of the extensions installed on a particular wiki is produced by Special:Version on that wiki.