Extension:CentralNotice

From mediawiki.org
This page is a translated version of the page Extension:CentralNotice and the translation is 27% complete.
MediaWiki-Erweiterungen
CentralNotice
Freigabestatus: stabil
Einbindung Spezialseite , API
Beschreibung Adds a central sitenotice
Autor(en) Andrew Russell Green, Matthew Walker, Adam Roses Wight Formerly: Brooke Vibber, Tomasz Finc, Trevor Parscal, Ryan Kaldari
Letzte Version 2.6.1 (continuous updates)
Kompatibilitätspolitik Snapshots werden zusammen mit MediaWiki veröffentlicht. Der Master ist nicht abwärtskompatibel.
MediaWiki >= 1.42
Datenbankänderungen Ja
Tabellen cn_notices
cn_assignments
cn_templates
cn_notice_languages
cn_notice_projects
cn_notice_countries
cn_notice_regions
cn_template_mixins
cn_notice_mixins
cn_notice_mixin_params
cn_known_devices
cn_template_devices
cn_known_mobile_carriers
cn_notice_mobile_carriers
cn_notice_log
cn_template_log
Lizenz GNU General Public License 2.0 oder neuer
Herunterladen
Beispiel Special:CentralNotice on Meta (read-only)
  • $wgNoticeBannerMaxAge
  • $wgNoticeBannerReducedMaxAge
  • $wgNoticeHideUrls
  • $wgCentralNoticeCategoriesUsingLegacy
  • $wgNoticeUseLanguageConversion
  • $wgNoticeCookieDurations
  • $wgCentralNoticeBannerMixins
  • $wgCentralMobileSelectedBannerDispatcher
  • $wgNoticeInfrastructure
  • $wgCentralBannerRecorder
  • $wgNoticeBucketExpiry
  • $wgNoticeCookieDomain
  • $wgNoticeTranslateDeployStates
  • $wgCentralNoticeAdminGroup
  • $wgCentralNoticeCampaignTypes
  • $wgCentralNoticeImpressionEventSampleRate
  • $wgCentralNoticeESITestString
  • $wgCentralNoticeFallbackHideCookieDuration
  • $wgCentralSelectedBannerDispatcher
  • $wgCentralHost
  • $wgNoticeProject
  • $wgNoticeTabifyPages
  • $wgCentralNoticeGeoIPBackgroundLookupModule
  • $wgCentralNoticeApiUrl
  • $wgNoticeProjects
  • $wgCentralNoticeMessageProtectRight
  • $wgCentralNoticeMaxCampaignFallback
  • $wgCentralNoticeContentSecurityPolicy
  • $wgCentralNoticeCampaignMixins
  • $wgCentralDBname
  • $wgCentralNoticeSampleRate
  • $wgCentralNoticePerCampaignBucketExtension
  • $wgNoticeNumberOfControllerBuckets
  • $wgNoticeNumberOfBuckets
  • $wgNoticeUseTranslateExtension
  • $wgCentralNoticeHideBannersP3P
  • $wgCentralNoticeLoader
Quarterly downloads 27 (Ranked 120th)
Public wikis using 1,012 (Ranked 228th)
Übersetze die CentralNotice-Erweiterung, wenn sie auf translatewiki.net verfügbar ist
Probleme Offene Aufgaben · Einen Fehler melden

Die CentralNotice-Erweiterung liefert Ankündigungen (normalerweise in Form von Bannern) an Wikimedia-Wikis. Sie wird vom Fundraising-Team intensiv genutzt, um um Spenden zu werben und um Ankündigungen zu machen, die für die Wikimedia-Gemeinschaften und -Nutzer von Interesse sind. CentralNotice kann Ankündigungen nach Land, Sprache, Projekt, Gerät und eingeloggtem Status ausrichten.

Diese Seite enthält Informationen für CentralNotice-Entwickler und Wiki-Administratoren, die CentralNotice auf ihren eigenen Websites installieren möchten. Wie Sie CentralNotice-Kampagnen erstellen und konfigurieren können, erfahren Sie unter Help:CentralNotice auf Meta-Wiki. Für Informationen über die Einrichtung von CentralNotice auf dem Cluster der Wikimedia Foundation siehe CentralNotice on Wikitech.

ZentralNotiz ermöglicht die zentrale Verteilung von Ankündigungen von einem zentralen Wiki (dem Infrastruktur-Wiki) aus an viele Wikis (die abonnierten Wikis genannt). Sind nur Nachrichten an ein einziges Wiki zu richten, sollte stattdessen Sitenotice verwendet werden.

Installation

ZentralNotiz wurde entwickelt, getestet und ist dafür bekannt, dass es nur auf Wikis eingesetzt wird, die keine Tabellenpräfixe verwenden. Verwendet das Setup Tabellen-Präfixe, gibt es keine Garantie dafür, dass diese Erweiterung funktioniert. Please report any bugs to Phabricator.

Für alle Wikis

  1. Download the latest snapshot and extract it to your extensions directory.
  1. Add to LocalSettings.php the following:
    wfLoadExtension( 'CentralNotice' );
    
  1. By default, GeoIP lookup is disabled.

If the Geo cookie is pre-populated, however, its value will be used. For local development, you can enable a client-side implementation that uses https://freegeoip.net as follows. For more information, see #GeoIP lookup.

$wgCentralNoticeGeoIPBackgroundLookupModule = 'ext.centralNotice.freegeoipLookup';

Das Infrastruktur-Wiki

  1. From the command line, go to the wiki root and run php maintenance/update.php
  1. Edit LocalSettings.php and set ...
    1. $wgNoticeInfrastructure to true
    1. $wgNoticeProjects to be an array of projects that will subscribe to the central wiki.

Beispielsweise array( 'wikipedia', 'wiktionary' )

  1. By default the sysop group is the only group with the ability to administer CentralNotice.

If additional groups are needed, assign them the centralnotice-admin and edit-interface permissions.

Abonnierte Wiki

Bearbeite LocalSettings.php und setze…

  1. $wgNoticeInfrastructure to false;
  1. $wgNoticeProject to be an entry in $wgNoticeProjects;
  1. $wgCentralHost to the protocol (potentially neutral) and domain of the central wiki.

Beispielsweise //meta.wikimedia.org;

  1. $wgCentralSelectedBannerDispatcher to the URL of Special:BannerLoader on the central wiki, for example: //meta.wikimedia.org/w/index.php/Special:BannerLoader;
  1. either $wgCentralDBname to the name of the infrastructure wiki's database, or $wgCentralNoticeApiUrl to the API endpoint of the infrastructure wiki; and
  1. $wgCentralBannerRecorder to the URL of Special:RecordImpression on the central wiki.

Beispielsweise: //meta.wikimedia.org/w/index.php/Special:RecordImpression.

Quick developer setup

For most development tasks, you can use a single wiki in both infrastructure and subscribing roles. Following are sample lines to include in LocalSetting.php. (See notes in comments.)

wfLoadExtension( 'CentralNotice' );
$wgNoticeInfrastructure = true;
$wgNoticeProjects = array( 'centralnoticeproject' ); # 'centralnoticeproject' can be any string
$wgNoticeProject = 'centralnoticeproject'; # must be the same as above
$wgCentralHost = 'localhost';
$wgCentralSelectedBannerDispatcher = 'http://localhost/mw/index.php?title=Special:BannerLoader';
$wgCentralDBname = 'databasename'; # the same as $wgDBname
$wgCentralNoticeGeoIPBackgroundLookupModule = 'ext.centralNotice.freegeoipLookup';

All code that runs on subscribing wikis should be smoke-tested with MobileFrontend , to ensure they work on the mobile version of the site.

Abhängigkeiten

Einige ZentralNotiz-Funktionen erfordern andere MediaWiki-Erweiterungen, einschließlich Erweiterung:EventLogging und Erweiterung:Übersetzen .

Unterstützung erhalten

The WMF Fundraising tech team are the maintainers of CentralNotice. For questions about installation, bug reports, or usage of CentralNotice please send an email to the mailing list wikitech-l@lists.wikimedia.org or join us in the IRC channel #wikimedia-fundraising connect.

Berechtigungen

  • centralnotice-admin — Permission required to modify campaigns and banners.

Relevant only to the infrastructure wikis (see also bugzilla:26377).

    • edit-interface is required to edit banner content.

Entwurfskonzepte

From a user facing perspective, the high level CentralNotice objects are campaigns (a.k.a. notices) and banners (a.k.a. templates). These are affected by the back end concepts of selectors and allocation.

The user status, device type, UI language selectors are applied to banners.

    • Banners may be grouped by category.

All banners in a category share user side cookies, such as the hiding cookie that is set when a user clicks a banner close button.

  • Campaign — a collection of banners.

The project, country and content language selectors apply at the campaign level. The system allows as many active campaigns at the same time as you want dynamically calculating an allocation for each banner in an active campaign. Campaigns are defined as active if the central wiki time is greater than the campaign start time, less than the campaign end time, and the campaign is marked as enabled.

    • Banners in a campaign are assigned a bucket and weight.

Buckets are yet another selector, and weight affects the relative allocation of banners inside a campaign.

    • There are four priority levels in CentralNotice.

Higher priority campaigns will get a greater allocation of page views.

    • Campaigns may be locked which will prevent editing and deletion of the campaign; but not the banners inside a campaign.
  • Selector — any property which may be filtered on for the purposes of allocation.

This allows, for example, different banners to be shown to logged in versus logged out users in Argentina browsing Wikipedia in English.

    • A selection vector is the complete set of selectors a user presents to the central wiki when requesting a banner.
  • Allocation — The chance a banner will be shown to a user under a given selection vector.

Entwurfsdokumente

GeoIP nachschlagen

By default, CentralNotice has no client-side GeoIP lookup service configured. This is optimised for the Wikimedia Foundation production configuration where Varnish populates the Geo cookie from the server-side. (Siehe wikitech:Geolocation.) You can configure CentralNotice to use a custom data source client-side through the CentralNoticeGeoIPBackgroundLookupModule configuration variable. This variable expects the name of a ResourceLoader module that exports a function. The function will be called without parameters and should return a Promise that resolves with an object containing the following properties:

  • country: string - Two-letter country code.
  • region: string - Implementation specific.
  • city: string - City name.
  • lat: number.
  • lon: number.

Verwendung

Full usage instructions can be found at meta:Help:CentralNotice.

Neuer Banner

  1. Click on the add banner link at the bottom of the page (must be logged in as an admin).
  1. Enter in a name and the raw HTML for the given banner.
    1. If this banner is going to be translated then enclose any text to be translated with triple parens - {{{FOO}}}.
  1. Submit

(TODO: move and expand this snippet)

  • Each banner has its banner definition stored in MediaWiki:Centralnotice-template-<name>
  • All of its messages are stored below the banner defined in MediaWiki:Centralnotice-template-<name>-<message>/<language_code>

Neue Kampagne

  1. Add a campaign with a given start time at the bottom portion of the page, leave a comment, and click submit.
    1. If this campaign is only run on a specific wiki and or language then select it from the pull downs.
  1. Click on the new campaign and add the banners you want within this running campaign and their respective weights.
  1. If all looks well then set this campaign to enabled and it will show at the corresponding time.

Auswahl überschreiben

Add any of the following URL parameters to preview a specific banner, defeat "diet" schemes, or debug pseudorandom banner selection.

banner
You can test a banner directly on any wiki by adding ?banner=<bannername> to the end of the URL.
randomcampaign
A decimal number between 0 and 1, to be used as the "random" seed for choosing a campaign.
randombanner
A decimal number between 0 and 1, to be used as the "random" seed for choosing a banner among banners available in the chosen campaign.
country
Override the country code, before filtering to geotargeted campaigns. Accepts two-character ISO 3166-1 codes.
uselang
Its usual meaning in MediaWiki, this determines which banners you may be shown. Beware of content language vs. user language.
force
Override any banner hiding code, show the banner.
reset
Zero out any cookies being used to customize banner display (e.g. delivered impression count).

For example,

Debugging problematic banners

If there is a problematic banner in the page, you can identify which banner is active by opening your developer console and inspecting the value of
mw.centralNotice.bannerData.bannerName
.

Einschränkungen

Banners do not display on pages in the Special namespace, as well as edit pages and diff pages.

API

CentralNotice adds two API modules, centralnoticechoicedata and centralnoticequerycampaign. (The API module centralnoticeallocations was deprecated and removed in MediaWiki 1.25.)



action=centralnoticechoicedata

(main | centralnoticechoicedata)

Get data needed to choose a banner for a given project and language

Specific parameters:
Other general parameters are available.
project

The project to get banner choice data for.

This parameter is required.
language

The language to get banner choice data for.

This parameter is required.
Example:
Get the data for choosing a banner for English Wikipedia users.
api.php?action=centralnoticechoicedata&project=wikipedia&language=en [open in sandbox]



action=centralnoticequerycampaign

(main | centralnoticequerycampaign)

Get all configuration settings for a campaign.

Specific parameter:
Other general parameters are available.
campaign

Campaign name. Separate multiple values with a "|" (vertical bar).

Default: (empty)

Siehe auch