20 declare(strict_types=1);
33 protected \ilDBInterface
$db;
46 if ($this->has_data) {
50 $res = $this->db->query(
"SELECT * FROM " . self::TABLE_NAME);
52 foreach ($this->db->fetchAll(
$res) as
$data) {
53 $this->data[$data[
"plugin_id"]] = [
54 (bool) $data[
"active"],
55 $data[
"last_update_version"] ? $this->data_factory->version($data[
"last_update_version"]) : null,
56 $data[
"db_version"] ? (
int) $data[
"db_version"] : null
59 $this->has_data =
true;
65 return $this->data[
$id][0] ??
false;
71 if (!isset($this->data[$id])) {
72 throw new \InvalidArgumentException(
73 "Unknown plugin '$id'" 79 "active" => [
"integer", $activated ? 1 : 0]
82 "plugin_id" => [
"text", $id]
85 $this->has_data =
false;
91 return $this->data[
$id][1] ?? null;
97 return $this->data[
$id][2] ?? null;
103 if (isset($this->data[$id])) {
107 "last_update_version" => [
"text", (
string) $version],
108 "db_version" => [
"integer", $db_version]
111 "plugin_id" => [
"text", $id]
118 "plugin_id" => [
"text", $id],
119 "active" => [
"integer", 0],
120 "last_update_version" => [
"text", (
string) $version],
121 "db_version" => [
"integer", $db_version]
125 $this->has_data =
false;
128 public function remove(
string $id):
void 130 $this->db->manipulate(
131 "DELETE FROM " . self::TABLE_NAME .
" WHERE plugin_id = " . $this->db->quote(
$id,
"text")
133 $this->has_data =
false;
Data Factory $data_factory
Implementation of ilPluginStateDB over ilDBInterface.
isPluginActivated(string $id)
getCurrentPluginVersion(string $id)
setCurrentPluginVersion(string $id, Version $version, int $db_version)
__construct(Data\Factory $data_factory, \ilDBInterface $db)
Repository interface for plugin state data.
getCurrentPluginDBVersion(string $id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
setActivation(string $id, bool $activated)
A version number that consists of three numbers (major, minor, patch).
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...