Difference between revisions of "MediaWiki Modifications"

From ScienceZero
Jump to: navigation, search
(main.css)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
These changes works on MediaWiki 1.9.1 and has not been tested on anything else.
+
These changes works on MediaWiki 1.9.1 and 1.24.2.
  
  
Line 5: Line 5:
 
Changes to this file should be added to the end of the file to make sure nothing goes wrong.
 
Changes to this file should be added to the end of the file to make sure nothing goes wrong.
  
Enable the external [http://www.imagemagick.org ImageMagick] software because MediaWiki thumbnail generation is of very low quality.
+
#[http://wiki.enneenne.com/index.php/MediaWiki_PayPal%27s_buttons_support Mediawiki PayPal Extension]
 +
require_once('extensions/ipbwiki/IpbWiki_PayPal.php');
 +
 +
#Enable the external [http://www.imagemagick.org ImageMagick] software  
 +
#Default MediaWiki thumbnail generation is of very low quality.
 
  $wgUseImageMagick = true;
 
  $wgUseImageMagick = true;
 
  $wgImageMagickConvertCommand = "/usr/bin/convert";
 
  $wgImageMagickConvertCommand = "/usr/bin/convert";
 
+
Removes the IP number from the user bar.
+
#Remove the IP number from the user bar.
 
  $wgShowIPinHeader = false;
 
  $wgShowIPinHeader = false;
 
+
Removes the ability to create new accounts and removes the ability to edit without being logged on.
+
#Remove the ability to create new accounts and removes the ability to edit without being logged on.
 
  $wgGroupPermissions['*']['createaccount'] = false;
 
  $wgGroupPermissions['*']['createaccount'] = false;
 
  $wgGroupPermissions['*']['edit'] = false;
 
  $wgGroupPermissions['*']['edit'] = false;
 
+
Removes the edit links.
+
#Remove the edit links.
 
  $wgDefaultUserOptions ['editsection'] = 0;
 
  $wgDefaultUserOptions ['editsection'] = 0;
 
+
Enables file upload and points to the correct directory.
+
#Enable file uploads and points to the correct directory.
 
  $wgEnableUploads = true;
 
  $wgEnableUploads = true;
 
  $wgUploadDirectory = "{$IP}/files";
 
  $wgUploadDirectory = "{$IP}/files";
 
  $wgUploadPath = "{$wgScriptPath}/files";
 
  $wgUploadPath = "{$wgScriptPath}/files";
 
+
Points to the new logo.
+
#Point to the new logo.
 
  $wgLogo = "{$wgScriptPath}/logo.png";
 
  $wgLogo = "{$wgScriptPath}/logo.png";
 +
 +
#Enable Tex.
 +
$wgUseTeX          = true;
 +
$wgMathPath        = "{$wgScriptPath}/files/math";
 +
$wgMathDirectory    = "{$wgUploadDirectory}/math";
 +
$wgTmpDirectory    = "{$wgUploadDirectory}/tmp";
  
 
== MonoBook.php ==
 
== MonoBook.php ==
Removes the Log in / Create new account link.
+
#Remove the Log in / Create new account link.
  foreach($this->data['personal_urls'] as $key => $item)  if($this->data['loggedin']==1) {
+
  Foreach($this->data['personal_urls'] as $key => $item)  if($this->data['loggedin']==1) {
 
+
Removes the tabs(article, edit...) for users that are not logged in.
+
#Remove the tabs(article, edit...) for users that are not logged in.
 
  foreach($this->data['content_actions'] as $key => $tab) if($this->data['loggedin']==1) {
 
  foreach($this->data['content_actions'] as $key => $tab) if($this->data['loggedin']==1) {
 
+
Removes irrelevant information from the footer, definition of irrelevance changes for users that are logged in.
+
#Remove irrelevant information from the footer.
 +
#Definition of irrelevance changes for users that are logged in.
 
  if($this->data['loggedin']==1) {
 
  if($this->data['loggedin']==1) {
 
   $footerlinks = array(
 
   $footerlinks = array(
Line 44: Line 55:
 
   );
 
   );
 
  }
 
  }
 
+
Removes the WikiMedia and copyright icons from the footer.
+
#Remove the WikiMedia and copyright icons from the footer.
 
  <nowiki><!-- <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div> --></nowiki>
 
  <nowiki><!-- <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div> --></nowiki>
 
  <nowiki><!-- <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div> --></nowiki>
 
  <nowiki><!-- <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div> --></nowiki>
  
 +
==main.css==
 +
Add table class that does not look ugly
 +
table.wikitable {
 +
  margin: 1em 1em 1em 0;
 +
  background: #ffffff;
 +
  border: 1px #aaa solid;
 +
  border-collapse: collapse;
 +
}
 +
 +
table.wikitable th, table.wikitable td {
 +
  border: 1px #aaa solid;
 +
  padding: 0.2em;
 +
}
 +
 +
table.wikitable th {
 +
  background: #f2f2f2;
 +
  text-align: center;
 +
}
 +
 +
table.wikitable caption {
 +
  margin-left: inherit;
 +
  margin-right: inherit;
 +
  font-weight: bold;
 +
}
  
==main.css==
+
Remove the background image.
Removes the background image.
+
 
  body {
 
  body {
 
   font: x-small sans-serif;
 
   font: x-small sans-serif;
Line 60: Line 94:
 
   padding: 0;
 
   padding: 0;
 
  }
 
  }
 
  
 
==image.php==
 
==image.php==
 +
MediaWiki gives this error with ImageMagick older than 6.x:
 
  Error creating thumbnail: /usr/bin/convert: Unrecognized option (-thumbnail).
 
  Error creating thumbnail: /usr/bin/convert: Unrecognized option (-thumbnail).
 +
 +
This is because it uses the ''-thumbnail'' option that does not exist in earlier versions of ImageMagick, changing it to ''-resize'' fixes the problem. The difference is that ''-thumbnail'' also strips metadata from the file and will in some cases generate smaller thumbnails.
 +
 +
$cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
 +
" {$quality} -background white -size {$width} ".
 +
wfEscapeShellArg($this->imagePath) .
 +
// Coalesce is needed to scale animated GIFs properly (bug 1017).
 +
' -coalesce ' .
 +
// For the -resize option a "!" is needed to force exact size,
 +
// or ImageMagick may decide your ratio is wrong and slice off
 +
// a pixel.
 +
" -resize " . wfEscapeShellArg( "{$width}x{$height}!" ) .
 +
" -depth 8 " .
 +
wfEscapeShellArg($thumbPath) . " 2>&1";

Latest revision as of 19:23, 9 April 2015

These changes works on MediaWiki 1.9.1 and 1.24.2.


LocalSettings.php

Changes to this file should be added to the end of the file to make sure nothing goes wrong.

#Mediawiki PayPal Extension
require_once('extensions/ipbwiki/IpbWiki_PayPal.php');

#Enable the external ImageMagick software 
#Default MediaWiki thumbnail generation is of very low quality.
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

#Remove the IP number from the user bar.
$wgShowIPinHeader = false;

#Remove the ability to create new accounts and removes the ability to edit without being logged on.
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;

#Remove the edit links.
$wgDefaultUserOptions ['editsection'] = 0;

#Enable file uploads and points to the correct directory.
$wgEnableUploads = true;
$wgUploadDirectory = "{$IP}/files";
$wgUploadPath = "{$wgScriptPath}/files";

#Point to the new logo.
$wgLogo = "{$wgScriptPath}/logo.png";

#Enable Tex.
$wgUseTeX           = true;
$wgMathPath         = "{$wgScriptPath}/files/math";
$wgMathDirectory    = "{$wgUploadDirectory}/math";
$wgTmpDirectory     = "{$wgUploadDirectory}/tmp";

MonoBook.php

#Remove the Log in / Create new account link.
Foreach($this->data['personal_urls'] as $key => $item)  if($this->data['loggedin']==1) {

#Remove the tabs(article, edit...) for users that are not logged in.
foreach($this->data['content_actions'] as $key => $tab) if($this->data['loggedin']==1) {

#Remove irrelevant information from the footer.
#Definition of irrelevance changes for users that are logged in.
if($this->data['loggedin']==1) {
  $footerlinks = array(
  'lastmod', 'viewcount', 'numberofwatchingusers', 'tagline',
  );
} else {
  $footerlinks = array(
  'lastmod', 'tagline',
  );
}

#Remove the WikiMedia and copyright icons from the footer.
<!-- <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div> -->
<!-- <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div> -->

main.css

Add table class that does not look ugly

table.wikitable {
  margin: 1em 1em 1em 0;
  background: #ffffff;
  border: 1px #aaa solid;
  border-collapse: collapse;
}

table.wikitable th, table.wikitable td {
  border: 1px #aaa solid;
  padding: 0.2em;
}

table.wikitable th {
  background: #f2f2f2;
  text-align: center;
}

table.wikitable caption {
  margin-left: inherit;
  margin-right: inherit;
  font-weight: bold;
}

Remove the background image.

body {
  font: x-small sans-serif;
  background: #f9f9f9 url(headbg.jpg) 0 0 no-repeat;
  background-image: none;
  color: black;
  margin: 0;
  padding: 0;
}

image.php

MediaWiki gives this error with ImageMagick older than 6.x:

Error creating thumbnail: /usr/bin/convert: Unrecognized option (-thumbnail).

This is because it uses the -thumbnail option that does not exist in earlier versions of ImageMagick, changing it to -resize fixes the problem. The difference is that -thumbnail also strips metadata from the file and will in some cases generate smaller thumbnails.

$cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
" {$quality} -background white -size {$width} ".
wfEscapeShellArg($this->imagePath) .
// Coalesce is needed to scale animated GIFs properly (bug 1017).
' -coalesce ' .
// For the -resize option a "!" is needed to force exact size,
// or ImageMagick may decide your ratio is wrong and slice off
// a pixel.
" -resize " . wfEscapeShellArg( "{$width}x{$height}!" ) .
" -depth 8 " .
wfEscapeShellArg($thumbPath) . " 2>&1";