Wiki Build Notes

From scary!records wiki
Jump to navigation Jump to search

These are the steps that I took to customize this installation of MediaWiki (v. 1.15.2 – 2010-03-08) on the HostMonster web hosting service.

Summary

This is a public, read-only wiki with the ability for users to upload files. "Short URL" functionality is enabled and InterWiki links are used to link to my private wiki at http://wiki.unionandparkwood.com.

  • All content is viewable by the public
  • User registration is forbidden
  • File upload is permitted by users only
  • "Short URL" functionality is enabled
  • InterWiki links are allowed with http://wiki.unionandparkwood.com/
  • Update site logo

Initial LocalSettings.php File Details

The following lines of code must be added to the LocalSettings.php file, preferably at the bottom of the existing code so that it's easy to remember what was added. (For more configuration settings, see "MediaWiki Manual:Configuration Settings".)

1) Setting the location of the favicon.ico manually (because it wasn't updating correctly at first)

# Setting the location of the favicon.ico manually
$wgFavicon = "http://wiki.60bpm.com/favicon.ico";

2) Prevent editing of pages by anyone except sysops

# Prevent editing of pages by anyone except sysops
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['sysop']['edit'] = true;

3) Prevent new user registrations except by sysops

# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;

4) Update the logo path to point to my custom logo

# Add customized logo to skin
$wgLogo = "/siteflow/images/60bpmlogo.png";

Allow File Uploading

Modify permissions for the /images/ directory in the docroot to allow writing.

LocalSettings.php File Edits

Allow file uploads. NOTE: this variable already exists in the LocalSettings.php file and only needs to be changed.

$wgEnableUploads = true;

Just below this change, I add the following to allow more file types to be uploaded:

# Allow the following file types to be uploaded
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg',  'pdf', 'bmp', 'svg', 'psd', 'ai', 'mp3', 'mp4', 'm4v');

Short URL Activation

The MediaWiki "Manual:Short URL -- Recommended How-To Guide" on enabling Short URLs could not be used because my web host (HostMonster) does not allow root access to the httpd.conf file. Instead, I had to use the "Manual:Short URL -- no root access" guide which uses the .htaccess file.

LocalSettings.php File Edits

# Virtual path (left part of first rewrite rule). MUST be DIFFERENT from the path set above ($wgScriptPath)!
$wgArticlePath = "/article/$1";
$wgUsePathInfo = true;

.htaccess File

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^article/(.*)$ /index.php?title=$1 [PT,L,QSA]
RewriteRule ^article/*$ /index.php [L,QSA]
RewriteRule ^/*$ /index.php [L,QSA]

NOTE: The Options +FollowSymlinks portion is not in the MediaWiki guide, but the code wasn't working without it. I did a search and found this article in the HostMonster Support Center, which said that "+FollowSymLinks must be enabled for any rules to work."

Allowing InterWiki Links

This was enabled so that I could keep my private content in this wiki and my public content for 60bpm, and link back and forth within them. To accomplish this, I followed the MediaWiki InterWiki Manual.

1) Perform the following insert into the mw_interwiki table of the wiki database.

INSERT INTO mw_interwiki SET iw_prefix='up', iw_url='http://wiki.unionandparkwood.com/article/$1', iw_local=1, iw_trans=0;

Style Updates

All style updates are made in the current skin directory. At the moment, this is: /skins/monobook/main.css

1) I prefer that the visited links are colored the same as the original links

a, a:visited {
	text-decoration: none;
	color: #002bb8;
	background: none;
}
/* I prefer that the visited links are colored the same as the original links
a:visited {
	color: #5a3696;
}
*/

Extensions

The extensions that I've added to this wiki are as follows.

Cite

Extension:Cite is method of dynamically adding footnotes to an article. The extension code was uploaded to /extensions/Cite/. The following code was added to the LocalSettings.php file:

# Here are the includes for my added extensions
require_once("$IP/extensions/Cite/Cite.php");

EmbedVideo

[1] is a method of easily embedding a video from a variety on video hosting sites. The extension code was uploaded to /extensions/VideoEmbed/. The following code was added to the LocalSettings.php file:

#EmbedVideo
require_once("$IP/extensions/EmbedVideo/EmbedVideo.php");

Infobox Data Capture

I originally thought that this extension was all I needed to add the right-aligned album info, but this wasn't the case. Regardless, I'm keeping this here for now.

Extension:Infobox Data Capture is a method of adding a right-aligned column of formatted data to an article. This was installed for the music collection pages. The extension code was captured and uploaded to /extensions/InfoboxData/. The following code was added to the LocalSettings.php file:

require_once("$IP/extensions/InfoboxData/InfoboxData.php");

The following database query was performed to create the needed table:

CREATE TABLE  `mw_infoboxdata` (
  `ib_from` int(8) unsigned NOT NULL default '0',
  `ib_datablock_order` int(11) NOT NULL default '7',
  `ib_datablock_name` varbinary(255) NOT NULL default '',
  `ib_attribute_order` int(11) NOT NULL default '7',
  `ib_attribute` varbinary(255) NOT NULL default '',
  `ib_value` blob,
  `ib_isvalid` int(1) unsigned NOT NULL default '1',
  `ib_comment` blob,
  KEY `ib_from` (`ib_from`,`ib_datablock_order`,`ib_datablock_name`,`ib_attribute`),
  KEY `ib_datablock_name` (`ib_datablock_name`,`ib_from`)
) ENGINE=MyISAM DEFAULT CHARSET=binary;

Infobox

The Infobox extension actually required the installation of the ParserFunctions extension, followed by the creation of a large number of templates. The reason I wanted to install this functionality was so that I could add the details of albums and musical collections to the right of the other information.

For details on how to use this functionality, see Wikipedia's Template:Infobox album page.

I needed some direction to do this, so I followed along with this tutorial: ETCwiki: How to install template infobox in mediawiki.

1) Uploaded the Extension:ParserFunctions extension to /extensions/ParserFunctions/ and added the following to the LocalSettings.php file:

require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
$wgPFEnableStringFunctions = true;

2) Search for MediaWiki:Common.css, then create the page and add the styles. The added styles are currently on this page, between the following comments:

/***************************
INFOBOX STYLES BEGIN HERE
***************************/
...

/***************************
INFOBOX STYLES END HERE
***************************/

3) The following templates were recommended by the tutorial. I'm not currently sure if all of this was necessary. After installing them all, it dawned on me what I was doing and then how to find more templates I needed.

To install a template: Search, create, paste source code and save.

These are the first level of templates you need for Template:Infobox

   * Template:! view source
   * Template:Clear view source
   * Template:Documentation view source
   * Template:Documentation subpage view source
   * Template:Documentation/docname view source
   * Template:Infobox view source (you may already have this)
   * Template:Infobox/doc (edit)
   * Template:Intricate template view source - Really Important*
   * Template:Navbar view source
   * Template:Nowrap view source
   * Template:Ombox view source
   * Template:Ombox/core view source
   * Template:Pp-meta view source
   * Template:Pp-template view source
   * Template:Purge view source
   * Template:Tl view source (this is TL, I had trouble telling the L in lowercase)
   * Template:Tnavbar view source
   * Template:Transclude view source

You will also need to copy these templates to make the ones above work

   * Template:Infobox/row view source
   * Template:Tiw view source
   * Template:Tlf view source
   * Template:Tls view source
   * Template:Tlsp view source
   * Template:Tlp view source
   * Template:Tn view source
   * Template:Tlx view source
   * Template:Mbox Templates view source
   * Template:Mbox templates/doc view source
   * Template:Navbox view source
   * Template:- view source
   * Template:· view source
   * Template:Tnull view source
   * Template:Shortcut view source
   * Template:High-risk view source
   * Template:Main view source
   * Template:Namespace detect view source
   * Template:Clr view source

Extra templates that may help if you have problems

   * Template:Cleanup view source
   * Template:Ambox view source
   * Template:Ambox/core view source

4) I added the following for the album layout:

   * Template:Infobox album view source
   * Template:Infobox album/link view source
   * Template:Infobox album/color view source
   * Template:Extra album cover view source
   * Template:Min view source
   * Template:Rating view source (Note: You will have to modify the file names for the stars once you upload them.)
   * Template:Singles view source
   * Template:Loop15 view source
   * Template:Navbox Musical artist view source
   * Template:Navbox Musical artist/color view source
   * Template:Navbox Musical artist view source
   * Template:Documentation/core2 view source
   * Template:Template other view source
   * Template:Documentation/core/doc view source
   * Template:Fmbox view source
   * Template:Template doc view source

NOTE: In the Template:Infobox album code, I needed to replace the tag with because the former was not being parsed correctly for some reason.

5) Test it all by creating a new page and posting the following code to it:

{{Infobox
|title        = ETCwiki.org Infobox
|image        = [[Image:example.png|200px]]
|header1 = Main Heading
|header2 = First set of data
|label2  = Label
|data2   = Data
|header3 = Remove this line (optional)
|label3  = More Label
|data3   = More data
}}

Miscellaneous Items

Redirect The Home Page

The home page of this wiki was changed to point to the Welcome page by editing the MediaWiki:Mainpage page.