On Sun, Jan 27, 2013 at 6:42 PM, Matthew Flaschen
<mflasc...@wikimedia.org>wrote:

> On 01/27/2013 07:58 PM, S Page wrote:
> > How can an extension have a soft requirement on a module, so that it
> > only adds that module to its ResourceLoader dependencies if the
> > extension providing that module is loaded?
> >
> > For example, there's no sense in depending on ext.eventLog if the wiki
> > doesn't load Extension:EventLogging, but if it's available then you
> > want the module sent to the browser along with your code. (Obviously
> > your JS would check to see if the module's functions are available
> > before invoking them.)
>
> That's one design decision, but I don't think it's the obvious one.  In
> fact, it's rather uncommon.
>
> The way most loggers are used, you can always call the log function
> (without checking, or defining your own shim), and it's up to the
> logging library to be a no-op or actually log.
>
> Matt Flaschen
>
>
I agree, but if it is unknown whether the wiki had this logging library
installed, that approach doesn't help.

However to get back at S' question, I'd recommend changing the rules
because the game is no fun this way.

Variable dependencies mean you can't rely on something, that's an
unacceptable design. Whatever it is that insists the need for a variable
dependency should be changed instead.

I think the picture you present is misrepresented. I'd say, just depend on
it. But for some reason you don't want to.

Requiring that the wiki install it seems like a trivial thing. That can't
be the real reason.

I presume that when you say it is unknown whether the wiki has it
installed, the real issue is that it is unknown whether the wiki has it
enabled at this time.

Being able to disable logging whenever you desire is a valid use case.

However in that case the problem lies with the logging library to come up
with a sane way to enable/disable the library that does not involve
commenting out the "require_once" line of the extensions' installation. But
for example something like $wgEventLoggingEnable.

Then the logging library would disable the backend API when the extension
is disabled and also swap the front-end client for a no-op.

-- Krinkle
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to