Extension talk:StubManager

PHP Warning: call_user_func_array
Get the following PHP warning:

PHP Warning: call_user_func_array [a href='function.call-user-func-array'>function.call-user-func-array]: First argument is expected to be a valid callback, 'StubManager' was given in /usr/share/mediwiki/includes/Hooks.php on line 113

Setup: MediaWiki 1.12.0, PHP 5.2.0-8+etch13 (cgi-fcgi), MySQL 5.0.32-Debian_7etch8

Leeds to: Spezial:Version aka Special:Version is not shown. StubManager installed for JSKitRating. JSKitRating seems to work O.K. (have another question, but will write it in Extension_talk:JSKitRating. Require-Statement for StubManager is done before JSKitRating in LocalSettings.php. Have commented out all other extensions in LocalSettings.php, but warning still remains.

(CLOSED)
I installed this and then got "Unable to add cookies, header already sent. LocalSettings.php. Line: 1

Any ideas why that would happen?
 * Paste your LocalSettings.php here and I'll have a look. Of course, leave out the sensitive information. Jean-Lou Dupont 20:36, 25 September 2007 (UTC)

Ok, I will gmail you instead if that's ok.
 * even better. Jean-Lou Dupont 21:07, 25 September 2007 (UTC)


 * So what causes this error? -- Joe Beaudoin Jr. 03:24, 14 October 2007 (UTC)
 * I never had any feedback on this one nor did I ever see that sort of error with all my experience with this extension. Jean-Lou Dupont 11:26, 14 October 2007 (UTC)

StubManager & ExtensionManager confilct (CLOSED)
I installed StubManager and ExtensionManager via pear and got this:

Fatal error: Cannot redeclare class ExtensionLoader in /usr/share/php/MediaWiki/ExtensionManager/ExtensionManager.php on line 31
 * Please check if the extension you used to configure ExtensionClass isn't available with StubManager. I do not plan to support both ExtensionClass anymore. Jean-Lou Dupont 21:11, 22 October 2007 (UTC)

Login Required?! (CLOSED)
After I installed StubManager via pear login required to all action (e.g. see Main_Page)
 * ? Jean-Lou Dupont 21:11, 22 October 2007 (UTC)

So what does this do? (CLOSED)
I am a new extensions developer. I couldn't understand what this extension did from reading the page, but I guessed at what I wanted it to do. I scanned the code briefly and it seems like it might do what I would like it to do.

Q1: Does this extension intercept calls to extension hooks so that not every extension has to be instantiated and loaded for each page?

Q2: What are its features?

Q3: What are its limitations? Brion.finlay 21:50, 11 November 2007 (UTC)
 * R1:yes
 * R2:I'll add some additional notes on the extension's page. In the meantime, why not scan the extensions that depend on this one? There are quite a few... why don't you use this page to see the dependencies?
 * R3:Infinite ;-)
 * Jean-Lou Dupont 22:04, 11 November 2007 (UTC)

Installation fails (CLOSED)
Installing Extension:StubManager with PEAR method (http://www.mediawiki.org/wiki/Extension:StubManager#PEAR) fails. Errors given:


 * Warning: require(MediaWiki/StubManager/StubManager.php) [function.require]: failed to open stream: No such file or directory in /var/www/mediawiki/w/LocalSettings.php on line 233


 * Fatal error: require [function.require]: Failed opening required 'MediaWiki/StubManager/StubManager.php' (include_path='.:/var/www/mediawiki/w:/var/www/mediawiki/w/includes:/var/www/mediawiki/w/languages') in /var/www/mediawiki/w/LocalSettings.php on line 233

Regards, --84.190.136.180 15:25, 14 January 2008 (UTC)
 * Please provide more details because StubManager is the foundation is most of my extensions and I always use PEAR to install it.
 * Jean-Lou Dupont 15:49, 14 January 2008 (UTC)

SVN download correction to 'require_once' setting for LocalSettings.php
When using the SVN download to install the StubManager extension there is one not so obvious directory name correction necessary.

First, the correct change to the LocalSettings.php file should be:

Secondly, downloading the compressed archive the file name is in the form StubManager-x.x.x.tgz which decompresses to the directory StubManager-x.x.x.

The directory needs to be renamed for the LocalSettings.php to find it.

Rename it:

or link it to StubManager:

Alternately, you could modify the directory name in the LocalSettings.php file: Posted by --AuroraCA 04:18, 10 March 2008 (UTC)
 * Thanks for the detailed notes. Jean-Lou Dupont 01:16, 11 March 2008 (UTC)
 * Has this been fixed? I attempted to fix it, which you changed back.
 * I guess this means that the folder SecureHTML-2.3.0, which is what is downloaded, should be changed to "SecureHTML" only, before it is uploaded.
 * I am sorry for my mistakes, I learn by being hands on. Your extension pages are the most complex to understand, I was only attempting to fix this.
 * I understand it must be frustrating to correct all my mistakes, that is the reason why I agreed to no longer edit your pages.Odessaukrain 16:21, 31 March 2008 (UTC)
 * Sorry - I mostly focused on the PEAR method of installation and I tend to forget details about the other options. Jean-Lou Dupont 16:32, 31 March 2008 (UTC)

I don't understand
Do I simply download and add this program to my extensions folder to get the HTML extension to work? Or is there programming involved? I am confused by the download instructions.

What is the short php code and what is the longer php code? Are either of these required to get this extension to work?

Can you please explain what the short php code and what is the longer php code is and whether it is required? Then I can rewrite the instructions for a lay audience with little or no programming experience, like myself. Odessaukrain 14:52, 31 March 2008 (UTC)
 * Please get up to speed with PEAR as it is (almost) the only way I support my extensions. Once this is done, I can happily entertain other questions. Thanks for your comprehension. Jean-Lou Dupont 15:23, 31 March 2008 (UTC)
 * It is rather frustrating to me, a new user, to feel like I am being dismissed several times when I ask simple questions. I am asking questions because I want your wonderful program to work on my mediawiki. While I learn how to add this extension to my mediawiki, I am attempting to help this extension page be clearer for not only users like me, but all users.  This way everyone benefits--I get the extension on my mediawiki, you have more user friendly instructions, and other users benefit from those instructions.
 * I know I have made mistakes because of my own ignorance. For that I apologize.
 * I am no longer editing your pages. I have spent a lot of time attempting to learn the complex terminology that is on this page.
 * There are two solutions presented on this page, a normal extension way, which most wikiusers use to install extensions, and the PEAR extension way.
 * I would like to know how to install this extension the normal extension way. That is why I asked the above question. Can you please take one minute and answer it?
 * You didn't delete my new header, Create a stub for the short php code and longer php code section, so the header title is correct: this is simply an example of how to Create a stub, not part of the installation?
 * Thanks in advance. Odessaukrain 16:40, 31 March 2008 (UTC)
 * Sorry - I didn't see this question before!! You are correct: there is a section meant for ones that would like to build on StubManager for their own extensions whilst the rest of the page is meant for normal users. Jean-Lou Dupont 19:40, 3 August 2008 (UTC)

How can I test if this extension works
How can I test if this extension works?

Because if I install this required extension first and don't test it, and then install SecureHTML and have problems, I don't know how to tell which one is working improperly. Odessaukrain 14:59, 31 March 2008 (UTC)
 * No test available. This extension is just a helper for my other extensions. Sorry... maybe on some other release. You can always file a report on the site .Jean-Lou Dupont 15:21, 31 March 2008 (UTC)
 * Thanks. Why would I want to file a report when I can talk to the author of this incredible program here? I assume a report is a good thing. Odessaukrain 16:42, 31 March 2008 (UTC)
 * I found a way to see if this extension is on your mediawiki. Special:Version Odessaukrain 16:02, 3 August 2008 (UTC)

Possibly needs to be changed
Under Creating a stub 
 * Creating a Stub is meant for extension writers, not users of the extensions. Jean-Lou Dupont 17:35, 31 March 2008 (UTC)

The below needs to be moved above, into the Installation section.

Save StubManager.php in the extensions folder.

in  at the top, after the require line add:

Under: Examples

I am unsure how the citied "Examples" Email Log extension is an example of this extension, it simply connects to Email Log extension, which doesn't have an example. Is this an example of a program in which Stubs is a required program (what you term a "dependency"?
 * A dependency is any other piece of code which is required for the said extension to work. Jean-Lou Dupont 17:35, 31 March 2008 (UTC)

Maybe change the examples section to:
 * For an example of an extension which depends on this, see Extension:StubManager.

Extension:StubManager has a working link right now.

Or delete it?

Under: Installation  I think that the localsettings needs to be changed to:
 * require_once( "extensions/StubManager.php" );
 * The current version has no and uses ' ' not " "
 * Not critical, see . Jean-Lou Dupont 17:36, 31 March 2008 (UTC)

Under: Installation 2

You changed:
 * Download StubManager-1.2.0.tgz

to:
 * Download StubManager from



The problem is there are 21 links on http://mediawiki.googlecode.com/svn/tags/StubManager/, and newbie editors like me would wonder which version to download. I downloaded StubManager-1.2.0.tgz which appears to be the correct version. Is there another way to explain which version to download?

Maybe: or:
 * Download the newest version of StubManager [here].
 * with version linked to a tag in the version template. (I could do this if you like)

Odessaukrain 17:14, 31 March 2008 (UTC)
 * Ok for the dynamic link. Thanks. Jean-Lou Dupont 17:35, 31 March 2008 (UTC)

small styles bug
I've got a small styles bug in the version page (it's annoying) and i don't know enough php to look for an answer; it says: /* Jerone || */
 * Please file an issue on and I'll get it fixed, someday. Jean-Lou Dupont 17:44, 2 April 2008 (UTC)

Removed to talk
I removed the following section:

== Installation Note ==

Always make sure that the  statement preceeds any other require statement of dependent extensions in LocalSettings.php. Whilst StubManager will appear as installed in Special:Version, dependent extensions will be registered correctly with it.

Since it is already the first sentence in the installation section. If you think it is necessary Jean, please restore it. Odessaukrain 15:32, 3 August 2008 (UTC)

Error: Too many arguments in Stub->__call
Apparently there is a limit on number of arguments in the __call function. I've found this when I tried to create a parser function with many arguments.

return call_user_func_array(array($obj,$method),$args); replaces the switch statement that calls function with different number of arguments and fixes the problem.

Evgeny Fadeev 22:23, 28 September 2008 (UTC)

createStub2 and edit page hook name
I think there may be a problem with createStub2 and edit page hook name. Let me explain. This is what I understand about the hook. You supply the hook name like so.

'hooks' => array( 'ParserAfterTidy' )

Then you create a stub function named similar to the hook name, but prepended with 'h'.

public function hParserAfterTidy( &$parser, &$text )

That works for all hooks, except that EditPage hooks have an entirely different naming convention.

'hooks' => array ('EditPage::showEditForm:fields'),

So what do I do now? What will the stub function name be?

-- Emceelam 19:40, 1 October 2008 (UTC)
 * Good point; of course you can always use the usual method of hooking up this one. Jean-Lou Dupont 01:42, 2 October 2008 (UTC)

Support for Mediawiki 1.13
I tried getting this to work with MW 1.13.2 and failed. Are there any plans to support it in the near future? Thanks. --Tosfos 19:02, 7 November 2008 (UTC)

I tried as well to install StubManager on MW 1.13.2 and did not see it installed on the Special:Version page. Please add an update for 1.13.2, I'm dying to try out some of your other extensions relying on this one. - Hyo-Son.