Last modified: 2010-05-15 14:36:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T5420, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 3420 - Allow Variable Extensions
Allow Variable Extensions
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.6.x
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-10 23:51 UTC by Jamie Bliss
Modified: 2010-05-15 14:36 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Proposed implementation (1.5) (3.09 KB, patch)
2005-09-10 23:53 UTC, Jamie Bliss
Details
Example Extension using the previous implementation (334 bytes, text/plain)
2005-09-10 23:56 UTC, Jamie Bliss
Details
Proposed implementation (1.5) (3.28 KB, patch)
2005-09-11 00:12 UTC, Jamie Bliss
Details
Proposed implementation (1.5) (3.35 KB, patch)
2005-09-11 00:26 UTC, Jamie Bliss
Details
Implementation using the existing hook system (2.54 KB, patch)
2005-11-25 06:58 UTC, Ævar Arnfjörð Bjarmason
Details

Description Jamie Bliss 2005-09-10 23:51:50 UTC
You should allow for extensions to define new variables (eg, {{FOO}}).
Comment 1 Jamie Bliss 2005-09-10 23:53:50 UTC
Created attachment 869 [details]
Proposed implementation (1.5)

This is my implementation of this bug. It modifies MagicWord.php, Parser.php,
and SpecialVersion.php.
Comment 2 Jamie Bliss 2005-09-10 23:56:19 UTC
Created attachment 870 [details]
Example Extension using the previous implementation

This is an example extension that creates the variable RANDOM. It should be
fairly self-explainatory.
Comment 3 Jamie Bliss 2005-09-11 00:12:16 UTC
Created attachment 871 [details]
Proposed implementation (1.5)

Added a few more comments in MagicWord.php
Comment 4 Jamie Bliss 2005-09-11 00:26:16 UTC
Created attachment 872 [details]
Proposed implementation (1.5)

Some phpdoc corrections, other comment changes.
Comment 5 Jamie Bliss 2005-10-07 13:20:50 UTC
I just realized that in Parser.php, it does not cache the result of it in the
static $varCache.  (Parser::getVariableValue().)

I'm not sure this would be a bug or a feature.
Comment 6 Ævar Arnfjörð Bjarmason 2005-11-25 06:58:08 UTC
Created attachment 1099 [details]
Implementation using the existing hook system

Your implementation of this was overly complex and redundant, we already have
an all purpose hook system in place and there's no need to write a custom one
for this occation when that one will do perfectly. I've commited my own
implementation of this (attached) using the existing system. You can find an
example extension that implements it called Variable_hook.php in the examples
directory in the extensions module in CVS HEAD.
Comment 7 Ævar Arnfjörð Bjarmason 2005-11-25 06:59:03 UTC
Marking this as FIXED in CVS HEAD.
Comment 8 Jamie Bliss 2005-11-25 17:09:10 UTC
(In reply to comment #6)
> Created an attachment (id=1099) [edit]
> Implementation using the existing hook system
> 
> Your implementation of this was overly complex and redundant, we already have
> an all purpose hook system in place and there's no need to write a custom one
> for this occation when that one will do perfectly. I've commited my own
> implementation of this (attached) using the existing system. You can find an
> example extension that implements it called Variable_hook.php in the examples
> directory in the extensions module in CVS HEAD.

I was aiming for implementation similar to the parser extensions. (ie, you
register your variable, and the parser calls your function.)

But in hindsight, your version is more flexible in that you could use it to do
simple {{foo:...}} extensions (but no params).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links