Update the database to contain a list of tagged areas for a component.
The list of tagged areas is read from [plugindir]/db/tag.php

@param string $componentname - The frankenstyle component name.
358453
public static function reset_definitions_for_component($componentname) {
        global $DB;
        $dir = core_component::get_component_directory($componentname);
        $file = $dir . '/db/tag.php';
        $tagareas = null;
        if (file_exists($file)) {
            require_once($file);
        }

        list($a, $b) = core_component::normalize_component($componentname);
        $component = $b ? ($a . '_' . $b) : $a;

        list($existingareas, $existingcolls) = self::get_definitions_for_component($componentname);

        $itemtypes = array();
        $collections = array();
        $needcleanup = false;
        if ($tagareas) {
            foreach ($tagareas as $tagarea) {
                $record = (object)$tagarea;
                if ($component !== 'core' || empty($record->component)) {
                    if (isset($record->component) && $record->component !== $component) {
                        debugging("Item type {$record->itemtype} has illegal component {$record->component}", DEBUG_DEVELOPER);
                    }
                    $record->component = $component;
                }
                unset($record->tagcollid);
                if (!empty($record->collection)) {
                    // Create collection if it does not exist, or update 'searchable' and/or 'customurl' if needed.
                    $key = $record->collection . ':' . $record->component;
                    $collectiondata = array_intersect_key((array)$record,
                            array('component' => 1, 'searchable' => 1, 'customurl' => 1));
                    $collectiondata['name'] = $record->collection;
                    if (!array_key_exists($key, $existingcolls)) {
                        $existingcolls[$key] = core_tag_collection::create($collectiondata);
                    } else {
                        core_tag_collection::update($existingcolls[$key], $collectiondata);
                    }
                    $record->tagcollid = $existingcolls[$key]->id;
                    $collections[$key] = $existingcolls[$key];
                    unset($record->collection);
                }
                unset($record->searchable);
                unset($record->customurl);
                if (!isset($record->callback)) {
                    $record->callback = null;
                }
                if (!isset($record->callbackfile)) {
                    $record->callbackfile = null;
                }
                if (!isset($record->multiplecontexts)) {
                    $record->multiplecontexts = false;
                }
                $itemtypes[$record->itemtype . ':' . $record->component] = $record;
            }
        }
        $todeletearea = array_diff_key($existingareas, $itemtypes);
        $todeletecoll = array_diff_key($existingcolls, $collections);

        // Delete tag areas that are no longer needed.
        foreach ($todeletearea as $key => $record) {
            self::delete($record);
        }

        // Update tag areas if changed.
        $toupdatearea = array_intersect_key($existingareas, $itemtypes);
        foreach ($toupdatearea as $key => $tagarea) {
            if (!isset($itemtypes[$key]->tagcollid)) {
                foreach ($todeletecoll as $tagcoll) {
                    if ($tagcoll->id == $tagarea->tagcollid) {
                        $itemtypes[$key]->tagcollid = core_tag_collection::get_default();
                    }
                }
            }
            unset($itemtypes[$key]->showstandard); // Do not override value that was already changed by admin with the default.
            self::update($tagarea, $itemtypes[$key]);
        }

        // Create new tag areas.
        $toaddarea = array_diff_key($itemtypes, $existingareas);
        foreach ($toaddarea as $record) {
            self::create($record);
        }

        // Delete tag collections that are no longer needed.
        foreach ($todeletecoll as $key => $tagcoll) {
            core_tag_collection::delete($tagcoll);
        }
    }
895237
public function update(Component $component)
    {
        try {
            execute(new UpdateComponentCommand(
                $component,
                Binput::get('name'),
                Binput::get('description'),
                Binput::get('status'),
                Binput::get('link'),
                Binput::get('order'),
                Binput::get('group_id'),
                Binput::get('enabled', $component->enabled),
                Binput::get('meta', null),
                (bool) Binput::get('silent', false)
            ));
        } catch (QueryException $e) {
            throw new BadRequestHttpException();
        }

        if (Binput::has('tags')) {
            $component->tags()->delete();

            // The component was added successfully, so now let's deal with the tags.
            Collection::make(preg_split('/ ?, ?/', $tags))->map(function ($tag) {
                return trim($tag);
            })->map(function ($tag) {
                return execute(new CreateTagCommand($tag));
            })->each(function ($tag) use ($component) {
                execute(new ApplyTagCommand($component, $tag));
            });
        }

        return $this->item($component);
    }
365972
final public function getComponent(string $componentName = null) : IColumnComponent
    {
        if ($componentName === null) {
            if ($this->hasSingleComponent()) {
                return reset($this->components);
            } else {
                throw InvalidArgumentException::format(
                    'Must supply component name for %s \'%s\' with more than one component: expecting one of (%s), null given',
                    static::$debugType, $this->name, Debug::formatValues(array_keys($this->components))
                );
            }
        }

        if (!isset($this->components[$componentName])) {
            throw InvalidArgumentException::format(
                'Invalid component name for %s \'%s\': expecting one of (%s), %s given',
                static::$debugType, $this->name, Debug::formatValues(array_keys($this->components)), $componentName
            );
        }

        return $this->components[$componentName];
    }
829264
public function userHasAccessToComponent($request, $componentName){
        $component= $this->context->getComponentsDefinition()[$componentName];
        return $this->userHasAccessToComponentDefinition($request, $component);
    }
1270638
public function updateBundleSchema($bundleName)
    {
        if (null === $bundle = $this->_application->getBundle($bundleName)) {
            return;
        }

        try {
            $schemaTool = new SchemaTool($bundle->getEntityManager());
            $classes = $this->getBundleSchema($bundle);
            $schemaTool->updateSchema($classes, true);
            unset($schemaTool);
        } catch (\Exception $e) {}
    }
684784
private function getComponentConfiguration($componentName)
    {
        $componentConfig = array();

        $componentConfigKey = self::COMPONENT_CONFIG_CONFIG_KEY;
        if (isset($this->config[$componentName][$componentConfigKey]) === true) {
            if (is_array($this->config[$componentName][$componentConfigKey]) === false) {
                $errorMessage = sprintf('Invalid configuration of component «%s».', $componentName);
                throw new Exception($errorMessage);
            }

            $componentConfig = $this->config[$componentName][$componentConfigKey];
        }

        return $componentConfig;
    }
1039273
public static function create_missing_messageinbound_handlers_for_component($componentname) {
        global $DB;
        $componentname = \core_component::normalize_componentname($componentname);

        $expectedhandlers = self::load_default_handlers_for_component($componentname);
        foreach ($expectedhandlers as $handler) {
            $recordexists = $DB->record_exists('messageinbound_handlers', array(
                'component' => $componentname,
                'classname' => $handler->classname,
            ));

            if (!$recordexists) {
                $record = self::record_from_handler($handler);
                $record->component = $componentname;
                $DB->insert_record('messageinbound_handlers', $record);
            }
        }
    }
30742
public function addComponent(self $component, $key = null)
    {
        if (null == $key) {
            $this->components[] = $component;
        } else {
            $this->components[$key] = $component;
        }
    }
1236951
private function subtag_check ($tagName)
  {
    $propName = lcfirst ($tagName);
    if ($this->current instanceof Metadata) {
      switch ($this->current->type) {
        // All descendants of a metadata property are always metadata.
        case type::metadata:
          return true;
      }
      // Descendants of a content property are children, not properties.
      return false;
    }
    // If the current component defines an property with the same name as the tag being checked, and if that property
    // supports begin specified as a tag, the tag is a subtag.
    return $this->current->supportsProperties () && $this->current->props->defines ($propName, true);
  }
1275449
public function setName( $name )
	{
		if ( $name == $this->getName() ) { return; }

		$this->_values['name'] = (string) $name;
		$this->setModified();
	}
177888
public function handleRename(string $fileName): void
	{
		if ($this->presenter->isAjax() && $this->editable) {
			$this->template->files = [$this->rename($fileName)];
			$this->redrawControl('itemsContainer');
		} else {
			exit;
		}
	}
238329
public function onPageChanged(Kwf_Component_Event_Component_Abstract $event)
    {
        $this->_updates[] = array(
            'type' => 'componentLink',
            'component_id' => $event->component->componentId
        );
        $this->_log("type=componentLink component_id={$event->component->componentId}");
    }
509337
public function markComponentSuccessfullyUninstalled($name)
    {
        try {
            Option::delete(self::getNameInOptionTable($name));
        } catch (\Exception $e) {
            // case when the option table is not yet created (before 0.2.10)
        }

        /**
         * Event triggered after a component has been uninstalled.
         *
         * @param string $name The component that has been uninstalled.
         */
        Piwik::postEvent('Updater.componentUninstalled', array($name));
    }
947789
public function dropMorphs($name, $indexName = null)
    {
        $this->dropIndex($indexName ?: $this->createIndexName('index', ["{$name}_type", "{$name}_id"]));

        $this->dropColumn("{$name}_type", "{$name}_id");
    }
78147
public function setFirstname($firstname)
	{
		if ( $firstname == $this->getFirstname() ) { return; }

		$this->_values['firstname'] = (string) $firstname;
		$this->setModified();
	}
1072151
public function setComponents($components)
	{
	    if ($components) foreach ($components as $k => $v) {
	        $v = static::formatDefinition($k, $v);
	        if (is_numeric($k)) {
	            $k = static::formatName($v);
	        }
	        $this->set($k, $v);
	    }
	}
883106
function ensurePropertyExists ($propName)
  {
    if (!$this->defines ($propName)) {
      throw new ComponentException(
        $this->component,
        sprintf ("Invalid property <kbd>%s</kbd> specified for a %s instance.", $propName, Debug::typeInfoOf ($this))
      );
    }
  }