May 12, 2015

2 MediaWiki & WYSIWYG & Infobox



Install & configure MediaWikiWYSIWYG + Infobox
UPDATE 26.05.15
This article describes how to configure MediaWiki + WYSIWYG + Infobox on Ubuntu 14.04. 
It was a nightmare to figure this out.



# Install Ubuntu packages.
---------------------------------------------

sudo apt-get install php-apc php5-intl imagemagick php5-cli php5-xcache -y

# Download
---------------------------------------------

cd /var/www/
wget http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.0.tar.gz

# Untar in directory
---------------------------------------------
##If your tar contains a “container folder”?
tar -tf mediawiki-1.24.0.tar.gz | head tar -xvf mediawiki-1.24.0.tar.gz --strip 1 sudo rm -rf mediawiki-1.24.0.tar.gz

# Configure MySQL
---------------------------------------------
mysql -u root -p
use wiki;
drop database wiki;
create database wiki;
use wiki;
CREATE USER admins@localhost;
SET PASSWORD FOR admins@localhost= PASSWORD("password");
GRANT ALL PRIVILEGES ON wiki.* TO admins@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit

# Configure PHP
---------------------------------------------
/etc/php5/php.ini  or  /etc/apache2/php/php.ini

upload_max_filesize = 25M
memory_limit = 128M

# Simple mbstring config in php.ini
&
# Check if mbstring extension is enabled.

php -m | grep mbstring

sudo nano /etc/php5/cli/php.ini

mbstring.language = all
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = UTF-8
mbstring.encoding_translation = On
mbstring.detect_order = UTF-8
mbstring.substitute_character = none;
mbstring.func_overload = 0
mbstring.strict_encoding = Off

# Check if all values are configured.

cat /etc/php5/cli/php.ini | grep mbstring.

# Configure LocalSettings.php
---------------------------------------------
$wgSitename = "LNB wiki";
$wgMetaNamespace = "LNB_wiki";
$wgServer = "http://10.0.10.10";

## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "wiki";
$wgDBuser = "admins";
$wgDBpassword = "password";
$wgShellLocale = "en_US.utf8";


# Localization
---------------------------------------------
change the $wgLanguageCode in LocalSettings.php

$wgLanguageCode = "lv";

# Logo
---------------------------------------------
## logo is expected to be 135 x 135 pixels
## add it manually in LocalSettings.php

sudo nano /var/www/LocalSettings.php

$wgLogo = "{$wgUploadPath}/6/62/mylogo.png";

# Debug
---------------------------------------------
mediawiki.org/wiki/Manual:How_to_debug


How to add WYSIWYG to MediaWiki 1.24.0


# !! Needs proper php.ini configuration [mbstring].


# Download and unzip. PHP already patched.
---------------------------------------------
cd /var/www/extensions/
wget https://www.dropbox.com/s/ihsyjt5rhr5wv8t/WYSIWYG.zip
unzip WYSIWYG.zip
sudo rm -rf WYSIWYG.zip



# Add configuration in LocalSettings.php, below line that say :
# Add more configuration options below
---------------------------------------------
sudo nano /var/www/LocalSettings.php

# Add more configuration options below.
require_once("$IP/extensions/WYSIWYG/WYSIWYG.php");
$wgGroupPermissions['registered_users']['wysiwyg']=true;
$wgGroupPermissions['*']['wysiwyg'] = true;
$wgDefaultUserOptions['cke_show'] = 'wikitexteditor';
$wgDefaultUserOptions['riched_use_toggle'] = true;
$wgDefaultUserOptions['riched_start_disabled'] = false;
$wgDefaultUserOptions['riched_toggle_remember_state'] = true;
$wgDefaultUserOptions['riched_use_popup'] = false;
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
---------------------------------------------


 How to add Infobox to MediaWiki 1.24.0 

# Create CSS page.

Copy CSS from :
https://en.wikipedia.org/wiki/MediaWiki:Common.css  or
https://www.dropbox.com/s/53k6s12dwq6y8gw/Common.css

Paste in :
http://your_wiki/wiki/index.php?title=MediaWiki:Common.css&action=edit

Save.

# Create JS page.

Copy JS from :
https://en.wikipedia.org/wiki/MediaWiki:Common.js  or
https://www.dropbox.com/s/px0kn32zvf149pk/Common.js

Paste in :
http://your_wiki/wiki/index.php?title=MediaWiki:Common.js&action=edit

Save.

# Download extension :
!! Get only latest master version.It has fix for allowed nil values.

cd /var/www/extensions
sudo wget https://extdist.wmflabs.org/dist/extensions/Scribunto-master-0c26a10.tar.gz
or download from my backup link
sudo wget https://www.dropbox.com/s/cwkwqqoyphgrao5/Scribunto-master-0c26a10.tar.gz
sudo tar -xvf Scribunto-master-0c26a10.tar.gz
sudo chown -R www-data:www-data /var/www

# Export Infobox Template from Wikipedia.
# Or download here : Wikipedia-20150526100016.xml

1. Go to  https://secure.wikimedia.org/wikipedia/en/wiki/Special:Export
2. Leave the field for ‘Add pages from category’ empty.
3. Put in big text area :
Template:Infobox
Template:Infobox/doc
Template:Infobox person
Template:Infobox person/doc

4. Check options :  –
* Include only the current revision, not the full history
* Include templates
* Save as file
5. Press the ‘Export’. Download XML file.

# Import Infobox Template to your MediaWiki site.
1. Navigate to :
http://your_wiki/wiki/index.php/Special:Import
2. Select previously downloaded XML file.
3. Upload it.
4. It may take some time - be patient!!

# Add configuration to LocalSettings.php.
# After commented line that say :  Add more configuration options below.

1. sudo vi /var/www/LocalSettings.php
2. Paste in following configuration :

require_once "$IP/extensions/Scribunto/Scribunto.php";
$wgScribuntoDefaultEngine = 'luastandalone';
$wgScribuntoEngineConf['luastandalone']['memoryLimit'] = 209715200;
$wgMaxShellMemory = 204800;

# Test your infobox.

1. Searh for Test in your MediaWiki.
2. Create page Test.
3. Copy in this code :

{{Infobox
|title = Infobox
|header1 = This is Infobox.
|label2 = Configured by
|data2 = Many people in web
|label3 = Web
|data3 = [http://allweb.org allweb.org]
}}

4. Save or preview.

# If all went right, you can be extremely happy. You just saved yourself a week of your life :)










2 comments :

  1. The infobox installation does not work for me. I get error message;

    No Lua interpreter was given in the configuration, and no bundled binary exists for this platform.

    Being a complete noob at this, what do i do?

    ReplyDelete
  2. If some modules are from different versions, then this setup may not work.
    Please use software versions mentioned in article.

    ReplyDelete

Comment: