Mediawiki
Help resources
Announcements of releases and security updates
https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce
Cheatsheet
Install mediawiki on ubuntu
http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Debian_GNU/Linux
Check requirement
php -v mysql -V # capital V
http://localhost/mediawiki setup
- Language
- Welcome to MediaWiki!
- Environmental checks
- Copyright and Terms
- Connect to database - MySQL settings
- Database host: localhost
- Database name: (default is my_wiki)
- Database table prefix: (Leave it empty)
- Database username: root (saved in LocalSettings.php - $wgDBuser, no need to change)
- Database password: (saved in LocalSettings.php - $wgDBpassword)
- Database settings
- Storage engine: InnoDB
- Database character set: Binary
- Name
- Name of wiki: (saved in LocalSettings.php - $wgSitename)
- Administrator account
- Your username: (will be saved in the database)
- Password: (will be saved in the database)
- Email address: (leave it empty)
- Uncheck 'Share data about this installation with MediaWiki developers.'
- Check 'I'm bored already, just install the wiki.'
If we choose 'Ask me more questions', we will get more questions to answer
- Options
- User rights profile: Open wiki/Account creation required/Authorized editors only/Private wiki
- Copyright and license: Creative Commons Attribution/.../No license footer/Select a custom Creative Commons license
- Email settings
- Skins
- Extensions: Gadgets, ImageMap, InputBox, Interwiki, LocalisationUpdate, Nuke, ParserFunctions, PdfHandler, Renameuser, SpamBlacklist, SyntaxHighlight_GeSHi, TitleBlacklist, WikiEditor
- Images and file uploads: Enable file uploads, Logo URL
- Advanced configuration: PHP object caching (APC, APCu, XCache or WinCache)
At the end, we will be notified to download LocalSettings.php file. The new database will be created now.
$ mysql -u root -p -e 'SHOW DATABASES' $ mysql -u root -p -e 'SHOW TABLES' DB_NAME
Enable tex for formula
- http://www.mediawiki.org/wiki/Manual:Enable_TeX
- http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Debian_GNU/Linux
- http://www.siteground.com/tutorials/mediawiki/mediawiki_math.htm
1. The following line is coming from an earlier bookmarked tutorial (not sure if it is needed anymore)
apt-get install mediawiki-math
2. Download Math extension from this link
3. Then you should extract the archive in the "extensions" folder within your MediaWiki installation directory.
4. Next, you need to add the following line to your LocalSettings.php file:
wfLoadExtension( 'Math' );
sudo apt-get install ocaml cd extensions/Math/math make
6. The next step is to execute the "maintenance/update.php" script via shell:
php maintenance/update.php
Done. Go to test it. [Tested on mediawiki 1.22 on Ubuntu 12.04]. Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.
Install mediawiki on debian
Link here [1]
LocalSettings.php
- $wgSitename = "BRB-ArrayTools";
The protocol and server name to use in fully-qualified URLs
- $wgServer = "https://YOURDOMAIN.COM";
- $wgSecureLogin = true;
- $wgLogo = "$wgScriptPath/YOURLOGO.png";
- $wgEnableEmail = false;
Database settings
- $wgDBtype = "mysql";
- $wgDBserver = "localhost";
- $wgDBname = "MYWIKIDB";
- $wgDBuser = "root"; # not the wiki user
- $wgDBpassword = "MYPASSWORD"; # not the password used to log in the mediawiki
Shared memory settings
- $wgMainCacheType = CACHE_ACCEL;
To enable image uploads, make sure the 'images' directory is writable, then set this to true:
- $wgEnableUploads = true;
If you use ImageMagick (or any other shell command) on a Linux server, this will need to be set to the name of an available UTF-8 locale
- $wgShellLocale = "en_US.utf8";
Extensions
- wfLoadExtension( 'SyntaxHighlight_GeSHi' );
- $wgFileExtensions = array('txt','svg','png','gif','jpg','jpeg','doc','xls','mpp','pdf','ppt','tiff','bmp','docx', 'xlsx', 'pptx','ps','odt','ods','odp','odg');
- $wgSVGConverter = 'ImageMagick';
- $wgTrustedMediaFormats = array('text/plain');
- $wgDisableCounters = true;
- $wgLocaltimezone = "America/New_York";
- $wgLocalTZoffset = date("Z") / 60;
- date_default_timezone_set( $wgLocaltimezone );
- require_once("$IP/extensions/Math/Math.php");
- $wgFavicon = "$wgScriptPath/favicon32.ico";
Mediawiki database
MySQL
See the internal MySQL link.
Users
The user information is saved in the 'user' table of the wiki database. The can be seen by looking at the phpMyAdmin page.
Preformatted text with text wrap
Search 'Customized preformatted' on the Formatting page.
<pre style="white-space: pre-wrap; /* CSS 3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* IE 5.5+ */ " > YOUR TEXT </pre>
Color format
Text is red.
<span style="color: red"> Text is red. </span>
Create tables
- http://www.tablesgenerator.com/mediawiki_tables
- Tables with alternative row colors; see an example here.
- The following is an example of a table from the main page of UbuntuGuide.org (link were not modified).
Introduction | Installation | Packages and Repositories |
File Managers | ||||
Desktop Add-ons | Virtual Machines | Games and Entertainment |
Internet |
Auto timeout
php.ini
See
- http://www.mediawiki.org/wiki/Manual_talk:Configuration_settings#Auto-Logout
- https://www.mediawiki.org/wiki/Manual:FAQ#…do_I_get_logged_out_constantly?
- https://superuser.com/questions/204905/mediawiki-increase-session-timeout
On ubuntu, change /etc/php5/apache2/php.ini.
session.cache_expire=180 session.gc_maxlifetime = 1440 session.cookie_lifetime = 1440
After modifying php.ini, you need to restart apache. sudo /etc/init.d/apache2 restart
'keep me logged in' option
Make sure to check this option on the login screen.
- https://www.mediawiki.org/wiki/%22Keep_me_logged_in%22_extended_to_one_year/en
- https://www.mediawiki.org/wiki/Manual:$wgCookieExpiration
- https://www.mediawiki.org/wiki/Manual:$wgExtendedLoginCookieExpiration
- https://www.mediawiki.org/wiki/Help:Logging_in
- https://webmasters.stackexchange.com/questions/79907/how-to-set-the-keep-me-logged-in-box-to-true-in-mediawiki-specialuserlogin
Errors and symptoms
https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms
Colored font
See https://meta.wikimedia.org/wiki/Wiki_color_formatting_help for a list of common used colors.
<span style="color: red"> ..... </span>
Syntax highlight
Use the "syntaxhighlight" (for newer versions of mediawiki) or source (for older versions) tag for inline/non-inline syntax highlight. For example,
library(d3Network) Source <- c("A", "A", "A", "A", "B", "B", "C", "C", "D") Target <- c("B", "C", "D", "J", "E", "F", "G", "H", "I") NetworkData <- data.frame(Source, Target) d3SimpleNetwork(NetworkData, height = 800, width = 1024, file="tmp.html")
can be created by
<source lang="rsplus"> library(d3Network) Source <- c("A", "A", "A", "A", "B", "B", "C", "C", "D") Target <- c("B", "C", "D", "J", "E", "F", "G", "H", "I") NetworkData <- data.frame(Source, Target) d3SimpleNetwork(NetworkData, height = 800, width = 1024, file="tmp.html") </source>
Note for some reason, when I use the syntaxhighlight tag (use syntaxhighlight instead of source tag), 'r' is not recognized on my mediawiki 1.22 although 'bash' works.
This syntax highlight extension package https://github.com/artemklevtsov/MediaWiki-SyntaxHighlight seems more complete. It supports markdown, cpp, r, bash, cxx, ... (no Fortran?) languages. But highlight.js library supports even more.
favicon
Move favicon.ico to the mediawiki folder and include the following line in the <LocalSettings.php>
$wgFavicon = "$wgScriptPath/favicon.ico";
Note that the attribute of the ico file has to be at least 644. If not, just run the following line
chmod 644 favicon.ico
To download a favicon, use the approach here. For example, to download the favicon icon from https://wiki.ubuntu.com/ website, we just open the url https://wiki.ubuntu.com/favicon.ico.
The approach works is based on the assumption that the favicon.ico file name is not changed and usually located under the website root directory.
Change skin
- https://www.mediawiki.org/wiki/Manual:Skins
- http://www.inmotionhosting.com/support/edu/mediawiki/change-media-wiki-appearance/changing-mediawiki-skins
- https://www.hostknox.com/tutorials/mediawiki/skins
Change user's password
https://www.mediawiki.org/wiki/Manual:Resetting_passwords
tackle slowness when saving pages
- https://www.mediawiki.org/wiki/Manual:Performance_tuning
- How to make MediaWiki fast
- Alternative PHP Cache (php-apc)
In summary:
1. Install php-apc. sudo apt-get install php-apc
2. nano LocalSettings.php. Change $wgMainCacheType from CACHE_NONE to CACHE_ACCEL.
$wgMainCacheType = CACHE_ACCEL;
3. (optional) sudo /etc/init.d/apache2 reload
Article size and its limit
By default the size is 2048 KB. You can modify it in LocalSettings.php.
$wgMaxArticleSize = 100; # 100 KB
To view what the size of the current (and other revisions) of the page is, open the page on the frontend and view its history.
Extensions
Google Analytics
http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration#Installation
Math
http://www.mediawiki.org/wiki/Extension:Math