Page MenuHomePhabricator

Built-in documentation for ExpandTemplates.php needs to mention requirement on ExtensionFunctions.php
Closed, ResolvedPublic


Author: Jason.Armistead

Top of file says:

if ( !defined( 'MEDIAWIKI' ) ) {
<p>This is the ExpandTemplates extension. To enable it, put </p>
<p>at the bottom of your LocalSettings.php</p>

BUT what is missing is the fact that it also calls upon ExtensionFunctions.php which is NOT part of the
standard MediaWiki distribution tree. This should be included in that documentation section somehow.
And, should ExtensionFunctions.php be part of the MediaWiki distribution tree (not an optional download).

The statement

if ( !function_exists( 'extAddSpecialPage' ) ) {
require( dirname(FILE) . '/../ExtensionFunctions.php' );

Fails spectacularly because ExtensionFunctions.php is not available.

Perhaps that "require" statement should also look like


So that it is all referenced relative to the MediaWiki install point "$IP" rather than to the extension
itself, which would still give it the same path but look "cleaner" in the code.

And, should it be a "require" or a "require_once" that is used in this case ? If other extensions rely
on ExtensionFunctions.php, do we need to "require" it each and every time ? That sounds like a recipe
for trouble.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:32 PM
bzimport set Reference to bz8584.
bzimport added a subscriber: Unknown Object (MLST).

robchur wrote:

I viewed ExtensionFunctions.php with some dislike then, and I still do now,
except now, it's likely not needed. The extension in question, ExpandTemplates,
uses some parser method which I don't think existed before 1.7, so we hardly
need the class autoloading compatibility stuff in it.

I personally prefer to minimise external dependencies when making things
backwards compatible, c.f. the NewestPages extension.

robchur wrote:

Documentation updated in r. It seems that the extension operates in a compatibility mode for older versions, so the dependency is theoretically valid.