MediaWiki Admin FAQs
From MontCo MediaWiki
How Do I Add Buttons to the Edit Toolbars
The standard editor uses a javascript-based edit page to display and edit pages.
There have been several buttons added by default to all MontCo Wiki users. They were added in two steps:
- common.js - This points to a standard button set that was created by one MarkS on WikiPedia and fixed so that it works for all users (IE included). All Montco Sites point to the same extended button set on the [1] site.
- MediaWiki:Extraeditbuttons.js - This is the extended button set used by ALL MontCo MediaWiki wikis by default.
If you are interested in reading how this works, tyr MarkS MediaWiki Button Customization. He also describes how to modify and individualize your buttons by using your local [skin].js (in our case, montcopa.js).
There is a way to add buttons to the edit bar which will work across the entire Wiki, but it is pretty much limited to text insertion buttons. For pop-up information input and other more sophisticated buttons, the easiest way is to add as part of the user editor javascript. If you are interested in Wiki-wide buttons, check Submit Button Extension.
To add buttons to individual users, you have to modify the javascript page associated with the individual user and the chosen "skin" (for example, montcopa) which you set in your preferences under the skin tab.
You add the additional buttons between the "pre" tags area for the user and skin in the local user Javascript file (file name is CASE SENSITIVE, and must be lower case; whereas the name CANNOT be all lower case and is also case sensitive). The easiest way to access this area is by entering it into the search bar:
search
| User:[your name]/[your skin].js |
Example: User:MickeyMouse/MontCoPA.js
You must edit this page to add your buttons to the toolbars. The most common way is to use an externally developed extension or develop one of your own, then reference it in your "skin" javascript file. The example here is a fairly robust set created by MarkS for Wikipedia - you can see full details at Extra Edit Buttons. XEB also has the built-in ability to customize and add new buttons.
//<pre>
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//</pre> |
The javascript file must start and end with these tags - but I couldn't find any documentation on why.
How do I Allow New File Types to be Loaded? (Administrators Only)
If you try to load a file and MediaWiki will not allow it, you probably need to add it to the allowable file types.
There are two steps to adding a new file type that's allowed to be uploaded.
The first is to add it to the allowable array in the extensions/[yourwiki]Local.php AFTER the statement:
require_once("$IP/extensions/MontCoConfig/MontCoLocal.php");
Just add the text of the extension type to the end of the allowable array (usually toward the end of the extensions/[yourwiki]Local.php file :
$wgFileExtensions[] = 'docx';
The second step is to allow it to be uploaded by the web server engine (at MontCo, usually IIS). This step is not needed if it is a standard file type that IIS supports.
For IIS, go into the IIS Manager, right click on properties for the virtual directory, 'HTTP Headers' tab, "Mime Types" and add it to the type served. Depending on your need, you can add this all the way up to the top (local computer) and it will allow all sub-webs and sub-virtual webs to upload/download that file type.
How do I Create a New MediaWiki Community? (System Administrators Only)
See Create a New MediaWiki Community?
How do I Customize a New MediaWiki Community? (System Administrators Only)
If you followed the Create a New MediaWiki Community? instructions, you will have a standard MontCo Wiki Community configuration. Most configuration and modifications you will want to do should be in this file which can be found in:
extensions/[newname]Local.php
Where 'newname' is the name of the Wiki whose configuration you are changing.
You should add any new extensions you want only for this wiki below the MontCoLocal.php inclusion as well as most site customizations.
The standard Montgomery County configuration for wikis is found in the extension MontCoConfig, which is included in all MontCo wikis in the statement:
require_once("$IP/extensions/MontCoConfig/MontCoLocal.php");
The file 'extensions/MontCoConfig/MontCoLocal.php' is a common configuration file that should only be modified on the wiki.montcopa.org/MediaWiki site, then propagated to all the other wikis. This is a standard configuration file that adds MontCo MediaWiki extension sets and sets common configuration requirements - including the ability to use namespaces, email extensions, and many others.
Any changes made to this file should also be committed to the version control using SVN (or TortoiseSVN) at:
https://svn.montcopa.org/repos/MediaWiki/trunk/extensions/MontCoConfig
You will need access and an approved certificate to do this.
How do I Create Private Namespaces (System Administrators Only)
Detailed instructions for managing namespaces can be found at MontCo Namespace Configuration.
How Do I Debug MediaWiki (System Administrators Only)
Media has its own built-in debugging system based on logging. By default, this is disabled, but to enable, you will need to go into the MW Local Settings (extensions/[wikiname]local.php) and uncomment this line:
#
# Uncomment this to debug
#require_once("$IP/extensions/debugcode.php");
This will create a logfile in the root wiki directory by the name of debug_log.txt that will record all debug logs created using wfdebug capabilitity (look up on mediawiki.org):
wfdebug("Log entry: ".variable);
Don't forget to shut this off when you are finished - it can be a real disk hog.
The default debug settings for MontCo can be found in extensions/DebugCode.php, but should not require changing.
# Below is for debug and should be commented out when finished # /** * The debug log file should be not be publicly accessible if it is used, as it * may contain private data. But it must be in a directory to which PHP run * within your Web server can write. */ $wgDebugLogFile = "$IP/debug_log.txt"; # # Profiling / debugging # /** Enable for more detailed by-function times in debug log */ $wgProfiling = true; /** Only record profiling info for pages that took longer than this */ $wgProfileLimit = 0.0; /** Don't put non-profiling info into log file */ $wgProfileOnly = false; /** Log sums from profiling into "profiling" table in db. */ $wgProfileToDatabase = false; /** Only profile every n requests when profiling is turned on */ $wgProfileSampleRate = 1; /** If true, print a raw call tree instead of per-function report */ $wgProfileCallTree = false; /** If not empty, specifies profiler type to load */ $wgProfilerType = ''; /** Settings for UDP profiler */ $wgUDPProfilerHost = '127.0.0.1'; $wgUDPProfilerPort = '3811'; /** Detects non-matching wfProfileIn/wfProfileOut calls */ $wgDebugProfiling = true; /** Output debug message on every wfProfileIn/wfProfileOut */ $wgDebugFunctionEntry = 1; /** Lots of debugging output from SquidUpdate.php */ $wgDebugSquid = false;
How do I make my site require SSL?
Requiring SSL (https:), can be set on a wiki-by-wiki basis. This is assuming you have already designated your certificate on the web server (IIS Manager->[web]->properties->Server Certificate . . .).
Since the Wikis are set up as virtual directories on the server, setting up the top level server (eg. http://wiki.montcopa.org) automatically enables SSL for all virtual directories on that server.
You need to perform 3 steps:
- Require SSL for the virtual directory
- Require SSL for the Images Directory
- Set up a redirect for users who forget to use http: instead of https:
Require SSL for the virtual directory
Go into IIS Manager, right click on the virtual directory you want to require to use SSL (https), then select 'properties' and the Directory Security tab. You will then need to click edit in the 'secure communications' section at the bottom of the window, and check 'require secure channel(SSL)'. Click OK, then APPLY and you should be there.
Require SSL for the Images Directory
If you have established a separate images directory (the standard for MontCo wikis), you will also need to adjust that directory. First, require SSL for that directory using the same previous instructions except for the [wiki]Img directory. Then change the redirect URL to use https: instead of http:
Set up a redirect for users who forget to use http: instead of https:
This is done by actually creating a redirect html page which is activated upon receipt of the 403.4 error (need SSL). First you need to create a redirect html using something similar to the following in a directory that does not requires SSL (eg. the base directory is a good place):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>The page must be viewed over a secure channel</TITLE> <META HTTP-EQUIV="Refresh" CONTENT="0; URL=https://wiki.montcopa.org/[wiki]"> </HEAD><BODY></BODY></HTML>
Then you need to go in and set the custom error to use that directory by using IIS Manager->properties->Custom Errors for the virtual directory you wish to redirect.
Why am I Getting "Mailer returned: It is not safe to rely on the system's timezone settings."
You need to set up PHP with a time zone.
Manually edit the php.ini file to include:
Set the date/time to the appropriate time zone (PHP Timezones):
[Date] ; Defines the default timezone used by the date functions date.timezone = "America/New_York" date.default_latitude = 40.11589 date.default_longitude = -75.34426
You may also have to add the following to your configuration file (LocalSettings.php, or sub-configuration file).
#Set Default Timezone
$wgLocaltimezone = "America/New_York"
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
# Versions before 1.7.0 used $wgLocalTZoffset as hours.
# After 1.7.0 offset as minutes
$wgLocalTZoffset = date("Z") / 60;
putenv("TZ=$oldtz");
Then restart the entire IIS web server:
How Do I Copy the Project Management Templates?
You need to go Special:Export. Copy and paste the below into the export list, then go into the desired wiki community and do a Special:Import.
Template:Create System Info Form Template:Create Department Form Template:CurrentProjectList Template:CurrentProjectListForm Template:ProjectRow Template:CurrentTaskList Template:CurrentTaskForm Template:TaskRow Template:DepartmentList Template:DepartmentForm Template:DepartmentRow Template:InitiativesList Template:InitiativeForm Template:InitiativeRow Template:CurrentChangeRequests Template:CRForm Template:CRRow Template:TeamRoster Template:TeamRosterForm Template:TeamRosterRow Template:MakeNewDepartment Template:MakeNewProject Template:MakeNewSystem Template:Project Template Template:RowHdr Template:Status Green Template:Status Yellow Template:Status Red Template:Status White Template:Status Template:SystemInfo Template:Tbl Template:TblHdr Template:TblStyle Template:PrettyTable
What Hacks are Used In the MontCo Wikis?
The following hacks (changes to non-configuration programs) are used in the County. When MediaWiki is updated or installed new, they must be reapplied.
includes/mime.types
MontCo commonly allows for the upload of Microsoft Office 2007 files (.docx, .pptx, . . .). These will be rejected or generate errors if the server is not told what to do, or how to handle them. This is done by changing making the following changes to the file:
Index: mime.types =================================================================== --- mime.types (revision 55388) +++ mime.types (working copy) @@ -2,7 +2,7 @@ application/mac-binhex40 hqx application/mac-compactpro cpt application/mathml+xml mathml -application/msword doc +application/msword doc docx docm dot dotx dotm application/octet-stream bin dms lha lzh exe class so dll application/oda oda application/ogg ogg ogm @@ -13,8 +13,8 @@ application/srgs gram application/srgs+xml grxml application/vnd.mif mif -application/vnd.ms-excel xls -application/vnd.ms-powerpoint ppt +application/vnd.ms-excel xls xlsx xlsb xlsm xlam xltx xltm +application/vnd.ms-powerpoint ppt pptm pptx pot potx potm ppsm ppam application/vnd.wap.wbxml wbxml application/vnd.wap.wmlc wmlc application/vnd.wap.wmlscriptc wmlsc
includes/mime.types
MontCo uses Extension NSFileRepo to protect files which are uploaded into the wiki. This extension requires the following patch to GlobalFunctions.php that allows colons (":") in the File name/title:
Index: GlobalFunctions.php =================================================================== --- GlobalFunctions.php (revision 55388) +++ GlobalFunctions.php (working copy) @@ -3034,6 +3034,6 @@ */ function wfStripIllegalFilenameChars( $name ) { $name = wfBaseName( $name ); - $name = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name ); + $name = preg_replace ( "/[^".Title::legalChars()."]/", '-', $name ); return $name; }
includes/specials/SpecialSearch.php
There is a sneaky work around in MediaWiki that allows the title of articles containing searched information to be displayed - even if the user does not have access to it. Potentially, this is problematic because if sensitive information is available in the title, . . .
To remove inaccessable entries from the searched site, you ned to apply this patch.
Index: SpecialSearch.php =================================================================== --- SpecialSearch.php (revision 55388) +++ SpecialSearch.php (working copy) @@ -375,7 +375,7 @@ } $off = $this->offset + 1; $out .= "<ul class='mw-search-results'>\n"; - while( $result = $matches->next() ) { + while( ($result = $matches->next()) && ($result->getTitle()->userCanRead()) ) { $out .= $this->showHit( $result, $terms ); } $out .= "</ul>\n"; @@ -1146,7 +1146,7 @@ $off = $this->offset + 1; $out .= "<ul class='mw-search-results'>\n"; - while( $result = $matches->next() ) { + while( ($result = $matches->next()) && ($result->getTitle()->userCanRead()) ) { $out .= $this->showHit( $result, $terms ); } $out .= "</ul>\n";
