如何在MediaWiki中添加User.php的自定义函数?

时间:2018-06-21 18:25:28

标签: php mediawiki

我向User.php添加了以下自定义函数:

public function isUpgraded() {
    return true;
}

以及Foreground.skin.php中的以下内容,这是我的皮肤/主题,Wiki可以简单地访问该函数返回的值:

$isUpgraded= $wgUser->isUpgraded();

但是出现以下异常:

Fatal error: Uncaught Error: Call to undefined method User::isUpgraded() in /home/siteX/public_html/siteX.com/wiki/skins/foreground/Foreground.skin.php:106 Stack trace: #0 /home/siteX/public_html/siteX.com/wiki/includes/skins/SkinTemplate.php(251): foregroundTemplate->execute() #1 /home/siteX/public_html/siteX.com/wiki/includes/OutputPage.php(2388): SkinTemplate->outputPage() #2 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionRenderer.php(135): OutputPage->output() #3 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionRenderer.php(54): MWExceptionRenderer::reportHTML(Object(Error)) #4 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionHandler.php(75): MWExceptionRenderer::output(Object(Error), 2) #5 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionHandler.php(149): MWExceptionHandler::report(Object(Error)) #6 /home/siteX/public_html/dev. in /home/siteX/public_html/siteX.com/wiki/skins/foreground/Foreground.skin.php on line 106

我是否需要在其他文件中注册自定义函数才能使其正常工作?值得一提的是,该代码在MediaWiki 1.23中有效,但是我最近更新为1.31,无法使以下代码正常工作。

0 个答案:

没有答案