Errata

MediaWiki

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 285
First and second bullet items

The first and second bullet items on the page are identical. They both read, "Defining global PHP variables ( $wg... ) that control your extension." One bullet item should be deleted.

Note from the Author or Editor:
Delete the second bullet.

Daniel Barrett  Nov 14, 2017 
Printed
Page 204
"Case sensitivity" paragraph

A cross-reference is missing. The incorrect text currently reads:

(see the sidebar "Article Titles and Case-Sensitivity" within )

It is supposed to reference the sidebar in Chapter 5 on page 76, e.g.,

(see the sidebar "Article Titles and Case-Sensitivity" on page 76)

Daniel J. Barrett  Apr 14, 2014 
Printed
Page 295
Example 15-5, function render()

In trying example 15-5 with MediaWiki 15.3, I discovered that the example shows the 3rd parameter is passed by reference. This prevents the function from executing. Removing the & from the parameter making it pass by value allows the code to work in this version of MediaWiki. Two pages later, example 15-7 on page 297 correctly passes this parameter by value.

Note from the Author or Editor:
On page 295, example 15-5, in the fifth line from the bottom ("static function render..."), locate the word:

&$parser

and remove the ampersand (&) to make it:

$parser

Anonymous  Jul 26, 2012  Jan 17, 2014
Printed
Page 290
Example 15-2

In the definition of function ufUserVariable_Magic(), the second parameter, $langID , is passed by reference with an ampersand. However, in more recent versions of mediaWiki (I tried the code in Mediawiki 15.3) the second parameter must not be passed by reference - if you do, you get an error message and the wiki execution stops.

Note from the Author or Editor:
In example 15-2, in the line:

function wfUserVariable_Magic(&$magicWords, &$langID) {

remove the ampersand from &$langid, making it $langID.

Anonymous  Jul 26, 2012  Jan 17, 2014
Printed
Page 304
code at bottom of page

In the construct method, the call is made to

SpecialPage::SpecialPage('FancyForm');

This produces an error, at least with the latest svn version of MediaWiki

Fatal error: Call to undefined method SpecialPage::specialpage() ...

Sample code from http://www.mediawiki.org/wiki/Manual:Special_pages suggests the following type of construct method, which does work:

parent::SpecialPage('FancyForm');

There is a similar construct call on page 302.

I would guess that this may vary with different versions of PHP if this code worked in the past, but the parent:: call might be the best approach.

Note from the Author or Editor:
The line:

SpecialPage::SpecialPage('FancyForm');

should be changed to:

parent::SpecialPage('FancyForm');

Gary Anderson  Oct 24, 2010  Jan 17, 2014
Printed
Page 124 & 278
Where Dynamic Page List is first mentioned on both pages

The extension DynamicPageList (DPL) is mentioned but there are two extensions by that name: (1) DynamicPageList (Wikimedia) and (2) DynamicPageList (third-party).

I believe Mr. Barrett referring to the third-party version based on the code examples, but which extension he is referring to is not explicitly clear.

Note from the Author or Editor:
Since my book was published, a second extension has started calling itself DynamicPageList. My book documents the "third-party" DPL. The simplest way to fix this is:

- On page 278, first line, change the URL to http://www.mediawiki.org/wiki/Extension:DynamicPageList_%28third-party%29.

Page 125 already says DPL is a "third-party extension" so I don't think we need to correct anything here.

Niklas Patrick Nordlof  Oct 06, 2010  Jan 17, 2014
Printed
Page 127
First example on that page

The example has one too many brackets. This is the text in the book:
'''[[dog]]]'''

This is what the text should be:
'''[[dog]]'''

Note from the Author or Editor:
The reader is correct. Change the triple bracket ]]] into a double bracket ]]

Niklas Patrick Nordlof  Oct 06, 2010  Jan 17, 2014
Printed
Page 321
Just before the last paragraph

The database name is missing in the following line:

mysql -u root -p****** < backupfile.sql

It should be changed to:

mysql -u root -p****** wikidb < backupfile.sql

Note from the Author or Editor:
The reader is correct.

popol0909  Apr 21, 2010  Jan 17, 2014
Printed
Page 259
1rst paragraph

"edit MediaWiki:Site notice"

should read

"edit MediaWiki:Sitenotice"

Note from the Author or Editor:
The reader is correct - this is a bad linebreak in the middle of a word. The term:

MediaWiki:Sitenotice

which is split across lines 1-2 of the page, belongs on a single line.

popol0909  Apr 21, 2010  Jan 17, 2014
PDF
Page 258
towards the middle of the page

The statement
-------------
If you don?t want any logo, set:
$wgLogo = false;
-------------
is not correct. This means to use the default logo.

Note from the Author or Editor:
The line of code should be changed to:

$wgLogo = '';

Anonymous  Apr 04, 2009  Jan 17, 2014
PDF
Page 328
Example 16-2

Example 16-2 uses the class 'SecureLoginPage' from Example 16-3.
All 3 times the class called incorrectly ('FancyForm' or 'SecureLogin').

Note from the Author or Editor:
1. The caption to example 16-2 should be changed from:

Example 16-2: SecureLogin.php

to:

Example 16-2: SecureLoginPage.php

2. Line 9 of example 16-2 should have the word FancyForm changed
to SecureLoginPage, and each of lines 10-12 need the word
SecureLogin changed to SecureLoginPage. There is one change per
line, for a total of four changes. The result should be:

$wgAutoloadClasses['SecureLoginPage']
= dirname(__FILE__) . '/SecureLoginPage_body.php';
$wgHooks['UserLoginForm'][] = 'SecureLoginPage::secureLogin';
$wgHooks['BeforePageDisplay'][] = 'SecureLoginPage::otherPage';

Changes to example 16-3:

1. The caption should be changed from:

Example 16-2: SecureLogin_body.php

to:

Example 16-2: SecureLoginPage_body.php

Anonymous  Mar 28, 2009  Jan 17, 2014
Printed
Page 280
Last line

The book says that all extension code in the chapter can be downloaded and gives a book address, but there is no link at that address for the extension code. Is there some other location where we can get a link to this code?

Note from the Author or Editor:
The reader is correct. I will arrange with the editor (Mike L) to get these code examples posted.

Gary Anderson  Mar 02, 2009  Jan 17, 2014
Printed
Page 233
Second code sample

This example does let superheroes edit in the Headquarters namespace, but it goes too far and also gives them all the abilities of sysops via the "editinterface" right. To fix this problem, replace the last five lines of code:

// Make namespace read-only except to those with the editinterface
// right, such as sysops
$wgNamespaceProtection[NS_HEADQUARTERS] = array('editinterface');

// Give superheroes the editinterface right
$wgGroupPermissions['superheroes']['editinterface'] = true;

with these six lines:

// Create a right unique to superheroes.
$wgGroupPermissions['superheroes']['mightmakesright'] = true;
// Only users with this right can edit pages in the headquarters namespace
$wgNamespaceProtection[NS_HEADQUARTERS] = array('mightmakesright');
// Optionally, give this right to sysops too (recommended)
$wgGroupPermissions['sysop']['mightmakesright'] = true;

Daniel J. Barrett
Daniel J. Barrett
 
Dec 21, 2008  Jan 17, 2014
Printed
Page 298
The very end

The final paragraph should end with this additional sentence, if it will fit:

Message names must be lowercase.

just after the phrase "English, French, and Spanish." The word "must" should be emphasized in italics.

Note from the Author or Editor:
This is correct. If message names are not lowercase, the code will not work.

Daniel J. Barrett
Daniel J. Barrett
 
Nov 18, 2008  Jan 17, 2014
Printed
Page 335
Index listing

These two index entries under Symbols:

$wgAutoloadClasses, 285
$wgTitle, 300

should instead appear in index section "W", where all the other $wg... variables currently appear.

Daniel J. Barrett
Daniel J. Barrett
 
Oct 21, 2008  Jan 17, 2014
Printed
Page 79
Line 4 (first code example)

The pipe symbol in this line, between "Article" and "Article", should be Roman, not italics.

I'm the author and I approve this erratum. :-)

Daniel J. Barrett
Daniel J. Barrett
 
Oct 14, 2008  Jan 17, 2014