3declare(strict_types=1);
47 $this->tree =
$DIC->repositoryTree();
48 $this->
http = $DIC->http();
50 $this->db =
$DIC->database();
55 if ($this->
http->wrapper()->query()->has(
'duplicate_id')) {
56 return $this->
http->wrapper()->query()->retrieve(
66 return $this->
getLang()->txt(
'sysc_grp_tree');
71 return $this->
getLang()->txt(
'sysc_grp_tree_desc');
76 switch ($this->
getTask()->getIdentifier()) {
78 return $this->
getLang()->txt(
'sysc_task_tree_dump');
81 return $this->
getLang()->txt(
'sysc_task_tree_duplicates');
84 return $this->
getLang()->txt(
'sysc_task_tree_missing_reference');
87 return $this->
getLang()->txt(
'sysc_task_tree_missing_tree');
90 return $this->
getLang()->txt(
'sysc_task_structure');
97 switch ($this->
getTask()->getIdentifier()) {
99 return $this->
getLang()->txt(
'sysc_task_tree_dump_desc');
102 return $this->
getLang()->txt(
'sysc_task_tree_duplicates_desc');
105 return $this->
getLang()->txt(
'sysc_task_tree_missing_reference_desc');
108 return $this->
getLang()->txt(
'sysc_task_tree_missing_tree_desc');
111 return $this->
getLang()->txt(
'sysc_task_structure_desc');
124 switch ($this->
getTask()->getIdentifier()) {
128 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
129 'command' =>
'validateDuplicates'
134 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
135 'command' =>
'repairDuplicates'
143 if ($validator->hasScanLog()) {
145 'txt' => $this->
getLang()->txt(
'sysc_action_show_tree'),
146 'command' =>
'showTree'
151 'txt' => $this->
getLang()->txt(
'sysc_action_list_tree'),
152 'command' =>
'listTree'
159 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
160 'command' =>
'findMissing'
165 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
166 'command' =>
'confirmRepairMissing'
174 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
175 'command' =>
'findMissingTreeEntries'
180 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
181 'command' =>
'confirmRepairMissingTreeEntries'
189 'txt' => $this->
getLang()->txt(
'sysc_action_validate'),
190 'command' =>
'analyzeStructure'
195 'txt' => $this->
getLang()->txt(
'sysc_action_repair'),
196 'command' =>
'confirmRepairStructure'
208 $num_failures = $tasks->validateStructure();
212 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_structure_failures') .
' ' . $num_failures,
true);
214 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
216 $this->
getCtrl()->returnToParent($this);
222 $this->
getLang()->txt(
'sysc_message_tree_structure_confirm'),
223 $this->
getLang()->txt(
'sysc_btn_tree_structure'),
234 } elseif ($this->tree->getTreeImplementation() instanceof
ilNestedSetTree) {
242 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
243 $this->
getCtrl()->returnToParent($this);
249 $errors_count = $validator->dumpTree();
253 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_list_failures') .
' ' . $errors_count,
true);
256 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_message_success'),
true);
262 $this->
getCtrl()->returnToParent($this);
268 $scan_log = $validator->readScanLog();
270 if (is_array($scan_log)) {
271 $scan_log =
'<pre>' . implode(
"", $scan_log) .
'</pre>';
272 $this->tpl->setContent($scan_log);
279 $num_failures = $tasks->validateDuplicates();
283 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_duplicate_failures') .
' ' . $num_failures,
true);
285 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
287 $this->
getCtrl()->returnToParent($this);
296 $table->parse($deepest_duplicate);
298 $this->tpl->setContent($table->getHTML());
306 if ($tasks->checkDuplicates()) {
310 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_deleted_duplicate'),
true);
311 $this->
getCtrl()->returnToParent($this);
319 if ($tasks->checkDuplicates()) {
323 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_deleted_duplicate'),
true);
324 $this->
getCtrl()->returnToParent($this);
330 $num_failures = $tasks->findMissing();
334 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_missing_failures') .
' ' . $num_failures,
true);
336 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
338 $this->
getCtrl()->returnToParent($this);
344 $this->
getLang()->txt(
'sysc_message_tree_missing_confirm'),
345 $this->
getLang()->txt(
'sysc_btn_tree_missing'),
353 $tasks->repairMissing();
359 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
360 $this->
getCtrl()->returnToParent($this);
366 $num_failures = $tasks->findMissingTreeEntries();
370 $this->tpl->setOnScreenMessage(
'failure', $this->
getLang()->txt(
'sysc_tree_missing_tree_failures') .
' ' . $num_failures,
true);
372 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
374 $this->
getCtrl()->returnToParent($this);
380 $this->
getLang()->txt(
'sysc_message_tree_missing_confirm'),
381 $this->
getLang()->txt(
'sysc_btn_tree_missing'),
382 'repairMissingTreeEntries'
389 $tasks->repairMissingTreeEntries();
395 $this->tpl->setOnScreenMessage(
'success', $this->
getLang()->txt(
'sysc_message_success'),
true);
396 $this->
getCtrl()->returnToParent($this);
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static createFromParentRelation(ilDBInterface $db)
Base class for nested set path based trees.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
showSimpleConfirmation(string $a_text, string $a_btn_text, string $a_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Defines a system check task.
__construct(ilSCTask $task=null)
confirmRepairMissingTreeEntries()
getActions()
array( 'txt' => $lng->txt('sysc_action_repair') 'command' => 'repairTask' );
repairMissingTreeEntries()
deleteDuplicatesFromTrash()
deleteDuplicatesFromRepository()
getDuplicateIdFromRequest()
Defines a system check task.
static findDeepestDuplicate()
static deleteDuplicateFromTree(int $a_duplicate_id, bool $a_delete_trash)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface GlobalHttpState.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc