MediaWiki Hook for Installing Extension -
i did research on mediawiki hooks.
to best of knowledge, hook adding/updating database tables https://www.mediawiki.org/wiki/manual:hooks/loadextensionschemaupdates.
however, need hook fires on installing new extension. how achieve that? i'd execute create table
statement once - when extension installed. installing extension doesn't require mediawiki update, why above hook not suit needs.
edit
to clarify: i'm developing extension requires access custom table in database. that's why need execute create table
statement whenever extension installed.
first: have noticed, there no such hook. need check installed extensions cron job (if it's server), or on, say, each 100th request wiki, using job queue (if doing in extension).
from there, have few options, depending on if need catch every single extension, or of them:
check registered extensions, like:
$registry = extensionregistry::getinstance();
$extensions = $registry->loaded();
this work extensions using new style. older versions, check global variable$wgextensioncredits
registered extensions. note nothing prevents extensions running without registering. in fact, there lot of extensions that.parse localsettings.php, , check old , new style extension loading regex. dirty, it's way e.g. maintainance script getconfiguration.php it. need check lines this:
wfloadextension( 'foobar' );
and this:wfloadextensions( ['foo', 'bar'] );
and this:require_once "$ip/extensions/foo/bar.php";
note possible use other directories extensions, , modern skins in fact behave extensions too.if need track family of extensions, , can make sure use composer, parse
$ip/composer.json
installed extensions.
Comments
Post a Comment