I'm installing a plugin on an Learning Management System called Ilias. It's installed correctly, but when I'm trying to update it to make it active it gives this fatal error:
"Fatal error: Call to a member function update() on null in C:\xampp\htdocs\ilias\Services\Component\classes\class.ilObjComponentSettingsGUI.php on line 520"
Which refers of this piece of code:
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);
}
The mentioned line is this one:
$result = $pl->update();
And this is the 'included' file code:
<?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);
}
?>
I don' t understand the error as I didn't change any of the code and all these files were included in the plugin. I hope someone can point out my mistake, thank you!
UPDATE
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;
}