Arbores MediaWiki installation: Difference between revisions
m (→Introduction) |
mNo edit summary |
||
Line 23: | Line 23: | ||
Edit Localsettings.php and verify the URL (this can change later, e.g. if you move to a subdomain | Edit Localsettings.php and verify the URL (this can change later, e.g. if you move to a subdomain | ||
$wgServer = "http://w.arbores.tech"; | $wgServer = "http://w.arbores.tech"; | ||
=== Enable File upload === | === Enable File upload === | ||
Line 34: | Line 33: | ||
</source> | </source> | ||
== Change permission == | === Change permission === | ||
By default, anyone can create an account and contribute. To change: | By default, anyone can create an account and contribute. To change: | ||
Line 67: | Line 66: | ||
Since they conflict with some heavy maintenance scripts | 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' | From the dropdown 'With selected:' choose 'Replace table prefix' | ||
Set from- | Set from->to replacement. | ||
DONE | DONE | ||
=== Short URL === | |||
== Short URL == | |||
On the hosting side, you will need a subdomain if possible (not necessary though) | On the hosting side, you will need a subdomain if possible (not necessary though) | ||
Line 80: | Line 78: | ||
'''Step 1: Add a subdomain''' | '''Step 1: Add a subdomain''' | ||
For Infomaniak hosting: Read | For Infomaniak hosting: Read | ||
* [https://www.infomaniak.com/fr/support/faq/2036/ajouter-un-site-ou-un-sous-domaine-avec-un-fichier-htaccess Ajouter un site ou un sous-domaine avec un fichier .htaccess] | * [https://www.infomaniak.com/fr/support/faq/2036/ajouter-un-site-ou-un-sous-domaine-avec-un-fichier-htaccess Ajouter un site ou un sous-domaine avec un fichier .htaccess] | ||
* [https://www.infomaniak.com/fr/support/faq/1946/ajouter-un-domaine-alias-a-un-site-web Ajouter un (domaine) alias à un site Web] | * [https://www.infomaniak.com/fr/support/faq/1946/ajouter-un-domaine-alias-a-un-site-web Ajouter un (domaine) alias à un site Web] | ||
Line 86: | Line 84: | ||
'''Step 2: Fix the site URL''' (if it was installed with the provider's "manager") | '''Step 2: Fix the site URL''' (if it was installed with the provider's "manager") | ||
* Read [https://www.infomaniak.com/fr/support/faq/2278/applications-web-modifier-ladresse-web-url-changer-le-nom-de-domaine Applications Web: modifier l'adresse Web (URL) / Changer le nom de domaine] | * Read [https://www.infomaniak.com/fr/support/faq/2278/applications-web-modifier-ladresse-web-url-changer-le-nom-de-domaine Applications Web: modifier l'adresse Web (URL) / Changer le nom de domaine] | ||
* Infomaniak: Manager - | * Infomaniak: Manager -> Applications -> w (cliquer sur "configurer") | ||
'''Step 3: Add rewrite rules for the subdomain''' | '''Step 3: Add rewrite rules for the subdomain''' | ||
Line 118: | Line 116: | ||
</source> | </source> | ||
== | == 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. | An installed wiki comes with preinstalled extensions that you can enable. However, some of these do not work on shared hosting, e.g. | ||
Line 135: | Line 133: | ||
click on the PHP Tab | click on the PHP Tab | ||
put exect, shell_exec, etc. on. | put exect, shell_exec, etc. on. | ||
=== CategoryTree === | === CategoryTree === | ||
wfLoadExtension ('CategoryTree'); | wfLoadExtension ('CategoryTree'); | ||
=== Cite === | === Cite === | ||
Line 149: | Line 145: | ||
wfLoadExtension ('Cite'); | wfLoadExtension ('Cite'); | ||
=== CiteThisPage === | === CiteThisPage === | ||
wfLoadExtension ('CiteThisPage'); | wfLoadExtension ('CiteThisPage'); | ||
=== CodeEditor === | === CodeEditor === | ||
(to test/do) | (to test/do) | ||
wfLoadExtension ('CodeEditor'); | wfLoadExtension ('CodeEditor'); | ||
=== InputBox === | === InputBox === | ||
(to test/do) | (to test/do) | ||
wfLoadExtension ('InputBox'); | wfLoadExtension ('InputBox'); | ||
=== MultimediaViewer === | === MultimediaViewer === | ||
(to test/do) | (to test/do) | ||
wfLoadExtension ('MultimediaViewer'); | wfLoadExtension ('MultimediaViewer'); | ||
=== ParserFunctions === | === ParserFunctions === | ||
Adds some extra language elements to the parser. Needed for some templates. | Adds some extra language elements to the parser. Needed for some templates. | ||
wfLoadExtension ('ParserFunctions'); | wfLoadExtension ('ParserFunctions'); | ||
=== ConfirmEdit === | === ConfirmEdit === | ||
(to test/do) | (to test/do) | ||
Line 232: | Line 222: | ||
chmod a+x /path/to/extensions/SyntaxHighlight_GeSHi/pygments/pygmentize | chmod a+x /path/to/extensions/SyntaxHighlight_GeSHi/pygments/pygmentize | ||
In Local Settings, add: | In Local Settings, add: | ||
wfLoadExtension( 'SyntaxHighlight_GeSHi' ); | wfLoadExtension( 'SyntaxHighlight_GeSHi' ); | ||
=== TextExtracts === | === TextExtracts === | ||
wfLoadExtension ('TextExtracts'); | wfLoadExtension ('TextExtracts'); | ||
Line 247: | Line 235: | ||
wfLoadExtension ('WikiEditor'); | wfLoadExtension ('WikiEditor'); | ||
== Other extensions == | |||
== TinyMCE Visual Editor == | Some other crucial extensions are not included with the distribution we found with our provider | ||
=== TinyMCE Visual Editor === | |||
The standard Wysiwyg editor cannot be installed on a hosted service since it requires node.js (a JavaScript server) | The standard Wysiwyg editor cannot be installed on a hosted service since it requires node.js (a JavaScript server) | ||
Line 257: | Line 247: | ||
cd extensions | cd extensions | ||
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/TinyMCE | git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/TinyMCE | ||
In LocalSettings.php, add: | In LocalSettings.php, add: | ||
require_once "$IP/extensions/TinyMCE/TinyMCE.php"; | require_once "$IP/extensions/TinyMCE/TinyMCE.php"; | ||
$wgTinyMCEEnabled = true; | $wgTinyMCEEnabled = true; | ||
Patch to disable the WikiEditor from adding its bar on top (read [https://www.mediawiki.org/wiki/Extension:TinyMCE#Configuration this] and [https://gerrit.wikimedia.org/r/#/c/389499/4/WikiEditorHooks.php this small patch] | Patch to disable the WikiEditor from adding its bar on top (read [https://www.mediawiki.org/wiki/Extension:TinyMCE#Configuration this] and [https://gerrit.wikimedia.org/r/#/c/389499/4/WikiEditorHooks.php this small patch] | ||
Line 270: | Line 258: | ||
return true; | return true; | ||
} | } | ||
=== Interwiki === | |||
The The '''Interwiki''' extension adds the "Special:Interwiki" page to[https://www.mediawiki.org/wiki/Special:MyLanguage/MediaWiki MediaWiki]<p> to view and edit the</p>[https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Interwiki_table interwiki] | |||
table, and a log of any actions made with it.<pre>cd extensions/ | |||
git clone <span class="plainlinks">[https://gerrit.wikimedia.org/r/mediawiki/extensions/Interwiki.git https://gerrit.wikimedia.org/r/mediawiki/extensions/Interwiki.git]</span> | |||
</pre> | |||
== Transfer files from another wiki == | == Transfer files from another wiki == | ||
Line 279: | Line 273: | ||
We will use <code>Special:Export and Special:Import</code>, available for users with sysop permissions. | We will use <code>Special:Export and Special:Import</code>, available for users with sysop permissions. | ||
Step 1: | 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 also could use the API to create lists, for example start with categories. | * 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 also could use the API to create lists, for example start with categories. | ||
: 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 | : 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 | ||
Line 289: | Line 283: | ||
Step 3: | Step 3: | ||
* Go to [[Special:Import]] | * Go to[[Special:Import]] | ||
* Import the XML file | * Import the XML file | ||
Line 308: | Line 302: | ||
php grabFiles.php --url your.wiki/path/api.php --username your name --password XXX | php grabFiles.php --url your.wiki/path/api.php --username your name --password XXX | ||
To use some of these scripts you will have to remove database table prefixes. This is not a problem if your shared hosting gives you several databases. | To use some of these scripts you will have to remove database table prefixes. This is not a problem if your shared hosting gives you several databases. | ||
Line 317: | Line 310: | ||
'''grabImage''', grab all the files and put them into a directory. Use it like this: | '''grabImage''', grab all the files and put them into a directory. Use it like this: | ||
php grabImages.php --url your.wiki/path/api.php | php grabImages.php --url your.wiki/path/api.php | ||
* As of April 2021, the function is broken, you can replace <nowiki>'default' by [100,100]</nowiki> near lines 91 and 184 | * As of April 2021, the function is broken, you can replace <nowiki>'default' by [100,100]</nowiki> near lines 91 and 184 | ||
Revision as of 16:28, 9 April 2021
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.
Important help pages for mediawiki
- Configuration settings list
- MediaWiki FAQ
- MediaWiki release mailing list
- Localise MediaWiki for your language
- Learn how to combat spam on your wiki
- Consult the User's Guide for information on using the wiki software.
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";
Enable File upload
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;
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
- Ajouter un site ou un sous-domaine avec un fichier .htaccess
- Ajouter un (domaine) alias à un site Web
Step 2: Fix the site URL (if it was installed with the provider's "manager")
- Read Applications Web: modifier l'adresse Web (URL) / Changer le nom de domaine
- Infomaniak: Manager -> Applications -> w (cliquer sur "configurer")
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]
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, e.g.
- 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 onA dvanced parameters click on the PHP Tab put exect, shell_exec, etc. on.
CategoryTree
wfLoadExtension ('CategoryTree');
Cite
https://www.mediawiki.org/wiki/Extension:Cite
Makes <ref> </ref> for citations available.
Read Help:Cite
wfLoadExtension ('Cite');
CiteThisPage
wfLoadExtension ('CiteThisPage');
CodeEditor
(to test/do)
wfLoadExtension ('CodeEditor');
InputBox
(to test/do)
wfLoadExtension ('InputBox');
MultimediaViewer
(to test/do)
wfLoadExtension ('MultimediaViewer');
ParserFunctions
Adds some extra language elements to the parser. Needed for some templates.
wfLoadExtension ('ParserFunctions');
ConfirmEdit
(to test/do) wfLoadExtension ('ConfirmEdit');
Gadgets
wfLoadExtension ('Gadgets');
ImageMap
wfLoadExtension ('ImageMap');
Lockdown
wfLoadExtension ('Lockdown');
PageImages
wfLoadExtension ('PageImages');
Interwiki
wfLoadExtension ('Interwiki');
LocalisationUpdate
wfLoadExtension ('LocalisationUpdate');
Nuke
wfLoadExtension ('Nuke');
OATHAuth
wfLoadExtension ('OATHAuth');
Poem
wfLoadExtension ('Poem');
Scribunto
wfLoadExtension ('Scribunto');
TemplateData
wfLoadExtension ('TemplateData');
PdfHandler
wfLoadExtension ('PdfHandler');
Renameuser
wfLoadExtension ('Renameuser');
ReplaceText
wfLoadExtension ('ReplaceText');
SecureLinkFixer
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
wfLoadExtension ('TextExtracts');
VisualEditor
wfLoadExtension ('VisualEditor');
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
The standard Wysiwyg editor cannot be installed on a hosted service since it requires node.js (a JavaScript server)
Install with git:
cd extensions git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/TinyMCE
In LocalSettings.php, add:
require_once "$IP/extensions/TinyMCE/TinyMCE.php"; $wgTinyMCEEnabled = true;
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; }
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.
cd extensions/ git clone <span class="plainlinks">[https://gerrit.wikimedia.org/r/mediawiki/extensions/Interwiki.git https://gerrit.wikimedia.org/r/mediawiki/extensions/Interwiki.git]</span>
Transfer files from another wiki
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 also could use the API to create lists, for example start with categories.
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:
- Go toSpecial:Import
- Import the XML file
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
There exist several methods. The following, based on Grabbers tools, seems to be the most simple
grabFile, a grabbers tool 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
Use grabFiles.php like this:
php grabFiles.php --url your.wiki/path/api.php --username your name --password XXX
To use some of these scripts you will have to remove database table prefixes. This is not a problem if your shared hosting gives you several databases.
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. Use it like this:
php grabImages.php --url your.wiki/path/api.php
- As of April 2021, the function is broken, you can replace 'default' by [100,100] near lines 91 and 184
List of extensions enabled with config parameters
to do