Arbores MediaWiki installation

Jump to navigation Jump to search

Update: As of May 21 2022 I moved the whole site to my own custom installation, since my redirections etc. broke the backup mechanism of Infomaniak. To do so, I did:

  • A fresh install of Mediawiki 1.35 via git plus its extensions. Using a tar version would have been easier. I had to install the skin, each extension and then for each define the Release Version.
  • Export the database (can only be done via the web)
  • Create a new database with a new db user. Import this database.
  • Change the LocalSettings.php to reflect the new db and db user
  • Moved the directory temporarily: w to ww
  • Deleted the Infomaniak installation
  • Moved ww back to w.

I am no longer used to sysadmin, but the whole process took no more than 3 hours.

Introduction

This page includes installation notes for this wiki.

Most wiki configuration is done in a LocalSettings.php file

  • You could edit a file locally and transfer it via SFTP or edit it using ssh and the nano editor.

Some configurations are done through wiki pages, e.g. messages, end-user style. the menu-bar, etc.

Base installation

for this installation we used the provider's installation. Else, we recommend doing it via Git, see our edutechwiki installation notes

For updating, follow your provider's instructions, e.g.

Important help pages for mediawiki

MediaWiki Tutorials

Working with extensions

Extensions can greatly expand the functionality of your wiki. However, they may break it or may break other extensions. In addition, they may not be maintained, i.e. must be either fixed or uninstalled after upgrades.

Some extensions are already distributed with a standard installation. You still have to follow instructions to get them working.

(1) Downloading the extension

Warning: you may have to install and extension with the composer (read the instructions below)

In general, we recommend to use git for composer-less installations, since it allows for quick updates and also for switching between versions Most extensions are available from the official repository. Its location is often undocumented on the extension page, but you can easily guess it. As of 2021 and 2022, the location is

https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ExtensionName.git

e.g.

https://gerrit.wikimedia.org/r/p/mediawiki/extensions/CategoryTree.git

Then just cd in to the extension directoy and type:

git pull https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ExtensionName.git

(2) Select the right version, e.g:

cd ExtensionName
git checkout REL1_35

(3) You also should update the whole system. From the root directory, type:

php maintenance/update.php

Information about installed extensions

  • See the Version Button in the menu to the left.

Installing extensions with the composer

Composer is run from the base directory (and not the extensions directory) !! It should be installed with a good hosting program like Infomaniak. Otherwise, you will have to install it.

See the documentation for each extension. Examples:

composer require mediawiki/semantic-media-wiki "1.9.*,>=1.9.0.1"
composer require mediawiki/semantic-media-wiki "~2.0"
Update all extensions using composer.
If the dependencies are right, this should work without worrying about versions.
composer update
- or, for stable versions -
composer update --no-dev
Trouble
If composer updates, but maintenance/update.php balks with "Error: your composer.lock file is not up to date. Run "composer update --no-dev" to install newer dependencies", try
php maintenance/update.php --skip-external-dependencies

Basic configuration work

URL configuration

Edit Localsettings.php and verify the URL (this can change later, e.g. if you move to a subdomain)

$wgServer = "http://w.arbores.tech";

Slogan and site notices

Slogan

Set the right vibrations from the start. A slogan can be enabled in the CSS. Setting a tagline may be a bit childish since it appears under the title of each page.....

A way to change the tagline that appears on top of every page just below the page title (but by default is hidden in Monobook and Vector skins except when printing pages) is to modify the MediaWiki:Tagline system message that if undefined defaults to From {{SITENAME}}

Add the following MediaWiki:Common.css if you want the tagline to display in all skins.

#siteSub {
    display: block;
}

Obsolete: MediaWiki:Sitesubtitle and the $wgExtraSubtitle variable are obsolete....

Sitenotices (e.g. to annonce an important event)

Read: http://www.mediawiki.org/wiki/Manual:Interface/Sitenotice

In LocalSettings.php, set

$wgSiteNotice = " ........ ";

Enable File upload and add file types

Also read Manual:thumb_handler.php

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads  = true;
$wgGenerateThumbnailOnParse = true;

Wikis can accept most types of files that are not executable, so you should add some more, zip seems to be special case

$wgFileExtensions = array_merge ( $wgFileExtensions,
   array( 'docx', 'pptx', 'xlsx', tiff', 'odt', 'odg', 'ods', 'odp', 'svg', 'pdf')
);

To enable zip extension (tested in MediaWiki v1.19.23) the following will be necessary in the LocalSettings.php file:

$wgFileExtensions[] = 'zip';
$wgTrustedMediaFormats[] = 'application/zip';

Change permission

By default, anyone can create an account and contribute. To change:

$wgGroupPermissions['*']['createaccount']   = false;
$wgGroupPermissions['*']['read']            = true;
$wgGroupPermissions['*']['edit']            = false;
$wgGroupPermissions['*']['createpage']      = false;
$wgGroupPermissions['*']['move']            = false;
$wgGroupPermissions['*']['createtalk']      = false;
$wgGroupPermissions['*']['upload']          = false;
$wgGroupPermissions['*']['reupload']        = false;
$wgGroupPermissions['*']['reupload-shared'] = false;
$wgGroupPermissions['*']['minoredit']       = false;

$wgGroupPermissions['sysop' ]['move']            = true;
$wgGroupPermissions['sysop' ]['read']            = true;
$wgGroupPermissions['sysop' ]['edit']            = true;
$wgGroupPermissions['sysop' ]['createpage']      = true;
$wgGroupPermissions['sysop' ]['createtalk']      = true;
$wgGroupPermissions['sysop' ]['upload']          = true;
$wgGroupPermissions['sysop' ]['reupload']        = true;
$wgGroupPermissions['sysop' ]['reupload-shared'] = true;
$wgGroupPermissions['sysop' ]['minoredit']       = true;
$wgGroupPermissions['sysop' ]['userrights']  = true;
$wgGroupPermissions['sysop' ]['noratelimit'] = true;

Remove table prefixes

Since they conflict with some heavy maintenance scripts

In phpmyadmin select all tables of your database.
   From the dropdown 'With selected:' choose 'Replace table prefix'
   Set from->to replacement.
   DONE

Short URL

On the hosting side, you will need a subdomain if possible (not necessary though)

Step 1: Add a subdomain

For Infomaniak hosting: Read

Step 2: Fix the site URL (if it was installed with the provider's "manager")

Step 3: Add rewrite rules for the subdomain

In the .htaccess root file, add:

RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com [NC]
RewriteCond %{DOCUMENT_ROOT}/%1/ -d
RewriteCond %1::%{REQUEST_URI} !^(.*?)::/\1/?
RewriteRule "^(.*)$" "%{DOCUMENT_ROOT}/%1/$1" [L]

On the wiki side you will have to do two things, add a rewrite rule and change Localsettings.php

Step 4: Add rewrite Rules

  • Read: Short URL
  • Use the MediaWiki ShortURL Builder and follow its instructions. However it won't work if the wiki sits in a subdirectory since it will redirect all URLs containing a w to the wiki :(

There was one major mistake in the generated list, fixed on lines 1 and 2

RewriteRule ^/wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteRule ^/w %{DOCUMENT_ROOT}/w/index.php [L]

# RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
# RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
# RewriteRule ^/w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]

# RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
# RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
# RewriteRule ^/w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

Rights

Rights and icons I suggest creating a subdirectory of the main directory where you can put picture files for icon that are read in via PHP. I used arbores, pick your own, e.g. call it local

// Rights
$wgEnableCreativeCommonsRdf = true;
$wgRightsPage = "Arbores_Wiki:Copyrights"; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/4.0/";
$wgRightsText = "CC BY-NC-SA Licence";
$wgRightsIcon = "$wgScriptPath/arbores/somerights.png";

Privacy policity

You should add at the least the following in order to be GDPR compliant as well as the Swiss law:

cd extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning

In LocalSettings.php, add

$wfLoadExtension( 'CookieWarning' );
$wgCookieWarningEnabled = true;

This creates a short popup at the bottom with an OK button. In addition should fill in the privacy page. If you do track users, you need some extra agreements. Read the extension documentation.

Icon and fabicon

You do not need to set this if you upload your favicon.ico to the root of your site. To create a favicon, there are free online websites. Some paint programs also can do it.

To use a favicon located other than in your site root, in LocalSettings.php add

$wgFavicon = "$wgScriptPath/path/to/your/favicon.ico";

e.g.

$wgFavicon = "$wgScriptPath/arbores/favicon.ico";

Register with WikiApiari

Help the MediaWiki community by registring your wiki.

https://wikiapiary.com/w/images/wikiapiary/b/b4/Monitored_by_WikiApiary.png

  • Insert the following to LocalSettings.php
$wgFooterIcons['monitoredby']['wikiapiary'] = array(
   "src" => "$wgScriptPath/arbores/Monitored_by_WikiApiary.png",
   "url" => "http://wikiapiary.com/wiki/ArboresTechWiki",
   "alt" => "Monitored by WikiApiary"
);

Mobile friendliness

To do, read:

Subpages

See: https://www.mediawiki.org/wiki/Manual:$wgNamespacesWithSubpages

The variable $wgNamespacesWithSubpages holds an array indicating which namespaces allow sub-pages. The array is indexed by the numeric namespace ID, and each array value is either 0 (no sub-pages) or 1 (sub-pages allowed). A categoryspace (namespace 14) subpage will work like any other category.

// $wgNamespacesWithSubpages = array_fill(0, 200, true);
$wgNamespacesWithSubpages = [
        NS_MAIN => true,
        NS_TALK => true,
        NS_USER => true,
        NS_USER_TALK => true,
        NS_PROJECT => true,
        NS_PROJECT_TALK => true,
        NS_FILE_TALK => true,
        NS_MEDIAWIKI => true,
        NS_MEDIAWIKI_TALK => true,
        NS_TEMPLATE => true,
        NS_TEMPLATE_TALK => true,
        NS_HELP => true,
        NS_HELP_TALK => true,
        NS_CATEGORY_TALK => true
];

Do not forget to update this when you add new namespaces....

Enabling some builtin extensions

Prequisites - server requirements

An installed wiki comes with preinstalled extensions that you can enable. However, some of these do not work on shared hosting, e.g.

  • Visual editor requires a node.js server

Others require a change in server configuration.

SyntaxHighlight requires shell access. To enable this on Infomaniak, enable it (but evaluate the risks, if a portal is hacked the others will be too).

  • open the Manager (manager.infomaniak.com)
  • go to Hosting
  • click on the hosting/domain name concerned
  • under Sites, click on the domain name of the site concerned
  • click on Advanced parameters
  • click on the PHP Tab
  • put exec, shell_exec, etc. on.

CategoryTree

The CategoryTree extension provides a dynamic view of the wiki's category structure as a tree. It uses AJAX to load parts of the tree on demand. CategoryTree was originally written by Daniel Kinzler as an external tool, but was later integrated into the MediaWiki software with the help of Tim Starling.

wfLoadExtension ('CategoryTree');

Cite

https://www.mediawiki.org/wiki/Extension:Cite

Makes <ref> </ref> for citations available.

Read Help:Cite

wfLoadExtension ('Cite');

When installed (April 32021), it was buggy, so I got a new one:

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Clone

CiteThisPage

wfLoadExtension ('CiteThisPage');

CodeEditor

(to test/do)

wfLoadExtension ('CodeEditor');

InputBox

Can be used to create HTML forms, e.g. to help creating pages with somewhat structure input. Not installed

// wfLoadExtension ('InputBox');

MultimediaViewer

wfLoadExtension ('MultimediaViewer');

In principle, there is not much to configure. As of April 2021, this is broken with a crypic message.

ParserFunctions

Adds some extra language elements to the parser. Needed for some templates.

wfLoadExtension ('ParserFunctions');

ConfirmEdit

A very useful extension to filter admission of new participants. Not used here for the moment, but it's working well on EduTechWiki

// wfLoadExtension ('ConfirmEdit');

Gadgets

wfLoadExtension ('Gadgets');

ImageMap

wfLoadExtension ('ImageMap');

Lockdown

The Lockdown extension implements a way to restrict access to specific namespaces and special pages to a given set of user groups. This provides a more finely grained security model than the one provided by the default $wgGroupPermissions and $wgNamespaceProtection settings.

Installed here to create an Intranet.

wfLoadExtension ('Lockdown');

PageImages

The PageImages extension collects information about images used on a page. Its aim is to return the single most appropriate thumbnail associated with an article. All images in the page are collected and a score for each image is calculated. The image with the highest score is selected as the page image. If the wiki is configured such that images contain metadata that specifies images are not freely licensed, the image with the best score that is also freely licensed is also stored. If no suitable image is found or all the images score badly (i.e. has a negative score), the page will not have any images. Read details on the extension page.

wfLoadExtension ('PageImages');

After the first install, run

php maintenance/refreshLinks.php

This will create the images for the Page information.

Interwiki

The The Interwiki extension adds the "Special:Interwiki" page toMediaWiki

 to view and edit the

interwiki

table, and a log of any actions made with it.

  wfLoadExtension ('Interwiki');

LocalisationUpdate

wfLoadExtension ('LocalisationUpdate');

Nuke

The Nuke extension makes it possible for sysops to mass delete pages. This is useful in open wikis after a spamming attack or in this wiki to do some housecleaning.

wfLoadExtension ('Nuke');

OATHAuth

wfLoadExtension ('OATHAuth');

Poem

The Poem extension allows easy formatting of poems and similar material within Wikitext.

Once the extension is enabled, you can put any block of text within <poem></poem> tags, which has the following effects:

  • All newlines are preserved by converting them into <br /> tags
  • The block of text is enclosed in <p>...</p> tags (as well as a div of class "poem")
  • Colons at the beginning of a line are converted into 1 em indentation
  • Spaces at the beginning of a line are preserved and no longer invoke the <pre> tag

Not installed // wfLoadExtension ('Poem');

Scribunto

Another scripting interface than template parser function. Not installed yet.

// wfLoadExtension ('Scribunto');

TemplateData

The TemplateData extension introduces a <templatedata> tag and an API which together allow editors to specify how templates should be invoked. This information is available as a nicely-formatted table for end-users, and as a JSON API, which enables other systems (e.g. VisualEditor) to build interfaces for working with templates and their parameters.

Not yet installed.

// wfLoadExtension ('TemplateData');

PdfHandler

The PdfHandler extension shows uploaded PDF files in a multipage preview layout within a page, i.e. you can use the [[File:...]] syntax. Read https://www.mediawiki.org/wiki/Extension:PdfHandler

Together with the Proofread Page extension, PDF files can be displayed side-by-side with text. This allows users to transcribe books and other documents. Not used here:

wfLoadExtension ('PdfHandler');
$wgPdfHandlerDpi = "200";

Since the image has to be create for each page, this can be server CPU intensive. Disable if this is a problem

Renameuser

Useful in educational wikis where users often pick a wrong name to start with

Installed

wfLoadExtension ('Renameuser');

ReplaceText

Replace Text is an extension to MediaWiki that provides a special page, as well as a command-line script, to allow administrators to do a global string find-and-replace on both the text and titles of the wiki's content pages. Only sysops can use this, but you can add more, e.g. bureaucrats as below.

As of April 2021, the distributed extension is broken and the new master version is not included, so do this

cd extensions
mv ReplaceText ReplaceText.old
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ReplaceText
wfLoadExtension ('ReplaceText');
$wgGroupPermissions['bureaucrat']['replacetext'] = true;
$wgReplaceTextResultsLimit = 1000;

Good to know:

  • ReplaceText only processes 250 pages at a time by default. To change this, you can set $wgReplaceTextResultsLimit to a larger value in your LocalSettings.php. However, you may be limited by PHP's max_input_vars; if the extension reports such a warning, you may need to change it.
  • All of the replacements are placed in the job queue. So if you have to process a large number of pages, you will need to run Replace Text and then run "runJobs.php" (potentially multiple times).

SecureLinkFixer

The SecureLinkFixer extension automatically rewrites URLs to HTTPS if the domain always requires HTTPS. It uses the Mozilla HSTS preload list for the list of domains. The rewrite is done on-the-fly as pages are parsed. No edits to the wiki are made, and the page source retains the original URL.

Not installed // wfLoadExtension ('SecureLinkFixer');

SpamBlacklist

wfLoadExtension ('SpamBlacklist');

TitleBlacklist

wfLoadExtension ('TitleBlacklist');

Syntaxhighlight

https://www.mediawiki.org/wiki/Extension:SyntaxHighlight

In Linux, set execute permissions for the pygmentize binary. You can use an FTP client or the following shell command to do so:

chmod a+x /path/to/extensions/SyntaxHighlight_GeSHi/pygments/pygmentize

In Local Settings, add:

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

TextExtracts

The TextExtracts extension provides an API which allows retrieval of plain-text or limited HTML (HTML with content for some CSS classes removed) extracts of page content.

Not installed // wfLoadExtension ('TextExtracts');

VisualEditor

Best wysiwyg mediawiki editor, use to require a node server. No more necessary.

wfLoadExtension ('VisualEditor');

You may have to add extra name spaces, e.g. like this.

$wgVisualEditorAvailableNamespaces = [

   'In' => true,

   'DKS' => true

   ];

WikiEditor

Adds some useful extras to the standard built-in wiki code editor. Priority installation.

wfLoadExtension ('WikiEditor');

Other extensions

Some other crucial extensions are not included with the distribution we found with our provider

TinyMCE Visual Editor

An alternative to the standard Wysiwyg visual editor. Not enabled right now.

Install with git:

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/TinyMCE
php maintenance/update.php

In LocalSettings.php, add:

// require_once "$IP/extensions/TinyMCE/TinyMCE.php";
// $wgTinyMCEEnabled = true;

If you need it, you may have to add a patch to disable the WikiEditor from adding its bar on top (read this and this small patch

Edit file extensions/WikiEditor/includes/WikiEditorHooks.save.php At line 75 add:

// Give other extensions a chance to disable WikiEditor for this page.
if ( !Hooks::run( 'WikiEditorDisable', [ $editPage ] ) ) {
    return true;
 }

Trouble shooting

In case the code from Wikipedia does not run, there are newer development versions, like this:

cd extensions
mv tinyMCE tinyMCE.old
git clone https://github.com/duncan-crane/TinyMCE.git
cd ..
php maintenance/update.php

This editor can choke with some templates. You can either simplify these or only edit a page section by section.

The editor destroys tables that have empty cells.

  • Workaround: add   inside each empty cell.

Bullet lists

Just enter the usual "*". Next time, you edit they will look ok

Menu bar configuration

It is more logical to have styles to the left and fonts etc to the right

So far, we use this:

$wgTinyMCESettings = array(
"#wpTextbox1" => array ("toolbar" => 'undo redo |
cut copy paste insert selectall| 
formatselect removeformat|
bold italic underline strikethrough subscript superscript forecolor backcolor| 
alignleft aligncenter alignright alignjustify|e keep track in case you
bullist numlist advlist outdent indent| 
wikilink wikiunlink table image media|
fontselect fontsizeselect |
visualchars visualblocks|
searchreplace | 
wikimagic wikisourcecode wikitext wikiupload|
wikitoggle nonbreaking singlelinebreak reference comment template'
)
);

PageForms

Page Forms (known before 2016 as Semantic Forms) is an extension to MediaWiki that allows users to add, edit and query data using forms.

Download

cd extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PageForms.git

In LocalSettings.php:

wfLoadExtension( 'PageForms' );

TimedMediaHandler

Quote: The TimedMediaHandler extension allows you to display audio and video files in wiki pages, using the same syntax as for image files. It includes the Kaltura HTML5 Player and an experimental VideoJS Player. There is support for subtitles and captions (aka Timed Text) and real time stream switching between multiple WebM and other derivatives and many other features. https://www.mediawiki.org/wiki/Extension:TimedMediaHandler

// MediaWiki 1.31 and later
wfLoadExtension( 'TimedMediaHandler' );
// $wgFFmpegLocation = '/usr/bin/ffmpeg'; // Most common ffmpeg path on Linux
$wgMinimumVideoPlayerSize = 400;

This could be better, but right now, on shared hosting, ffmpeg is not supported. Read https://www.infomaniak.com/en/support/faq/286/support-for-video-encoding-libraries-such-as-ffmpeg

SimpleBlogPage

Quote: The SimpleBlogPage extension allows users to create blog posts. New blog posts can be created via "Special:CreateBlogPost". The list of all blog posts by all users is viewable at "Special:ArticlesHome". The page "User_blog:[Username]" lists all of that user's blog posts.

Configuration:

wfLoadExtension( 'SimpleBlogPage' );

BlogPage

This extension adds a blogging system. It relies on three other extensions which are also quite complex. So read the documentation for each ! Not installed so far (some changes look a bit scary).

List of extensions needed:

  1. https://www.mediawiki.org/wiki/Extension:BlogPage
  2. https://www.mediawiki.org/wiki/Extension:SocialProfile
  3. https://www.mediawiki.org/wiki/Extension:VoteNY
  4. https://www.mediawiki.org/wiki/Extension:Comments

Downloads:

cd extensions
git clone ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlogPage   (may not work with your hoster)

or if this does not work, get the distribution for your version and extract

wget <insert the URL>
tar zxf <the file name>

Downloads for Social Profile

Social Profile seems to want a master version and not a tar ball fro the distributor

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/SocialProfile
git checkout REL_35

In addition, you will have to move two directories (avatars and awards) from Social Profile to the image directory

Update

cd <root of installation>
php maintenance/update.php

Configurations:

require_once "$IP/extensions/SocialProfile/SocialProfile.php";

wfLoadExtension( 'VoteNY' );
$wgGroupPermissions['user']['voteny'] = true;

wfLoadExtension( 'Comments' );
$wgGroupPermissions['sysop']['commentadmin'] = true;
$wgGroupPermissions['user']['commentlinks'] = true;

wfLoadExtension( 'BlogPage' );

Transfer files from another wiki

There exist several methods. For a fresh wiki clone, Grabbers tools seems to be the most simple, although they do not seem to be much maintained.

To transfer some files, e.g. a full category, you could use the standard export and import tool to transfer articles. In addition, you will have to export and import the images.

Dumping and importing pages

Dump and retrieve Wikipages. This will not include files. As explained in Help:Export and Help:Import, there are several methods in the Wikipedia galaxy. Manual:Importing XML dumps explains generic exporting and importing.

We will use Special:Export and Special:Import, available for users with sysop permissions.

Step 1:

  • On the first wiki (from which to export), create a list of files to export using a text editor. E.g. grab all the files in a category in the export form. You can repeat the operation. Each time you type in a new category, its pages will be added to the list.
  • If you want to do things manually and in this case use the API to create lists, for example to start with a category, use this (but see the above bullet, this is not needed).
https://edutechwiki.unige.ch/fmediawiki/api.php?action=query&list=categorymembers&cmlimit=500&cmprop=title&format=json&cmtitle=Category:Manuel_de_recherche_en_technologie_éducative

Step 2:

  • Go to Special:Export and paste all your page names into the textbox, making sure there are no empty lines.
  • Click 'Submit query'
  • Save the resulting XML to a file using your browser's save facility.

Step 3:

  • Open the XML file and add a template at the end that you will use to give credits to the original wiki
Replace </text> by something like {{edutechwiki}}
  • Note: if you forgot you also can use a global replace function to do that. E.g. Replace $ (End of file) by {{your template}}

Step 4:

Another method are the grabbing tools

This only would work on a fresh wiki if it does not already have users. Copying the images directory and dumping / restoring the db also would work.,

Grabbing images with grabFile

To install this

  1. Go to the wiki root directory
  2. git clone https://gerrit.wikimedia.org/r/mediawiki/tools/grabbers.git
  3. cd grabbers
  4. php grabFiles.php --info

grabFile is a grabbers tool. It grabs all files and import to the wiki, including the users. So this requires an empty wiki database and may be subject to privacy concerns

To use this script you will have to remove database table prefixes. This is not a problem if your shared hosting gives you several databases.

Use grabFiles.php like this:

php grabFiles.php --url your.wiki/path/api.php --username your name --password XXX

Finally, we decided to use the simple grabImages.php

Grabbing images with grabImage.php

grabImage, grab all the files and put them into a directory. To use this script you will have to remove database table prefixes. This is not a problem if your shared hosting gives you several databases.

Use it like this:

php grabImages.php --url your.wiki/path/api.php --folder your_download_folder
  • As of April 2021, the function is broken, you can replace 'default' by [100,100] near lines 91 and 184

You then can mass import these images

Mass import images

Read:

In LocalSettings.php, make sure that file upload is enabled (it already should)

$wgEnableUploads = true; # Enable uploads

Then, use the ImportImages.php script that sits in the maintenance directory

Will show the possible arguments:

cd maintenance
php importImages.php

Then upload

 php importImages.php ../../../edutechwiki/images-en --comment="Image imported from [http://edutechwiki.unige.ch/en EduTechWiki EN]" --user="Daniel K. Schneider"
 php importImages.php ../../../edutechwiki/images-fr --comment="Image imported from [http://edutechwiki.unige.ch/fr EduTechWiki FR]" --user="Daniel K. Schneider"

By default, existing images will be skipped.

Finally, make sure that the new target wiki supports all the formats and that it accepts the largest file sizes. E.g. you may have to install an extension to import video.

NativeSVGHandler

(provisional, testing it right now - DKS May 21021)

NativeSvgHandler serves SVG directly to clients through image tags, which is not vulnerable to XSS attack. XSS attacks are only relevant when it is accessed directly through original file on the file page, which is neither in the scope nor in control of this extension.

Using this extension requires using clean SVG. Some SVG can be huge and inefficient. Some SVG also can contain executable code,

In LocalSettings.'php

wfLoadExtension( 'NativeSvgHandler' );

Various

HTML export / import

Export by appending ?action=render to the URL, [http://w.arbores.tech/w/index.php?title=Arbores_MediaWiki_installation&action=render

like this].

To import, check https://www.mediawiki.org/wiki/Extension:Html2Wiki (currently broken), else exporter functions in LibreOffice, else export as HTML, then import.

Data management

Install Semantic MediaWiki or Cargo ?

config parameters

We will publish most of our config file once we are done....

 to do