19 declare(strict_types=1);
    40         return hash(
'sha256', self::class);
    45         if ($this->mode === self::MATERIALIZED_PATH_TO_NESTED_SET) {
    46             return 'The tree implementation is switched to nested set';
    48         return 'The tree implementation is switched to materialized path';
    66         $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
    67         $settings_factory = $environment->
getResource(Environment::RESOURCE_SETTINGS_FACTORY);
    69         $is_nested_set = $settings_factory->settingsFor(
'common')->get(
'main_tree_impl', 
'ns') === 
'ns';
    71         if ($this->mode === self::NESTED_SET_TO_MATERIALIZED_PATH && $is_nested_set) {
    74             $db->dropIndexByFields(
'tree', [
'lft']);
    75             $db->dropIndexByFields(
'tree', [
'path']);
    76             $db->addIndex(
'tree', [
'path'], 
'i4');
    78             $settings_factory->settingsFor(
'common')->set(
'main_tree_impl', 
'mp');
    79         } elseif ($this->mode === self::MATERIALIZED_PATH_TO_NESTED_SET && !$is_nested_set) {
    83             $ilAtomQuery = $db->buildAtomQuery();
    84             $ilAtomQuery->addTableLock(
'tree');
    86             $ilAtomQuery->addQueryCallable($renumber_callable);
    89             $db->dropIndexByFields(
'tree', [
'lft']);
    90             $db->dropIndexByFields(
'tree', [
'path']);
    91             $db->addIndex(
'tree', [
'lft'], 
'i4');
    93             $settings_factory->settingsFor(
'common')->set(
'main_tree_impl', 
'ns');
    95             throw new UnachievableException(
'The tree implementation switch does already equal the requested mode');
   104             'UPDATE tree SET lft = %s WHERE child = %s',
   114             $children[] = (
int) $row->child;
   117         foreach ($children as $child) {
   122         if (count($children) > 0) {
   126         $query = 
'UPDATE tree SET rgt = %s WHERE child = %s';
   138         $settings_factory = $environment->
getResource(Environment::RESOURCE_SETTINGS_FACTORY);
   140         $is_nested_set = $settings_factory->settingsFor(
'common')->get(
'main_tree_impl', 
'ns') === 
'ns';
   142         if ($this->mode === self::MATERIALIZED_PATH_TO_NESTED_SET) {
   143             return !$is_nested_set;
   146         return $is_nested_set;
 
achieve(Environment $environment)
 
const NESTED_SET_TO_MATERIALIZED_PATH
 
isApplicable(Environment $environment)
 
manipulateF(string $query, array $types, array $values)
 
renumberNestedSet(ilDBInterface $db, int $node_id, int $i)
 
quote($value, string $type)
 
Signals that some goal won't be achievable by actions of the system ever. 
 
getPreconditions(Environment $environment)
 
query(string $query)
Run a (read-only) Query on the database. 
 
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g. 
 
__construct(string $mode)
 
An environment holds resources to be used in the setup process. 
 
static createFromParentRelation(ilDBInterface $db)
 
A configuration with no content. 
 
const MATERIALIZED_PATH_TO_NESTED_SET