php - Mediawiki Call hook function from another file -


hello need save content database in mediawiki when new page created. added hook in localsettings.php:

$wghooks['pagecontentsavecomplete'][] ='assign_responsibility'; 

but need call function assing_responsibility() extension php file responsibility.php not localsettings. new @ mediawiki system , cant find out how tell mediawiki can find required hook function? thank you

hook values php callables; can defined in file long file gets loaded before hook gets called (or, if use class method instead of global function, class registered via $wgautoloadclasses).

the convention extension (which assume called responsibility) creates hook file:

// responsibilityhooks.php class responsibilityhooks {     public static function onpagecontentsavecomplete(/*...*/) { /*...*/ }     // ... } 

and makes sure can autoloaded:

// responsibility.php $wghooks['pagecontentsavecomplete'][] = 'responsibilityhooks::onpagecontentsavecomplete';    $wgautoloadclasses['responsibilityhooks'] = __dir__ . '/responsibilityhooks.php'; 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -