2 require_once(
'./Services/GlobalCache/classes/class.ilGlobalCacheDBLayer.php');
112 protected function readFromDB() {
118 $set = $ilDB->query(
'SELECT * FROM il_component');
119 while ($rec = $ilDB->fetchAssoc($set)) {
120 $this->il_component[$rec[
'id']] = $rec;
121 $this->obj_def_name_to_id[$rec[
'id']] = $rec[
'name'];
122 $this->obj_def_name_and_type_raw[$rec[
'type']][$rec[
'name']] = $rec;
125 $set = $ilDB->query(
'SELECT * FROM il_object_def');
126 while ($rec = $ilDB->fetchAssoc($set)) {
127 $this->il_object_def[$rec[
'id']] = $rec;
130 $set = $ilDB->query(
'SELECT * FROM il_object_subobj');
131 while ($rec = $ilDB->fetchAssoc($set)) {
132 $this->il_object_subobj[] = $rec;
133 $parent = $rec[
'parent'];
134 $this->subobj_for_parent[$parent][] = $rec;
136 $set = $ilDB->query(
'SELECT DISTINCT(id) AS sid, parent, il_object_def.* FROM il_object_def, il_object_subobj WHERE NOT (system = 1) AND NOT (sideblock = 1) AND subobj = id');
137 while ($rec = $ilDB->fetchAssoc($set)) {
138 $this->grouped_rep_obj_types[$rec[
'parent']][] = $rec;
141 $set = $ilDB->query(
'SELECT * FROM il_pluginslot');
142 while ($rec = $ilDB->fetchAssoc($set)) {
143 $this->il_pluginslot_by_comp[$rec[
'component']][] = $rec;
144 $this->il_pluginslot_by_id[$rec[
'id']] = $rec;
145 $this->il_pluginslot_by_name[$rec[
'name']] = $rec;
148 $set = $ilDB->query(
'SELECT * FROM il_plugin');
149 $this->il_plugin_active = array();
150 while ($rec = $ilDB->fetchAssoc($set)) {
151 $this->il_plugin_by_id[$rec[
'plugin_id']] = $rec;
152 $this->il_plugin_by_name[$rec[
'name']] = $rec;
153 if ($rec[
'active'] == 1) {
154 $this->il_plugin_active[$rec[
'slot_id']][] = $rec;
157 $set = $ilDB->query(
'SELECT * FROM il_object_group');
158 while ($rec = $ilDB->fetchAssoc($set)) {
159 $this->il_object_group[$rec[
'id']] = $rec;
161 $set = $ilDB->query(
'SELECT * FROM il_object_sub_type');
162 while ($rec = $ilDB->fetchAssoc($set)) {
163 $this->il_object_sub_type[$rec[
'obj_type']][] = $rec;
276 $this->il_pluginslot_by_comp = $il_pluginslot_by_service;
396 if (!isset(self::$instance)) {
398 $cached_obj = $global_cache->get(
'ilCachedComponentData');
400 self::$instance = $cached_obj;
402 self::$instance =
new self();
403 $global_cache->set(
'ilCachedComponentData', self::$instance);
413 self::$instance = NULL;
423 return $this->il_plugin_by_name[$name];
433 if (is_array($this->il_plugin_active[$slot_id])) {
434 return $this->il_plugin_active[$slot_id];
447 if (is_array($parent)) {
448 $index = md5(serialize($parent));
449 if (isset($this->cached_results[
'subop_par'][$index])) {
450 return $this->cached_results[
'subop_par'][$index];
454 foreach ($parent as $p) {
455 if (is_array($this->subobj_for_parent[$p])) {
456 foreach ($this->subobj_for_parent[$p] as $rec) {
462 $this->cached_results[
'subop_par'][$index] = $return;
463 $this->changed =
true;
468 return $this->subobj_for_parent[$parent];
479 return $this->obj_def_name_and_type_raw[$type][$name][
'id'];
491 if (isset($this->obj_def_name_and_type_raw[
'Modules'][$name])) {
498 return $this->obj_def_name_and_type_raw[$type][$name];
504 if ($this->changed && $ilGlobalCache->isActive()) {
505 $this->changed =
false;
506 $ilGlobalCache->set(
'ilCachedComponentData', $this);
517 if (is_array($parent)) {
518 $index = md5(serialize($parent));
525 foreach ($parent as $p) {
526 $s = $this->grouped_rep_obj_types[$p];
527 foreach ($s as $child) {
528 if (!in_array($child[
'sid'], $sids)) {
529 $sids[] = $child[
'sid'];
534 $this->changed =
true;
535 $this->cached_results[
'grpd_repo'][$index] = $return;
539 return $this->grouped_rep_obj_types[$parent];
550 if (is_array($this->il_pluginslot_by_comp[$component])) {
551 return $this->il_pluginslot_by_comp[$component];
564 return $this->il_pluginslot_by_id[$id];
574 return $this->il_pluginslot_by_name[$name];