MediaWiki

From Indie IT Wiki
Jump to: navigation, search

For details on the formatting schema on this wiki see here.

HOWTO: Enable Hit Page Counter Hits

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

HOWTO: EMBED VIDEO

Full guide here.

HOWTO: Update MediaWiki Software

This will update the whole mediawiki software and overwrite the files located in a subdirectory called 'wiki'. Please adjust according to your web hosting! This example is for 1&1...

cd /path/to/web/hosting/
tar -czvf wiki.tar.gz wiki/
wget http://download.wikimedia.org/mediawiki/1.25/mediawiki-1.25.6.tar.gz
tar -xzvf mediawiki-1.25.6.tar.gz -C wiki/ --strip-components=1
cd wiki/maintenance/
php6 update.php

This example is for Amazon EC2 running Ubuntu Linux 14.04 LTS...

cd /var/www/domain.com
tar -czvf wiki.tar.gz html/
wget http://download.wikimedia.org/mediawiki/1.25/mediawiki-1.25.6.tar.gz
tar -xzvf mediawiki-1.25.6.tar.gz -C html/ --strip-components=1
cd html/maintenance/
php update.php

If you receive this error...

Error: your composer.lock file is not up to date, run "composer update" to install newer dependencies

...then you need to install the 'composer' binary...

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
cd /var/www/domain.com/html/
composer install
composer update

...and now you can update the Wikimedia software...

cd html/maintenance/
php update.php

Thanks - http://www.cyberciti.biz/faq/how-to-install-composer-on-debian-ubuntu-linux-server

HOWTO: Remove External Link Icons

https://en.wikipedia.org/wiki/Help:External_link_icons

div#content a.external 
{
   background:none !important;
   padding: 0px !important;
}

HOWTO: Change CSS Colours

nano skins/MonoBook/main.css
pre, .mw-code {
   color: #FFFFFF;
   background-color: #364554;
   border: none;
   padding: 0.5em;
   white-space: pre-wrap;
   word-wrap: break-word;
}
.postedit {
   display: none;
}
pre a.external {
   color: #FFFFFF;
}
pre a.external.free {
   color: #FFFFFF;
}
pre a.external.free:visited {
   color: #FFFFFF;
}
a.external.free {
   background-image: none;
}
pre a:visited {
   color: #FFFFFF;
}
div#content a.external 
{
   background:none !important;
   padding: 0px !important;
}

HOWTO: Installation In Ubuntu Server

https://help.ubuntu.com/community/MediaWiki

Enable Auto Complete In Search Box

http://www.mediawiki.org/wiki/Manual:Enabling_autocomplete_in_search_box

WPtouch Mobile Skin

http://www.memorydeleted.com/?p=396

Simple Mobile Skin Auto Change

http://www.mediawiki.org/wiki/Extension:MobileFrontend

Using Lists & Tables

http://www.packtpub.com/article/using-tables-and-lists-with-mediawiki

Changing User Password Via Command Line

cd /var/www/localhost/htdocs/mediawiki/maintenance/
php changePassword.php --user=jsmith --password=myPas5w0rd

Restrict Editing Of All Pages

$wgGroupPermissions['*']['edit'] = false;

Wrapping Text In Code Lines

<pre style="white-space:normal;"> your long line of text here... </pre>

MediaWiki ShortURL Builder

~/.htaccess

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

~/LocalSettings.php

# short urls tweak
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

https://www.mediawiki.org/wiki/Manual:Short_URL

http://shorturls.redwerks.org/

Lock Down Wiki

Disallow account creation (add the following to the end of LocalSettings.php)...

$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['user']['createaccount'] = false;
$wgGroupPermissions['sysop']['createaccount'] = false;

Disallow reading and writing...

$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['read'] = false;

Links:

http://en.wikibooks.org/wiki/MediaWiki_Administrator%27s_Handbook/Page_Protection

http://www.mediawiki.org/wiki/Manual:Preventing_access

HOWTO: Add Extra Buttons To Edit Page

http://www.mediawiki.org/wiki/Customizing_edit_toolbar#How_do_I_add_more_buttons_on_the_edit_page.3F