Mediawiki-customization-fr

De Mi caja de notas

Révision datée du 27 octobre 2018 à 04:25 par Xtof (discussion | contributions) (Page créée avec « Cette page a démarré sur iwc:mediawiki-customization et migrera sur iwc:mediawiki-customization-fr Cette page documente les personnalisations produites sur Me... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

Cette page a démarré sur iwc:mediawiki-customization et migrera sur iwc:mediawiki-customization-fr

Cette page documente les personnalisations produites sur MediaWiki pour notre communauté.

extensions

extensions IndieWeb

https://github.com/indieweb/mediawiki-extensions

  • AllowAnchorTags - allows inserting <a> anchor tags into wikitext
  • notitle - adds __NOTITLE__ tag to stop MediaWiki from adding its own page title
  • raw - lets you embed raw HTML into wiki pages using raw
  • RelWebmention - add webmention endpoint to wiki pages
  • LassoAuth - enables web sign-in via the Lasso auth proxy
  • Calendar - adds <calendar> tag for creation of a single month calendar

dfn

https://github.com/aaronpk/mediawiki-mf2-dfn

Adds a p-summary tag around the first sentence of a page that contains a <dfn> tag

CategoryTree

mf2 parser

The wiki requires a Microformats parser to be able to do a few things. Copy the php-mf2 repository to the extensions folder.

activation extensions

wfLoadExtension('Cite');
wfLoadExtension('ParserFunctions');
wfLoadExtension('Auth_remoteuser');
wfLoadExtension('CategoryTree');

require_once('extensions/php-mf2/Mf2/Parser.php');
require_once('extensions/dfn/dfn.php');

require_once('extensions/IndieWeb/raw.php');
require_once('extensions/IndieWeb/notitle.php');
require_once('extensions/IndieWeb/AllowAnchorTags.php');
require_once('extensions/IndieWeb/RelWebmention.php');
require_once('extensions/IndieWeb/Calendar.php');
require_once('extensions/IndieWeb/LassoAuth.php');

config extension

LassoAuth::$auth = 'https://sso.indieweb.org/';
LassoAuth::$wiki = 'https://indieweb.org/';

$wgPingbackEndpoint = 'https://webmention.io/indiewebcamp/xmlrpc';
$wgWebmentionEndpoint = 'https://webmention.io/indiewebcamp/webmention';

personnalisations modifiables

Voir mw:Common.css pour une CSS personnalisée utilisée sur ce wiki.

configuration

Ajoutez ce qui suit à LocalSettings.php

activer les jolis urls

The wiki is installed in the wiki folder on the server, but we want the URLs to be indieweb.org/example.

$wgScriptPath = '/wiki';
$wgScriptExtension  = ".php";
$wgArticlePath = '/$1';
$wgUsePathInfo = true;
$wgCapitalLinks = false;

user permissions

$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['autocreateaccount'] = true;
$wgGroupPermissions['user']['move'] = true;
$wgGroupPermissions['user']['movefile'] = true;
$wgGroupPermissions['user']['delete'] = true;
$wgGroupPermissions['user']['undelete'] = true;
$wgGroupPermissions['user']['browsearchive'] = true;
$wgGroupPermissions['user']['rollback'] = true;
$wgDefaultUserOptions ['editsection'] = true;
$wgAllowUserSkin = true;
$wgAllowUserCss = true;
$wgAllowUserJs = true;

copyright

$wgEnableCreativeCommonsRdf = true;
$wgRightsPage = "IndieWebCamp:Copyrights"; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "http://creativecommons.org/publicdomain/zero/1.0/";
$wgRightsText = "a CC0 public domain dedication";
$wgRightsIcon = "https://i.creativecommons.org/p/zero/1.0/88x31.png";
$wgEnableCreativeCommonsRdf = true;

autoriser plus de téléversements de fichiers

$wgFileExtensions[] = 'pdf';
$wgFileExtensions[] = 'txt';
$wgFileExtensions[] = 'svg';
$wgFileExtensions[] = 'ai';

autres

$wgEnableUploads = true;
$wgAllowImageTag = true;
$wgNoFollowLinks = false;
$wgAllowExternalImages = true;
$wgCookieExpiration = 180 * 86400;
$wgSecureLogin = true;
$wgCookieSecure = true;

set up https://www.mediawiki.org/wiki/Manual:$wgRCFeeds to the secret lair of Loqi

skin

We use the default Vector skin for the wiki, with some minor customization to add Microformats markup to pages.

In skins/Vector/VectorTemplate.php, make the changes described on https://aaronparecki.com/2018/01/14/3/

page d'accueil

MediaWiki refuses to serve the front page from / and insists on redirecting it to /Main_Page instead. It's possible to rename that page to something like /Home, but even that isn't great. We want the front page to be served at just https://indieweb.org/. To do that, there is a separate index.php file at the root of the server, which essentially proxies the MediaWiki page.

<?php
$opts = array('title' => 'Main_Page');
if(array_key_exists('useskin',$_GET))
  $opts['useskin'] = $_GET['useskin'];
$ch = curl_init('https://indieweb.org/wiki/index.php?'.http_build_query($opts));
// Pass the HTTP_COOKIE header through for auth
if(array_key_exists('HTTP_COOKIE', $_SERVER)) {
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(
		'Cookie: ' . $_SERVER['HTTP_COOKIE']
	));
}

header('Link: <https://webmention.io/indiewebcamp/webmention>; rel="webmention"');

// No-cache if the user is logged in
if(isset($_SERVER['REMOTE_USER'])) {
  header('Cache-Control: no-cache');
}

curl_exec($ch);


Voir aussi