Difference between revisions of "MediaWiki"

From Linuxintro
(tramadol er , http://www.answerbag.com/profile/1616708 ways to ease tramadol withdrawal , http://www.thoughts.com/tesimppunklows/profile TRAMADOL Hcl Acetaminophen 37.5 325 Mg , http://www.thoughts.co)
 
(27 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 
Mediawiki is a wiki software used by wikipedia and this wiki.
 
Mediawiki is a wiki software used by wikipedia and this wiki.
  
KcH5eg  <a href="http://fduxukykjnog.com/">fduxukykjnog</a>, [url=http://omzqnxxvfcup.com/]omzqnxxvfcup[/url], [link=http://rwqhtrjteisq.com/]rwqhtrjteisq[/link], http://phomncxdnpcg.com/
+
= Setup =
 +
* [[Set up mediawiki with SUSE]]
  
tramadol saturday delivery , http://labs.divx.com/node/130121 Can TRAMADOL Help Colitis , http://www.canalmataro.com/ff/user/view.php?id=2342 tramadol for my dog , http://heatherbianchi.com/profile/ezequielalbert tramadol online consultant , http://dailybooth.com/skyroginso order online tramadol prescriptions , http://www.mychemicalromance.com/blogs/ningsiheacas tramadol hcl 50 mg tablet , http://labs.divx.com/node/129881 Where To Buy TRAMADOL Uk , http://www.thoughts.com/ulicvaba/profile info on 50 mg tramadol , http://www.formspring.me/diehostpet tramadol prescription more drug uses , http://gravatar.com/lavonnaangelita tramadol forums , http://labs.divx.com/node/130081 Usa TRAMADOL No Prescription ,
+
= Configuration =
 +
For all configuration options in LocalSettings see http://www.mediawiki.org/wiki/Category:MediaWiki_configuration_settings.
  
tramadol er , http://www.answerbag.com/profile/1616708 ways to ease tramadol withdrawal , http://www.thoughts.com/tesimppunklows/profile TRAMADOL Hcl Acetaminophen 37.5 325 Mg , http://www.thoughts.com/deseljudgvi/profile Purchase TRAMADOL Without A Rx Overnight Shipping , http://www.formspring.me/ssansurli Dosage Of TRAMADOL For Cats , http://www.formspring.me/temlilethb Use Of TRAMADOL And Heart Disease , http://folkbanpurchmy.bloginternet.net/The-first-blog-b1/Tramadol-Acetaminophen-Hcl-b1-p2.htm TRAMADOL Hcl Acetaminophen Par , http://raetubigback.sosblog.com/The-first-blog-b1/Where-Buy-Tramadol-b1-p2.htm Where To Buy TRAMADOL In Internet , http://www.canalmataro.com/ff/user/view.php?id=2387 St Johns Wort And TRAMADOL , http://www.formspring.me/teohaso Addicted To TRAMADOL During Pregnancy , http://horbaffletzcrit.gamerdna.com/bio/ Buy TRAMADOL Pharmacy Online India ,
+
== Disable anonymous editing ==
 +
 
 +
To disable anonymous editing, edit LocalSetting.php. Below the line containing $wgDBpassword, add the following lines:
 +
$wgGroupPermissions['*'    ]['edit']            = false;
 +
$wgGroupPermissions['*'    ]['createpage']      = false;
 +
$wgGroupPermissions['*'    ]['createtalk']      = false;
 +
These lines disallow creating and editing pages for all groups (*), it remains allowed only for logged-in users.
 +
 
 +
== Allowing pictures ==
 +
 
 +
If you are the only editor of a wiki (otherwise [[security]] flaws!) and want to allow pictures from all over the web, add the following line to the LocalSettings.php
 +
$wgAllowExternalImages = true;
 +
below the line
 +
require_once( "includes/DefaultSettings.php" );
 +
 
 +
== Allow all html tags ==
 +
 
 +
If you are the only editor of a wiki (otherwise [[security]] flaws!) and want to allow any html code in your wiki, read and follow http://www.mediawiki.org/wiki/Manual:%24wgRawHtml
 +
 
 +
== Changing the sidebar ==
 +
 
 +
This is done on the [[application]] level; just edit [[Mediawiki:Sidebar]].
 +
 
 +
== beautify URL ==
 +
 
 +
By default, mediawiki's main page is in http://whatever/index.php/Main_Page. To get rid of "index.php", read and follow http://www.mediawiki.org/wiki/Manual:Short_URL
 +
 
 +
== allow searching for short terms ==
 +
On a default installation of mediawiki you cannot search for words shorter than 4 characters. So a search for "foo" will not yield results. To change this, read and follow [[allow searching for short terms in mediawiki]].
 +
 
 +
== introduce path-based navigation ==
 +
Want an article '''foo/bar''' to have a heading that links to '''foo'''?
 +
http://www.mediawiki.org/wiki/Help:Subpages or http://www.mediawiki.org/wiki/Extension:BrettCrumbs
 +
 
 +
== Namespaces ==
 +
Namespaces in Mediawiki allow you to limit searches within a group of articles, the namespace. For setting them up, see http://www.mediawiki.org/wiki/Manual:Using_custom_namespaces.
 +
 
 +
== CSS ==
 +
See [[MediaWiki:Common.css]] and [[MediaWiki:Monobook.css]].
 +
 
 +
== Google Analytics ==
 +
Google Analytics allows you to track how many visitors from where visited your site when, remained how long and much more. The only thing you have to do is to register your site with http://www.google.com/analytics and put a JavaScript code snippet into your page. This code snipped should be directly above the
 +
</head>
 +
tag in your page's HTML code.
 +
 
 +
=== MediaWiki 1.19.1 ===
 +
To get google analytics included with MediaWiki 1.19.1, paste the code snippet you got from google into includes/OutputPage.php like this:
 +
 
 +
linuxintro:/includes # diff -rup OutputPage-0.php OutputPage.php
 +
--- OutputPage-0.php    2012-09-03 07:50:46.000000000 +0000
 +
+++ OutputPage.php      2012-09-03 07:58:01.000000000 +0000
 +
@@ -2411,6 +2411,19 @@ $templates
 +
 +
                $closeHead = Html::closeElement( 'head' );
 +
                if ( $closeHead ) {
 +
+$ret.="<script type=\"text/javascript\">
 +
+
 +
+  var _gaq = _gaq || [];
 +
+  _gaq.push(['_setAccount', ''''UA-15123456-1'''']);
 +
+  _gaq.push(['_trackPageview']);
 +
+
 +
+  (function() {
 +
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 +
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 +
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 +
+  })();
 +
+
 +
+</script>\
 +
";
 +
                        $ret .= "$closeHead\
 +
";
 +
                }
 +
 
 +
Remember to replace the bold account number above by yours.
 +
 
 +
=== MediaWiki 1.16 ===
 +
To get this done with mediawiki 1.16, paste the code snippet you got from google into includes/OutputPage.php like this:
 +
<pre>
 +
linuxintro:/includes # diff -rup OutputPage-0.php OutputPage.php
 +
--- OutputPage-0.php    2012-08-18 22:13:13.000000000 +0000
 +
+++ OutputPage.php      2012-08-18 22:18:08.000000000 +0000
 +
@@ -2140,6 +2140,19 @@ class OutputPage {
 +
                if ($wgUseTrackbacks && $this->isArticleRelated())
 +
                        $ret .= $this->getTitle()->trackbackRDF();
 +
 +
+$ret.="<script type=\"text/javascript\">
 +
+
 +
+  var _gaq = _gaq || [];
 +
+  _gaq.push(['_setAccount', 'UA-15123456-1']);
 +
+  _gaq.push(['_trackPageview']);
 +
+
 +
+  (function() {
 +
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 +
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 +
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 +
+  })();
 +
+
 +
+</script>\
 +
";
 +
                $ret .= "</head>\
 +
";
 +
 +
                $bodyAttrs = array();
 +
</pre>
 +
 
 +
Remember to replace the account number (UA-15123456-1 in the above example) by yours.
 +
 
 +
== FaceBook like buttons ==
 +
To get FaceBook's "like" buttons below your mediawiki pages, find the following line in skins/MonoBook.php:
 +
<div id="footer"<?php $this->html('userlangattributes') ?>>
 +
below it add the line
 +
 
 +
=== MediaWiki 1.19 ===
 +
Same as 1.16, but use $this->html('title')
 +
 
 +
=== MediaWiki 1.16 ===
 +
<pre>
 +
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($skin->mTitle->getFullURL()); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:40px"></iframe>
 +
</pre>
 +
 
 +
== Captchas ==
 +
Want to open up your wiki to human beings, but not to bots? Use the [https://www.mediawiki.org/wiki/Extension:ConfirmEdit ConFirmEdIt plugin].
 +
 
 +
== Review ==
 +
Want to review changes before they are public? Use the [http://www.mediawiki.org/wiki/Extension:FlaggedRevs FlaggedRevs extension].
 +
 
 +
= Backup =
 +
If you want to do a backup of your mediawiki installation, you need to backup the articles, the programs, the configuration files and the media file (like pictures etc.).
 +
 
 +
== Articles ==
 +
On the application layer:
 +
php maintenance/dumpBackup.php --full >backup.xml
 +
On the database layer, if your database name is ''wikidb'':
 +
mysqldump ''wikidb'' >wikidbdump.sql
 +
 
 +
== Media files ==
 +
See http://www.kefk.org/webworking/mediawiki/backup_und_restore.
  
 
= Update =
 
= Update =
Line 11: Line 149:
  
 
= Migrate =
 
= Migrate =
 +
== between computers ==
 
This describes how to migrate a wiki from one computer to another. It copies the mediawiki software and the content. Let's assume your mediawiki is running on computer ''earth'' and you want to have it running on ''mars''.
 
This describes how to migrate a wiki from one computer to another. It copies the mediawiki software and the content. Let's assume your mediawiki is running on computer ''earth'' and you want to have it running on ''mars''.
 
* copy your mediawiki software
 
* copy your mediawiki software
Line 21: Line 160:
 
* all pages are imported! Look for Main_Page's history, you will find an addtional version containing earth's actual main page.
 
* all pages are imported! Look for Main_Page's history, you will find an addtional version containing earth's actual main page.
 
* you may have to adjust upload_max_filesize in /etc/php5/apache2
 
* you may have to adjust upload_max_filesize in /etc/php5/apache2
 +
 +
== between databases ==
 +
* [[migrating mediawiki from MySQL to SQLite]]
  
 
= Extensions =
 
= Extensions =
Line 31: Line 173:
 
* http://www.thepetwiki.com/wiki/Dogs  --  example for facebook like buttons in mediawiki
 
* http://www.thepetwiki.com/wiki/Dogs  --  example for facebook like buttons in mediawiki
 
* http://renareich.com/2010/04/27/adding-facebook-like-mediawiki/
 
* http://renareich.com/2010/04/27/adding-facebook-like-mediawiki/
 
= Comments =
 
<comments />{{:{{TALKSPACE}}:{{PAGENAME}}}}
 

Latest revision as of 21:46, 16 January 2021

Mediawiki is a wiki software used by wikipedia and this wiki.

Setup

Configuration

For all configuration options in LocalSettings see http://www.mediawiki.org/wiki/Category:MediaWiki_configuration_settings.

Disable anonymous editing

To disable anonymous editing, edit LocalSetting.php. Below the line containing $wgDBpassword, add the following lines:

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

These lines disallow creating and editing pages for all groups (*), it remains allowed only for logged-in users.

Allowing pictures

If you are the only editor of a wiki (otherwise security flaws!) and want to allow pictures from all over the web, add the following line to the LocalSettings.php

$wgAllowExternalImages = true;

below the line

require_once( "includes/DefaultSettings.php" );

Allow all html tags

If you are the only editor of a wiki (otherwise security flaws!) and want to allow any html code in your wiki, read and follow http://www.mediawiki.org/wiki/Manual:%24wgRawHtml

Changing the sidebar

This is done on the application level; just edit Mediawiki:Sidebar.

beautify URL

By default, mediawiki's main page is in http://whatever/index.php/Main_Page. To get rid of "index.php", read and follow http://www.mediawiki.org/wiki/Manual:Short_URL

allow searching for short terms

On a default installation of mediawiki you cannot search for words shorter than 4 characters. So a search for "foo" will not yield results. To change this, read and follow allow searching for short terms in mediawiki.

introduce path-based navigation

Want an article foo/bar to have a heading that links to foo? http://www.mediawiki.org/wiki/Help:Subpages or http://www.mediawiki.org/wiki/Extension:BrettCrumbs

Namespaces

Namespaces in Mediawiki allow you to limit searches within a group of articles, the namespace. For setting them up, see http://www.mediawiki.org/wiki/Manual:Using_custom_namespaces.

CSS

See MediaWiki:Common.css and MediaWiki:Monobook.css.

Google Analytics

Google Analytics allows you to track how many visitors from where visited your site when, remained how long and much more. The only thing you have to do is to register your site with http://www.google.com/analytics and put a JavaScript code snippet into your page. This code snipped should be directly above the

</head>

tag in your page's HTML code.

MediaWiki 1.19.1

To get google analytics included with MediaWiki 1.19.1, paste the code snippet you got from google into includes/OutputPage.php like this:

linuxintro:/includes # diff -rup OutputPage-0.php OutputPage.php 
--- OutputPage-0.php    2012-09-03 07:50:46.000000000 +0000
+++ OutputPage.php      2012-09-03 07:58:01.000000000 +0000
@@ -2411,6 +2411,19 @@ $templates

                $closeHead = Html::closeElement( 'head' );
                if ( $closeHead ) {
+$ret.="<script type=\"text/javascript\">
+
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-15123456-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+
+</script>\
";
                        $ret .= "$closeHead\
";
                }

Remember to replace the bold account number above by yours.

MediaWiki 1.16

To get this done with mediawiki 1.16, paste the code snippet you got from google into includes/OutputPage.php like this:

linuxintro:/includes # diff -rup OutputPage-0.php OutputPage.php 
--- OutputPage-0.php    2012-08-18 22:13:13.000000000 +0000
+++ OutputPage.php      2012-08-18 22:18:08.000000000 +0000
@@ -2140,6 +2140,19 @@ class OutputPage {
                if ($wgUseTrackbacks && $this->isArticleRelated())
                        $ret .= $this->getTitle()->trackbackRDF();
 
+$ret.="<script type=\"text/javascript\">
+
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-15123456-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+
+</script>\
";
                $ret .= "</head>\
";
 
                $bodyAttrs = array();

Remember to replace the account number (UA-15123456-1 in the above example) by yours.

FaceBook like buttons

To get FaceBook's "like" buttons below your mediawiki pages, find the following line in skins/MonoBook.php:

<div id="footer"<?php $this->html('userlangattributes') ?>>

below it add the line

MediaWiki 1.19

Same as 1.16, but use $this->html('title')

MediaWiki 1.16

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($skin->mTitle->getFullURL()); ?>&layout=standard&show_faces=false&width=450" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:40px"></iframe>

Captchas

Want to open up your wiki to human beings, but not to bots? Use the ConFirmEdIt plugin.

Review

Want to review changes before they are public? Use the FlaggedRevs extension.

Backup

If you want to do a backup of your mediawiki installation, you need to backup the articles, the programs, the configuration files and the media file (like pictures etc.).

Articles

On the application layer:

php maintenance/dumpBackup.php --full >backup.xml

On the database layer, if your database name is wikidb:

mysqldump wikidb >wikidbdump.sql

Media files

See http://www.kefk.org/webworking/mediawiki/backup_und_restore.

Update

See http://www.mediawiki.org/wiki/Manual:Upgrading

Migrate

between computers

This describes how to migrate a wiki from one computer to another. It copies the mediawiki software and the content. Let's assume your mediawiki is running on computer earth and you want to have it running on mars.

  • copy your mediawiki software
  • on mars, delete LocalSettings.php
  • call your wiki on mars. You get the opportunity to set up your wiki.

Snapshot-mediawiki-setup.png

  • attention! If you use two mediawiki instances on one host, always use the same passwords for the database use
  • on earth, do a backup of your content to backup.xml. Copy it to your local computer.
  • log on to the wiki on mars as WikiSysop, choose Special Pages -> Import Pages and upload backup.xml.
  • all pages are imported! Look for Main_Page's history, you will find an addtional version containing earth's actual main page.
  • you may have to adjust upload_max_filesize in /etc/php5/apache2

between databases

Extensions

See also