Mediawiki: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| No edit summary | |||
| Line 16: | Line 16: | ||
| * make images point to ../var/images | * make images point to ../var/images | ||
| * in extensions, make links to folders in ~/wiki/var/extensions | * in extensions, make links to folders in ~/wiki/var/extensions | ||
| * make  | * make a link to your ../var/my-logo-image.png file (and make sure $wgLogo matches in LocalSettings.php) | ||
| * run the database update script: | * run the database update script: | ||
| <pre> | <pre> | ||
Revision as of 22:38, 9 December 2014
Install on Ubuntu
- ASSUMPTION: MySQL is already installed
- install the following packages:
apt-get install imagemagick php5-cli php5-fpm php5-mysql
- If you are running nginx under a separate deploy user, you will need to edit /etc/php5/fpm/pool.d/www.confand change the user forlisten.ownerandlisten.group
Upgrade from tarball
- read all Release Notes
- download new tarball from http://www.mediawiki.org/wiki/Download
- unpack in deploy@linode2:wiki/
- copy over LocalSettings.php (which is a pointer to ~/wiki/var/LocalSettings.php)
- make images point to ../var/images
- in extensions, make links to folders in ~/wiki/var/extensions
- make a link to your ../var/my-logo-image.png file (and make sure $wgLogo matches in LocalSettings.php)
- run the database update script:
php maintenance/update.php
Increase the maximum upload file size
- Edit /etc/php5/apache2/php.inito change this line:
; Maximum allowed size for uploaded files. upload_max_filesize = 200M
- restart apache
Allow additional file types for upload
- Edit /etc/mediawiki/LocalSettings.phpand add something like this:
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'doc', 'xls', 'pdf', 'txt');
Add your own logo image
- create a 135x135-pixel logo image and save as png
- copy the png file to /var/lib/mediawiki1.10/skins/common/images
- edit /etc/mediawiki1.10/LocalSettings.phpto include this line:
$wgLogo = "/mediawiki/skins/common/images/mylogo.png";
- log in as the admin user
- edit the wiki page http://localhost/mediawiki/index.php/MediaWiki:Sidebar
Lowercase Page Titles
- This helps you fix the titles of pages like "iPhone" that mediawiki automatically converts to "IPhone".
- install and enable the ParserFunctions extension:
apt-get install mediawiki-extensions (if not already installed) mwenext ParserFunctions.php
- open the page Template:Lowercase_title for editing.
- add this code:
<span>{{DISPLAYTITLE:{{#if:{{NAMESPACE}}|{{NAMESPACE}}:|}}{{lcfirst:{{PAGENAME}}}}}}</span><noinclude>
{{documentation}}
</noinclude>
This can be found on Wikipedia: http://en.wikipedia.org/w/index.php?title=Template:Lowercase_title&action=edit
- add this line to the top of each affected page:
{{lowercase title}}
Syntax highlighting
Use the GeSHi extension included with mediawiki-extensions: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
Custom edit buttons
- download the icons you want to use: http://commons.wikimedia.org/wiki/Mediawiki_edit_toolbar
- download the icons in the images tree and find out where they ended up
- open the MediaWiki:Common.js page on your wiki for editing and add something like this
if (mwCustomEditButtons) {
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "images/2/23/Button_code.png",
     "speedTip": "inline <code> tag",
     "tagOpen": "<code>",
     "tagClose": "</code>",
     "sampleText": "Insert code here"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "images/3/3c/Button_pre.png",
     "speedTip": "block <pre> tag",
     "tagOpen": "<pre>\n",
     "tagClose": "\n</pre>",
     "sampleText": "Insert code here"}
}
- hold down the shift key and hit refresh on the browser to get the page to completely reload
Delete History
- Make sure the php5-clipackage is installed.
- cd to /usr/share/mediawiki/maintenance
- run this:
sudo php deleteOldRevisions.php --delete
Back up the wiki
Use a command like this to dump the wiki database to a flat file:
/usr/bin/mysqldump --opt -u barney -pXXXXXXXX wikidb > /backup/wikidb.sql
May need this command in mysql to get it to work: 
grant lock tables on *.* to barney@localhost; flush privileges;
OLD
Setup
On Ubuntu, install the mediawiki package. May also want mediawiki-extensions and mediawiki-math.
https://help.ubuntu.com/community/MediaWiki
- uncomment alias line of /etc/apache2/conf.d/mediawiki1.10.conf
- restart apache2
- open a browser window and visit http://localhost/mediawiki
- fill out installation form
- move /var/lib/mediawiki1.10/config/LocalSettings.phpto/etc/mediawiki1.10/