Mediawiki 1.39 upgrade

De Banane Atomic
Aller à la navigationAller à la recherche

Environment

  • Ubuntu ARM 18.04
  • Apache with PHP-FPM

Disable the website

Bash.svg
# disable the website
sudo a2dissite wiki.conf
sudo a2dissite kiwi.conf
sc-reload apache2

# at the end, re-enable the website
sudo a2ensite wiki.conf
sudo a2ensite kiwi.conf
sc-reload apache2

Install the version 1.39

Bash.svg
wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.1.tar.gz
tar xf mediawiki-1.39.1.tar.gz

cd /var/www

# backup the previous version
sudo mv wiki wiki.bak

# copy the new mediawiki folder and needed files from previous install
sudo mv -T mediawiki-1.39.1 wiki

sudo cp -r wiki.bak/images/. wiki/images
sudo cp -r wiki.bak/images-kiwi wiki/images-kiwi

sudo mkdir wiki/cache-kiwi

# copy the LocalSettings
sudo cp wiki.bak/LocalSettings.php wiki

# copy the non-native extensions
cd wiki.bak/extensions
sudo cp -r ContactPage CustomTags Highlightjs_Integration NativeSvgHandler SimpleMathJax SummaryPage wiki/extensions
# highlight.js
sudo cp -R wiki.bak/resources/lib/highlight.js resources/lib/

cd wiki.bak/resources/assets
sudo cp arch-logo.svg banane.ico hljs-88x31.png kiwi.ico odroid.svg piwiklogo.png poweredby_mediawiki.svg wiki/resources/assets/

# custom style for MonoBook
sudo cp wiki.bak/skins/MonoBook/resources/custom.css wiki/skins/MonoBook/resources/
# additional images for MonoBook
cd wiki.bak/skins/MonoBook/resources/images
sudo cp list-plus.svg list-minus.svg skins/MonoBook/resources/images/

# update the owner
sudo chown -R root:root wiki
sudo chown -R www-data:www-data wiki/cache wiki/cache-kiwi wiki/images wiki/images-kiwi

Upgrade the database

Bash.svg
cd /var/www/wiki

export SERVER_NAME=wiki.bananeatomic.fr
php maintenance/update.php

export SERVER_NAME=kiwi.bananeatomic.fr
php maintenance/update.php

Customize the Monobook skin

Add custom style

skins/MonoBook/skin.json
{
    "ResourceModules": {
        "skins.monobook.styles": {
            "styles": [
                // add new resource sytle
                "resources/custom.css"
            ]
skins/MonoBook/resources/custom.css
/*
** MediaWiki 'darkmonobook' style sheet for CSS2-capable browsers.
** Copyright Nicolas
** License: GPL (http://www.gnu.org/copyleft/gpl.html)
**
** Addition to the MediaWiki 'monobook' style by Gabriel Wicke - http://wikidev.net/.
** Loosely based on http://www.positioniseverything.net/ordered-floats.html by Big John
** and the Plone 2.0 styles, see http://plone.org/ (Alexander Limi,Joe Geldart & Tom Croucher,
** Michael Zeltner and Geir Bækholt)
** All you guys rock :)
*/

/* pre, code */
pre,
code {
    color: #D0D0D0 !important;
    background-color: #202020 !important;
    font-family: "Source Code Pro", Consolas, monospace !important;
    font-size: 105%;
}

pre {
    border: 0 !important;
}

/* arrière-plan dark */
body,
div#content,
div#footer,
div#toc,
/* sommaire */
div#catlinks,
/* liste des catégories en bas de page */
.mw-search-formheader,
/* Bandeau sur la page de résultats de recherche */
.mw-search-profile-tabs,
/* Bandeau sur la page de résultats de recherche */
div.editOptions,
/* les 2 dernières versions de la page Historique des versions */
ul#pagehistory>li.selected,
/* menu de la page Fichier: */
table.mw_metadata th,
table.mw_metadata td,
/* table métadonnées dans la page Fichier: */
table.mw-datatable td,
table.mw-datatable th,
/* Catégories de suivi, Spécial:TrackingCategories */
div#p-cactions li,
/* onglets */
ul#filetoc,
div#userloginForm,
.mw-ui-vform>div label,
/* formulaire de login */
fieldset#mw-searchoptions,
/* recherche avancée */
div.noarticletext,
/* champs visible lors de l'annulation de la création d'une page */
div.pBody,
/* groupes de la colonne de gauche */
div.mw-warning,
/* message encadré Attention: */
.oo-ui-dropdownWidget,
/* renommer, menu déroulant */
.oo-ui-textInputWidget input,
.oo-ui-textInputWidget textarea,
/* Résumé dans Modification */
/*.oo-ui-buttonElement-framed > .oo-ui-buttonElement-button,*/
/* redefinit plus bas */
/*.oo-ui-buttonElement > .oo-ui-buttonElement-button,*/
/* boutons dans Modification */
#column-content,
/* fond colonne de gauche et du bamdeau du haut */
div.thumbinner {
    /* Texte dans les images miniaturisées */
    background: #262626 !important;
    color: white !important;
}

input,
textarea {
    /* champs de recherche e de modification, boutons */
    background: #333333 !important;
    color: white !important;
}

/* onglets */
/* rogner le background des onglets pour qu'il ne déborde plus */
div#p-cactions li a {
    background: none !important;
}

/* bordure bleu pour liste des catégories en bas de page */
div#catlinks {
    border-color: #1c8bce;
    border-radius: 5px 0 5px 0;
}

/* bordures dorées et arrondies */
div#toc,
/* sommaire */
div.pBody,
/* groupes de la colonne de gauche */
div#content {
    border: 1px solid #ffd700;
    /* redéfinit la bordure en entier pour afficher la bordure droite dans div#content */
    border-radius: 10px;
}

/* force la couleur des bordure pour les blocs de la colonne de gauche */
div#sidebar div.pBody {
    border: 1px solid #ffd700 !important;
}

#p-cactions li {
    border-color: #ffd700;
    border-radius: 5px 5px 0 0;
}

/* liens (balise a) + lien masquer sommaire */
a,
a:visited,
.toctogglelabel {
    color: #51AAFE !important;
}

/* liens (balise a) + span entourant les liens masque/affiche les blocs */
a,
a:visited,
.mw-collapsible-toggle {
    outline: none;
}

div#toc span {
    /* texte du sommaire en blanc */
    color: white !important;
}

/* icon for internal links */
#mw-content-text a[href^="/wiki/"] {
    background: url(/resources/src/mediawiki.skinning/images/external-ltr.svg) center right no-repeat;
    padding-right: 15px;
}

/* titres */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #ffd700 !important;
    border-bottom-color: #ffd700 !important;
}

/* décaler les titres 2 et 3 */
h2 {
    margin-left: 10px !important;
}

h3 {
    margin-left: 15px !important;
}

h4 {
    margin-left: 20px !important;
}

/* lien dans un titre
 * écrase #bodyContent a.external { color: #36b; } dans main.css */
.mw-headline>a {
    color: #ffd700 !important;
    /* afficher la petite icone pour les liens internes */
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAVElEQVR42n3PgQkAIAhEUXdqJ3dqJ3e6IoTPUSQcgj4EQ5IlUiLE0Jil3PECXhcHGBhZ8kg4hwxAu3MZeCGeyFnAXp4hqNQPnt7QL0nADpD6wHccLvnAKksq8iiaAAAAAElFTkSuQmCC') no-repeat scroll right center transparent;
    padding-right: 13px;
}

/* réduire l'espacement après les titres */
h1,
h2,
h3,
h4 {
    margin-bottom: 0.2em !important;
}

/* puces */
/* meme margin que ul */
ol {
    margin-left: 1.6em !important;
}

/* Réduire l'espacement interligne entre <p> suivuit par <ul> */
.mw-content-ltr p+ul,
.mw-content-rtl .mw-content-ltr p+ul {
    margin-top: -0.4em;
}

/*****************************************/

/* Page de résultats de recherche */
/* masquer les statistiques */
.mw-search-result-data {
    visibility: collapse;
}

/* marquer les correspondance à la recherche */
.searchmatch {
    color: #9D179D;
    font-weight: bold;
}

/*****************************************/

/* masquer les boutons de recherche et le label rechercher */
input#searchGoButton,
input#mw-searchButton,
input#searchButton,
div#p-search>h3 {
    display: none;
}

/* enlever la bordure du champs "rechercher" */
input#searchInput {
    border: none;
}

/* pas d'effet focus sur le champs "rechercher" */
input#searchInput:focus-visible {
    outline: 0px;
}

/* lorsque le le champs "rechercher" est centré, la form s'aggrandit en hauteur
 * on limite ainsi la hauteur */
form#searchform {
    height: 18px;
}

/* champs de recherche */
div.suggestions-result {
    /* champs de recherche de la page de Résultats de la recherche */
    background: #262626 !important;
    color: white !important;
    font-size: 11px !important;
}

div.suggestions-result:hover {
    text-decoration: underline;
}

/* menu déroulant "Contenant ..." dans la colonne de gauche sous le champs de recherche */
div.suggestions-special {
    background: #262626 !important;
}

div.suggestions-special div {
    color: white !important;
}

/* tableaux */
/* écraser les valeurs définie dans resources/src/mediawiki.legacy/shared.css */
table.wikitable {
    background-color: #262626;
    color: white;
}

table.wikitable>tr>th,
table.wikitable>*>tr>th {
    background-color: #262626;
}

/* wikitableplus: classe étendue pour les tableaux */
table.wtp tr>th,
table.wtp tr>td {
    padding: 5px;
}

/* monospace dans les colonnes */
table.wtmono1 tr td:first-child {
    font-family: Inconsolata-g, monospace;
}

table.wtmono2 tr td:nth-child(2) {
    font-family: Inconsolata-g, monospace;
}

table.wtmono3 tr td:nth-child(3) {
    font-family: Inconsolata-g, monospace;
}

table.wtmono4 tr td:nth-child(4) {
    font-family: Inconsolata-g, monospace;
}

/* colorer une ligne sur 2 */
table.bicolor tr:nth-child(2n) {
    background-color: DarkSlateGrey;
}

/*************************************************************/

/* figer la colonne de gauche */
/* dans le fichier MonoBookTemplate.php
   déplacer la ligne <div id="column-one"<?php $this->html('userlangattributes')  ?>>
   en dessous de "cactions" et "p-personal" pour que le menu du haut fasse parti de la colonne 2 */
div#column-one {
    position: fixed;
    /* mettre la colonne au-dessus de la barre p-personal */
    z-index: 3;
}

div#content {
    min-height: 420px;
}

/**************************************************************/

/* Tableau de la page Liste de fichiers */
.TablePager td,
.TablePager th {
    background-color: #262626;
}

.TablePager tr:hover td {
    background-color: #111100;
}

/*************************************************************/

/* marges de la page à gauche */
#column-one {
    margin: 0 0 0 1px;
}

/* affichage du code JavaScript de la page MediaWiki:Common.js*/
pre.source-javascript {
    background-color: #ffffff;
    color: #000000;
}

/* Masquer les onglets discussion et suivre */
#ca-talk,
#ca-watch {
    display: none !important;
}

/* Changer le fond de WikiEditor Preview */
.wikiEditor-preview-contents,
.wikiEditor-ui-controls,
.wikiEditor-ui-tabs div,
.wikiEditor-ui-buttons {
    background-color: #262626 !important;
}

.wikiEditor-ui-tabs div.current a,
.wikiEditor-ui-toolbar .tabs span.tab a.current,
.wikiEditor-ui-toolbar .tabs span.tab a.current:visited {
    color: white !important;
}

.wikiEditor-ui-tabs div a,
.wikiEditor-ui-toolbar .tabs span.tab a,
.wikiEditor-ui-toolbar .tabs span.tab a:visited {
    color: #1C8BCE !important;
}

.wikiEditor-ui-buttons {
    border-top-color: #262626 !important;
}

.wikiEditor-ui-toolbar {
    background-image: none !important;
    background-color: #262626 !important;
}

#wikiEditor-ui-toolbar .oo-ui-iconElement {
    background-color: grey !important;
}

/* fond pour rendre les icones noires visibles */
/* Avancé */
#wikiEditor-section-advanced {
    background: #262626;
}

#wikiEditor-section-advanced .label {
    color: white;
}

#wikiEditor-section-advanced .tool-select {
    background: #262626;
}

.wikiEditor-ui-toolbar .group .tool-select .menu .options {
    background: #262626 !important;
}

/* bouton de la bar */
.tool-button,
.tool.oo-ui-buttonElement-frameless.oo-ui-iconElement {
    border-color: black !important;
}

/*****************************************/

/* réduire la taille de la zone d'édition */
#wpTextbox1 {
    height: 340px;
}

/* table d'affichage des différences */
table.diff {
    background-color: #262626 !important;
}

td.diff-context {
    background-color: #262626 !important;
    color: white !important;
}

td.diff-deletedline {
    border-color: #FFB300 !important;
}

td.diff-deletedline .diffchange {
    background-color: #FFB300 !important;
}

td.diff-addedline {
    border-color: #0083FF !important;
}

td.diff-addedline .diffchange {
    background-color: #0083FF !important;
}

/**************************************************/

/* déplacer les liens "modifier" sur la droite */
.mw-content-ltr .mw-editsection,
.mw-content-rtl .mw-content-ltr .mw-editsection {
    float: right;
    line-height: 1.5em !important;
}

/* masque le message Votre modification a été enregistrée */
.postedit {
    display: none !important;
}

/* masque les liens inutiles dans le groupe outils de la colonne de gauche */
#t-permalink,
/* Adresse de cette version */
#t-print {
    /* version imprimable */
    display: none;
}

/* menu en haut à droite */
div#p-personal a:hover {
    text-decoration: underline;
    background: none;
    /* masquer le fond blanc */
}

/************************************************/

/* masquer le copyright dans le footer */
li#copyright {
    display: none !important;
}

/* page des préférences */
#preferences,
.prefsection table,
.prefsection legend,
#preftoc li.selected,
#preftoc li,
.oo-ui-buttonElement-framed>.oo-ui-buttonElement-button,
.oo-ui-dropdownWidget.oo-ui-widget-enabled .oo-ui-dropdownWidget-handle,
.mw-prefs-buttons {
    background: none;
    /* masquer le fond blanc */
}

.oo-ui-tabSelectWidget-framed {
    background: none !important;
    border-bottom: 1px white solid;
}

.oo-ui-tabSelectWidget-framed .oo-ui-tabOptionWidget.oo-ui-optionWidget-selected,
.oo-ui-tabSelectWidget-framed .oo-ui-tabOptionWidget.oo-ui-widget-enabled:hover {
    background: none !important;
    color: white !important;
}

.oo-ui-tabOptionWidget {
    color: white !important;
}

.oo-ui-buttonElement-framed>.oo-ui-buttonElement-button {
    text-shadow: none;
}

.mw-prefs-buttons {
    position: unset;
}

/************************************************/

/* zoom */
body {
    /* pour Chrome, IE, Opera, Safari, mais pas pour Firefox */
    zoom: 1.2;
}

/****************************************************/

/*** mobile ***/
/* top icons */
#p-cactions-mobile li.selected a,
#p-cactions-mobile li:hover a {
    background-color: unset;
}

#p-cactions-mobile li a {
    background-color: unset;
}

#p-cactions-mobile li {
    border: unset;
}

/* plus menu */
.mobile-menu-active {
    background-color: #202020 !important;
}

/* fisrt column of kode */
@media screen and (max-width: 550px) {
    table.kode td:first-child {
        display: none;
    }
}

/**************/

Fix column-one position

skins/MonoBook/resources/custom.less
div#column-one {
    position: fixed;
    /* put column-one above p-personal */
    z-index: 3;
}

div#content {
    min-height: 420px;
}
skins/MonoBook/templates/skin.mustache
    <!-- line 24 -->
    <div class="visualClear"></div>

        <!-- NEW PLACE outside of column-one -->
            {{#data-portlets}}
            <div role="navigation" class="portlet" id="p-cactions" aria-labelledby="p-cactions-label">
                <h3 id="p-cactions-label" {{{html-user-language-attributes}}}>{{msg-monobook-cactions-label}}</h3>
                <div class="pBody">
                    <ul {{{html-user-language-attributes}}}>
                    {{! comments used to avoid additional whitespace}}
                    {{{data-namespaces.html-items}}}{{!
                    }}{{{data-views.html-items}}}{{!
                    }}{{{data-actions.html-items}}}
                    {{{data-variants.html-items}}}
                    </ul>
                </div>
            </div>
            {{#data-cactions-mobile}}{{>Portlet}}{{/data-cactions-mobile}}
            {{#data-personal}}
            <div role="navigation" class="portlet" id="{{id}}" aria-labelledby="{{id}}-label">
                <h3 id="{{id}}-label" {{{html-user-language-attributes}}}>{{label}}</h3>
                <div class="pBody">
                    <ul {{{html-user-language-attributes}}}>
                    {{{html-items}}}
                    </ul>
                </div>
            </div>
            {{/data-personal}}
            {{/data-portlets}}
        <!-- NEW PLACE outside of column-one -->

    </div>
    <div id="column-one" {{{html-user-language-attributes}}}>
        <!--{{#data-portlets}}-->
        <h2>{{msg-navigation-heading}}</h2>

        <!-- MOVED outside of column-one
            <div role="navigation" class="portlet" id="p-cactions" aria-labelledby="p-cactions-label">
                <h3 id="p-cactions-label" {{{html-user-language-attributes}}}>{{msg-monobook-cactions-label}}</h3>
                <div class="pBody">
                    <ul {{{html-user-language-attributes}}}>
                    {{! comments used to avoid additional whitespace}}
                    {{{data-namespaces.html-items}}}{{!
                    }}{{{data-views.html-items}}}{{!
                    }}{{{data-actions.html-items}}}
                    {{{data-variants.html-items}}}
                    </ul>
                </div>
            </div>
            {{#data-cactions-mobile}}{{>Portlet}}{{/data-cactions-mobile}}
            {{#data-personal}}
            <div role="navigation" class="portlet" id="{{id}}" aria-labelledby="{{id}}-label">
                <h3 id="{{id}}-label" {{{html-user-language-attributes}}}>{{label}}</h3>
                <div class="pBody">
                    <ul {{{html-user-language-attributes}}}>
                    {{{html-items}}}
                    </ul>
                </div>
            </div>
            {{/data-personal}}
        -->

        <div class="portlet" id="p-logo" role="banner">
            <a href="{{link-mainpage}}" class="mw-wiki-logo"></a>
        </div>
        <div id="sidebar">
        <!--{{/data-portlets}}-->
        {{#data-search-box}}

Remove unnecessary folders

Bash.svg
# documentation
sudo rm -rf docs

# unused extensions
cd extensions
sudo rm -rf AbuseFilter CategoryTree Cite CiteThisPage ConfirmEdit Gadgets ImageMap InputBox Interwiki Nuke OATHAuth PageImages ParserFunctions PdfHandler Poem Renameuser Scribunto SecureLinkFixer SpamBlacklist SyntaxHighlight_GeSHi TemplateData TextExtracts TitleBlacklist VisualEditor

# lang
setopt extended_glob
cd languages/i18n
sudo rm -- ^(en|fr).json
cd languages/i18n/exif
sudo rm -- ^(en|fr).json

# unused skins
cd skins
sudo rm -rf MinervaNeueTimeless Vector

# test files
sudo rm -rf tests
Native extensions
Name Description
AbuseFilter Allows specific behavior-based restrictions to be placed on wiki activity
CategoryTree Provides a dynamic view of the wiki's category structure as a tree
Cite Allows footnotes for citing sources and helps for correctly citing content in offline media
CiteThisPage Adds a special page that provides different citation formats for a particular article
CodeEditor Provides a syntax-highlighting code editor for site & user JS, CSS and Lua pages, integrating with advanced edit toolbar
ConfirmEdit Adds CAPTCHAs for page saves and other user actions
Gadgets Allow users to enable JS-based, user-provided gadgets from their preferences page
ImageMap Allows clickable HTML image maps
InputBox Allows users to add predefined HTML forms to wiki pages
Interwiki Adds a special page to view and manipulate the interwiki table
Math Allows to render mathematical formulas
MultimediaViewer Provides a better experience to users when they click on thumbnails in a page
Nuke Gives sysops the ability to mass delete pages.
OATHAuth Provides two-factor authentication for logging in
PageImages Stores information about images representing a page
ParserFunctions Enhances parser with logical and string functions
PdfHandler Shows uploaded PDF files in a multipage preview layout
Poem Allows easy formatting of poems and similar material
Renameuser Provides a special page that allows user accounts to be renamed
Replace Text Provides a form to let administrators do string replacements on the entire wiki, for both page contents and page titles
Scribunto Provides a framework for embedding scripting languages into MediaWiki pages
SecureLinkFixer Rewrites URLs to HTTPS if domain always requires HTTPS
SpamBlacklist Provides a regex-based spam filter
SyntaxHighlight Allows source code to be syntax highlighted on the wiki pages
TemplateData Allows to store, retrieve and visualise information about templates
TextExtracts Provides API with plain-text or limited HTML extracts of page content
TitleBlacklist Blocks the creation of pages matching a regular expression blacklist
VisualEditor Allows for editing pages as rich content
WikiEditor Provides an extendable wikitext editing interface and many feature-providing modules

Clean

Bash.svg
# delete unused folder
sudo rm -rf mediawiki.bak