Extensão: CentralNotice
Estado de lançamento: estável |
|
|---|---|
| Implementação | Página espacial, API |
| Descrição | Adds a central sitenotice |
| Autor(es) | Andrew Russell Green, Matthew Walker, Adam Roses Wight Formerly: Brooke Vibber, Tomasz Finc, Trevor Parscal, Ryan Kaldari |
| Última versão | 2.6.1 (continuous updates) |
| Política de compatibilidade | Lançamentos de capturas de ecrã em conjunto com o MediaWiki. Original não é compatível com as versões anteriores. |
| Alterações à base de dados | Sim |
| Tabelas | 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 |
| Licença | GNU - Licença Pública Geral 2.0 ou superior |
| Transferência | |
| Exemplo | Special:CentralNotice on Meta (read-only) |
|
|
| Traduza a extensão CentralNotice se esta estiver disponível em translatewiki.net | |
| Problemas | Tarefas em aberto · Reportar um erro |
A extensão CentralNotice distribui anúncios (normalmente na forma de faixas) para as wikis da Wikimédia. É utilizada fortemente pela equipa de Fundraising para solicitar donativos, e para anúncios de interesse para as comunidades e utilizadores da Wikimédia. CentralNotice can target announcements by country, language, project, device and logged-in status.
Esta página contém informação para os programadores de CentralNotice e administradores de wiki que querem instalar CentralNotice nos seus próprios sites. Para saber como criar e configurar as campanhas de CentralNotice, por favor, consulte Help:CentralNotice em Meta-Wiki. Para informação sobre a configuração de CentralNotice no cluster da Fundação Wikimédia, consulte CentralNotice em Wikitech.
CentralNotice allows central distribution of announcements to many wikis (called subscribing wikis) from a central wiki (the infrastructure wiki). If you only need to post messages to a single wiki, consider using Sitenotice instead.
Instalação
Para todas as wikis
- Transfira a captura de ecrã mais recente e extraia-a para sua diretoria de extensões.
- Adicione o seguinte a LocalSettings.php:
wfLoadExtension( 'CentralNotice' );
- Por predefinição, a procura de GeoIP está desativada. If the
Geocookie 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';
A wiki da infraestrutura
- Na linha de comandos, vá para a raiz da wiki e execute
php maintenance/run.php update - Editar
LocalSettings.phpe definir...$wgNoticeInfrastructurepara true
$wgNoticeProjectsto be an array of projects that will subscribe to the central wiki.
Por exemplo array( 'wikipedia', 'wiktionary' )
- By default the
sysopgroup is the only group with the ability to administer CentralNotice.
If additional groups are needed, assign them the centralnotice-admin and editinterface permissions.
Subscrever wikis
- Editar
LocalSettings.phpe definir...
$wgNoticeInfrastructureparafalse;$wgNoticeProjectpara ser uma entrada em$wgNoticeProjects;
$wgCentralHostto the protocol (potentially neutral) and domain of the central wiki.
Por exemplo //meta.wikimedia.org;
$wgCentralSelectedBannerDispatcherto the URL of Special:BannerLoader on the central wiki, for example://meta.wikimedia.org/w/index.php/Special:BannerLoader;
- either
$wgCentralDBnameto the name of the infrastructure wiki's database, or$wgCentralNoticeApiUrlto the API endpoint of the infrastructure wiki; and
$wgCentralBannerRecorderto the URL of Special:RecordImpression on the central wiki.
Por exemplo: //meta.wikimedia.org/w/index.php/Special:RecordImpression.
Configuração rápida de programadores
For most development tasks, you can use a single wiki in both infrastructure and subscribing roles.
Following are sample lines to include in LocalSettings.php.
(Veja as notas nos comentários.)
wfLoadExtension( 'CentralNotice' );
$wgNoticeInfrastructure = true;
$wgNoticeProject = 'centralnoticeproject'; # 'centralnoticeproject' pode ser qualquer ''string''
$wgNoticeProjects = [ $wgNoticeProject ];
$wgCentralHost = $wgServer;
$wgCentralSelectedBannerDispatcher = "$wgServer$wgScriptPath/index.php?title=Special:BannerLoader";
$wgCentralDBname = $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.
Dependências
Some CentralNotice features require other MediaWiki extensions, including Registo de Eventos and Translate.
Obter ajuda
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.
Permissões
centralnotice-admin— Permission required to modify campaigns and banners. Relevant only to the infrastructure wikis (see also bugzilla:26377).editinterface- required to edit banner content.
Conceitos de desenho
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.
- Banner — a single block of translatable html/wikitext/css/javascript that will display at the top of Manual:$wgContentNamespaces pages.
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.
Documentos de desenho
GeoIP lookup
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.
(See 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.
Utilização
Full usage instructions can be found at meta:Help:CentralNotice.
Nova Faixa
- Carregar Special:CentralNoticeBanners
- Click on the add banner link at the bottom of the page (must be logged in as an admin).
- Enter in a name and the raw HTML for the given banner.
- If this banner is going to be translated then enclose any text to be translated with triple parens - {{{FOO}}}.
- Submeter
(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>
Nova Campanha
- Add a campaign with a given start time at the bottom portion of the page, leave a comment, and click submit.
- If this campaign is only run on a specific wiki and or language then select it from the pull downs.
- Click on the new campaign and add the banners you want within this running campaign and their respective weights.
- If all looks well then set this campaign to enabled and it will show at the corresponding time.
Overriding selection
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).
Por exemplo,
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.
Limitações
Faixas não são exibidas nas páginas no espaço nominal Special, bem como nas páginas editadas e nas páginas de diferenças.
API
A «Central de Avisos» adiciona 2 módulos de API, centralnoticechoicedata e centralnoticequerycampaign.
(The API module centralnoticeallocations was deprecated and removed in MediaWiki 1.25.)
| A documentação a seguir é a saída de Special: |
action=centralnoticechoicedata
- This module requires read rights.
- Source: CentralNotice
- License: GPL-2.0-or-later
Get data needed to choose a banner for a given project and language
- 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.
- Get the data for choosing a banner for English Wikipedia users.
- api.php?action=centralnoticechoicedata&project=wikipedia&language=en [open in sandbox]
| A documentação a seguir é a saída de Special: |
action=centralnoticequerycampaign
- This module requires read rights.
- Source: CentralNotice
- License: GPL-2.0-or-later
Get all configuration settings for a campaign.
- campaign
Campaign name. Separate multiple values with a "|" (vertical bar).
- This parameter is required.
- Show campaign "Plea_US"
- api.php?action=centralnoticequerycampaign&format=json&campaign=Plea_US [open in sandbox]
Consultar também
- Help:CentralNotice e Alterações depois de refactoring (2015-09) no meta
- Extension:CentralNotice/Campaign and banner selection
- Extension:CentralNotice/Impression diet
- Extension:CentralNotice/Special:RecordImpression
- Extension:CentralNotice/Statuses, reasons and status codes
- Extension:CentralNotice/Banner_mixins
- Requests for comment/CentralNotice Caching Overhaul - Frontend Proxy
- Extension:CentralNotice/Notes/Miscelaneous doc bits
- Extension:CentralNotice/Notes/Documentation rewrite
- Extension:CentralNotice/Notes/Campaign-associated_mixins_and_banner_history
- Extension:CentralNotice/Notes/Banner controller refactoring
- Outras subpáginas desta página (aviso: muitas estão desatualizadas)
| Este extensão está a ser utilizado em um ou mais projetos da Wikimedia. Isso provavelmente significa que a extensão é estável e funciona bem o suficiente para ser usada por esses sites de alto tráfego. Procure o nome desta extensão nos arquivos de configuração CommonSettings.php e InitialiseSettings.php da Wikimedia para ver onde está instalado. Uma lista completa das extensões instaladas em um determinado wiki pode ser vista na página Special:Version do wiki. |
| This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Stable extensions/pt
- Special page extensions/pt
- API extensions/pt
- GPL licensed extensions/pt
- Extensions in Wikimedia version control/pt
- CanonicalNamespaces extensions/pt
- ChangeTagsListActive extensions/pt
- GetPreferences extensions/pt
- ListDefinedTags extensions/pt
- LoadExtensionSchemaUpdates extensions/pt
- PreferencesGetIcon extensions/pt
- ResourceLoaderRegisterModules extensions/pt
- SkinTemplateNavigation::Universal extensions/pt
- UserMergeAccountFields extensions/pt
- All extensions/pt
- Extensions used on Wikimedia/pt
- Extensions included in Miraheze/pt
- Extensions included in WikiForge/pt
- Extensions for data exchange with other local wikis/pt
- Extensions supporting fundraising and donations/pt
- Fundraising/pt
