[Mediawiki-l] Common php code included more than once from two extensions
Brion Vibber
brion at wikimedia.org
Mon Apr 23 21:50:33 UTC 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Rob Church wrote:
> On 20/04/07, Michael Daly wrote:
>> Since it's not a class, I don't use $wgAutoloadClasses. I'm avoiding
>> making the functions part of an otherwise empty class, since I don't
>> want to use the class::function() syntax. I could put them in a class
>> file that contains an empty class and instantiate it just to load the
>> file, but I was wondering if there is another, commonly accepted way to
>> avoid this problem?
>
> The classic approach to headers and includes, perhaps?
>
> if( !defined( 'MYINCLUDE' ) ) {
> // all the include code
> define( 'MYINCLUDE', true );
> }
You may also consider using function_exists() etc.
- -- brion vibber (brion @ wikimedia.org)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGLSopwRnhpk1wk44RAlNrAJ96zCThLUznjTdW9vQhSjm61xzjPACfcXGz
lZYqs9FQjq925AjAHOS4dJ0=
=D/V7
-----END PGP SIGNATURE-----
More information about the MediaWiki-l
mailing list