The Flashlight Wiki that I set up recently is doing pretty well so far (though it isn’t showing up in my webserver statistics so I don’t know how many visitors I’m getting; well, it shows a total on the wiki page). But I have made a lot of changes to the default installation in order to get things the way I want them. So I thought I would make a record of that in case I have to reinstall from scratch. These changes are for MediaWiki 1.16.0. Later I upgraded to 1.18.0 and made a new entry about customizations.
Things done in LocalSettings.php file:
Change path to new 135×135 logo that I made (from FAQ):
$wgLogo = "http://igirder.com/led.png";
Put in new line for favicon path (from FAQ):
$wgFavicon = "http://flashlightwiki.com/backup/favicon.ico";
Restrict edits to registered users who have been confirmed by the admin (from FAQ):
// Prevent anonymous users from editing
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['*']['createtalk'] = false;
// Prevent registered, non-confirmed users from editing (from FAQ):
$wgGroupPermissions['user' ]['move'] = false;
$wgGroupPermissions['user' ]['edit'] = false;
$wgGroupPermissions['user' ]['createpage'] = false;
$wgGroupPermissions['user' ]['createtalk'] = false;
$wgGroupPermissions['user' ]['upload'] = false;
$wgGroupPermissions['user' ]['reupload'] = false;
$wgGroupPermissions['user' ]['reupload-shared'] = false;
$wgGroupPermissions['user' ]['minoredit'] = false;
$wgGroupPermissions['user' ]['delete'] = false;
// Allow confirmed users to edit
$wgGroupPermissions['confirmed' ]['move'] = true; // Only add this line if you want all users to be able to move
$wgGroupPermissions['confirmed' ]['edit'] = true;
$wgGroupPermissions['confirmed' ]['createpage'] = true;
$wgGroupPermissions['confirmed' ]['createtalk'] = true;
$wgGroupPermissions['confirmed' ]['upload'] = true;
$wgGroupPermissions['confirmed' ]['reupload'] = true;
$wgGroupPermissions['confirmed' ]['reupload-shared'] = true;
$wgGroupPermissions['confirmed' ]['minoredit'] = true;
$wgGroupPermissions['confirmed' ]['delete'] = true;
Enabled image uploads by making this statement true:
$wgEnableUploads = true;
Added a line to allow the wiki to generate thumbnails.
$wgMaxShellMemory = 524288;
Added a line to run a meta tag extension (also needed to add the meta.php file to the Extensions folder). Lets me include a meta tag for the main page description, but doesn’t seem to work for the page title (wiki uses TITLE tag anyway, not META):
require_once('extensions/meta.php');
Cached pages for quicker rendering (only does this for unregistered visitors, but I guess that would be most of the traffic).
$wgUseFileCache = true; /* default: false */
$wgFileCacheDirectory = "$IP/cache";
$wgShowIPinHeader = false;
When setting up the Wiki originally, I could pick a type of license, but picked none. To add a Creative Commons license, I configured these lines as follows (and put a logo image in my backup folder):
# $wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
$wgRightsText = "a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License";
$wgRightsIcon = "http://flashlightwiki.com/backup/creative-commons-icon.png";
I wanted to be able to do footnotes like they do in Wikipedia, so I had to add the Cite extension by downloading a compressed file, putting it in my extensions folder, and extracting it. Then I had to add this line to the end of localsettings:
require_once("$IP/extensions/Cite/Cite.php");
I decided to add some AdSense ads to the page just to see if I get any revenue. There is a MediaWiki extension set up for it, so I unzipped that in the Extensions folder. I also needed to set up a new ad in AdSense that was 120×240. This generated some code for the ad, but I only needed a few key parts of the code, adding the following to localsettings.php. The last line is an option that hides ads from registered users, but I’d like to see what ads are showing up, so it is commented out. The instructions said to make a change to main.css, but I didn’t do that (couldn’t find main.css at first, but it is in skins/monobook) and it seems to work fine:
require_once( "$IP/extensions/GoogleAdSense/GoogleAdSense.php" );
$wgGoogleAdSenseClient = 'ca-pub-8914738878891900';
$wgGoogleAdSenseSlot = '2337837216';
$wgGoogleAdSenseID = 'flashlight';
// Show the AdSense box only for anonymous users
#$wgGoogleAdSenseAnonOnly = true;
I wanted to have some kind of filter to keep bots from registering, so I installed the extensions ConfirmEdit and ASIRRA, adding the following lines to the end of the file (also modified ConfirmEdit.php to act only for new user registrations):
require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
require_once( "$IP/extensions/ConfirmEdit/Asirra.php");
$wgCaptchaClass = 'Asirra';
Once I prevented bots from registering, I wanted to delete the bots that had signed up already, but you aren’t supposed to just delete users, so instead you can merge the users and then delete them (this probably matters more if users had made any edits, but the bots were never confirmed, still better safe than sorry). So I downloaded and installed the User Merge and Delete Extension, adding the following lines to localsettings, and then commenting them out once I had merged everyone.
# require_once( "$IP/extensions/UserMerge/UserMerge.php" );
# $wgGroupPermissions['bureaucrat']['usermerge'] = true;
Lastly, I had to add these two lines to allow short URL’s (using unrecommended method (also had to modify .htaccess to make this work, see next section):
$wgArticlePath = "/$1";
$wgUsePathInfo = false;
Modifications to .htaccess file
First, when using an add-on domain like this, there are a lot of ways to see the web pages, and I only want people to be able to see them as http://flashlightwiki.com/stuff
But since it is a subdomain *and* and add-on domain, people could get to by seeing the subfolder on igirder http://igirder.com/flashlightwiki/stuff as well as http://flashlightwiki.igirder.com/stuff, so these lines in my .htaccess file redirect both of those (code from here, but I adapted it to get rid of the www. prefix on the destination):
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?flashlightwiki\.igirder\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^!www\.flashlightwiki\.com [NC]
RewriteRule ^(.*)$ http://flashlightwiki.com/$1 [R=301,L]
After that add these lines to redirect www.flashlightwiki.com to flashlightwiki.com (not sure what the second two lines do):
RewriteCond %{HTTP_HOST} ^www.flashlightwiki.com [NC]
RewriteRule ^(.*)$ http://flashlightwiki.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/flashlightwiki($|/.*$)
RewriteRule ^.* http://flashlightwiki.com%1 [R=301,L]
To get short URL’s to work, I had to make the changes shown just above to localsettings, but I also had to add this to the .htaccess file (for Wiki’s installed to root directory, which is what I did originally, not knowing any better). I did this after the stuff above so as to at least hopefully get people in close to the right format of URL before attempting any of this:
RewriteRule ^[^:]*\. - [L]
RewriteRule ^[^:]*\/ - [L]
RewriteRule ^/*$ /index.php?title=Main_Page [L,QSA]
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]
Changes to Main.css
I thought it would be good to have internal links one color and external links the traditional blue (purple if a link has been visited before). Wiki also has red links for links to pages that don’t exist yet (dark red if you’ve tried to visit the page before). So I thought green would be good, but it was kind of hard to do light green and dark green, so I did dark green for unvisited internal links and brown for visited links. To do this, I had to change the main.css file under the skins/monobook folder. Technically you aren’t supposed to change main.css because it is part of the installation and this should be done with a separate css file. So if I upgrade or change the skin, I will have to make these changes again. There doesn’t seem to be a special class for internal links, so instead I set the general links to green and brown and then set new external links to blue and purple. So I revised these existing lines to read:
a {
text-decoration: none;
/* was color: #002bb8; */
color: #006600; /* dark green */
background: none;
}
a:visited {
/* was color: #5a3696; */
color: #663300; /*brown*/
}
Then I added these lines after that:
:link.external {
color: #002bb8;
}
:link.external:visited {
color: #5a3696;
}
Somewhere I read that when changing link colors you should use :link instead of A because A can be anchors, not just links. While I was messing around with colors, I also made the background color an off white (light yellow) by modify this line near the top of main.css:
#content {
background: #ffffdd; /*was white*/
Prefs that I modified
http://***/MediaWiki:Prefs-help-realname
Changed this to warn people registering that their accounts will not be activated until they send me an e-mail or PM at CPF or BLF.
Things I still want to do:
Enable multiple languages or at least a translation button. A guy from a Spanish language flashlight site said he would do some translating if I could enable other languages like Wikipedia does. The only way to get true multi-language support is to install a wiki for each language and have a “family” of wikis.
Change the title of the main page from Main Page – Flashlight Wiki to just Flashlight Wiki to maybe help search engine ranking. I think this will require changes to a javascript file (since it only applies to the Main Page, it has to be written as an IF statement), but I couldn’t find out where to do that.
I’d like to set up support for equations, but my first try to do that wasn’t successful (see comment of Jan. 2, 2011).
File size uploads are restricted to 2MB by default, but I’d like to change that to 500kb or smaller so people don’t upload giant images. This might require tweaking server settings that I don’t have access to though.