我正在一个名为 Ilias 的学习管理系统上安装一个插件。它已正确安装,但是当我尝试对其进行更新以使其处于活动状态时,会出现以下致命错误:
“致命错误:第 520 行 C:\xampp\htdocs\ilias\Services\Component\classes\class.ilObjComponentSettingsGUI.php 中的 null 调用成员函数 update()”
指的是这段代码:
function updatePlugin()
{
include_once("./Services/Component/classes/class.ilPlugin.php");
$pl = ilPlugin::getPluginObject($_GET["ctype"], $_GET["cname"],
$_GET["slot_id"], $_GET["pname"]);
$result = $pl->update();
if ($result !== true)
{
ilUtil::sendFailure($pl->message, true);
}
else
{
ilUtil::sendSuccess($pl->message, true);
}
提到的行是这一行:
$result = $pl->update();
这是“包含”文件代码:
<?php
abstract class ilPluginConfigGUI
{
protected $plugin_object = null;
/**
* Set plugin object
*
* @param object plugin object
*/
final function setPluginObject($a_val)
{
$this->plugin_object = $a_val;
}
/**
* Get plugin object
*
* @return ilPlugin object
*/
public final function getPluginObject()
{
return $this->plugin_object;
}
/**
* Execute command
*
* @param
* @return
*/
function executeCommand()
{
global $ilCtrl, $ilTabs, $lng, $tpl;
$ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "ctype", $_GET["ctype"]);
$ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "cname", $_GET["cname"]);
$ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "slot_id", $_GET["slot_id"]);
$ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "plugin_id", $_GET["plugin_id"]);
$ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "pname", $_GET["pname"]);
$tpl->setTitle($lng->txt("cmps_plugin").": ".$_GET["pname"]);
$tpl->setDescription("");
$ilTabs->clearTargets();
if($_GET["plugin_id"])
{
$ilTabs->setBackTarget(
$lng->txt("cmps_plugin"),
$ilCtrl->getLinkTargetByClass("ilobjcomponentsettingsgui", "showPlugin")
);
}
else
{
$ilTabs->setBackTarget(
$lng->txt("cmps_plugins"),
$ilCtrl->getLinkTargetByClass("ilobjcomponentsettingsgui", "listPlugins")
);
}
$this->performCommand($ilCtrl->getCmd("configure"));
}
abstract function performCommand($cmd);
}
?>
我不明白这个错误,因为我没有更改任何代码并且所有这些文件都包含在插件中。希望有人能指出我的错误,谢谢!
更新
protected function beforeUpdate()
{
return true; // false would indicate that anything went wrong
// update would not proceed
// throw an exception in this case
//throw new ilPluginException($lng->txt(""));
}
/**
* After update processing
*/
protected function afterUpdate()
{
}
/**
* Get plugin object.
*
* @param string $a_ctype IL_COMP_MODULE | IL_COMP_SERVICE
* @param string $a_cname component name
* @param string $a_sname plugin slot name
* @param string $a_pname plugin name
*/
final static function getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
{
global $ilDB;
include_once("./Services/Component/classes/class.ilPluginSlot.php");
$slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
$cached_component = ilCachedComponentData::getInstance();
$rec = $cached_component->lookCompId($a_ctype, $a_cname);
if (! $rec) {
return NULL;
}