Definition at line 23 of file Deletion.php.
◆ __construct()
◆ deleteObjectsByRefIds()
ILIAS\Repository\Deletion\Deletion::deleteObjectsByRefIds |
( |
array |
$ids | ) |
|
Delete: If trash is enabled, objects are moved to the trash.
If trash is disabled, objects are removed from system directly.
- Returns
- int[]
Definition at line 40 of file Deletion.php.
References ILIAS\Repository\Deletion\Deletion\moveToTrash(), and ILIAS\Repository\Deletion\Deletion\removeObjectsFromSystemByRefIds().
43 if (count($del_ids = $this->tree->getDeletedTreeNodeIds($ids)) > 0) {
44 throw new AlreadyDeletedException(
'Deletion: Some tree nodes are already deleted: ' . implode(
', ', $del_ids));
48 if (count($miss_ids = $this->permission->getRefIdsWithoutDeletePermission($ids)) > 0) {
49 throw new MissingPermissionException(
'Deletion: missing permission: ' . implode(
', ', $miss_ids));
52 if ($this->trash_enabled) {
removeObjectsFromSystemByRefIds(array $ref_ids, bool $direct_from_tree=false)
Remove objects from system directly ($direct_from_tree === true) or from trash ($direct_from_tree ===...
◆ moveToTrash()
ILIAS\Repository\Deletion\Deletion::moveToTrash |
( |
array |
$ids | ) |
|
|
protected |
Definition at line 233 of file Deletion.php.
References $id.
Referenced by ILIAS\Repository\Deletion\Deletion\deleteObjectsByRefIds().
237 $affected_parents = [];
238 foreach ($ids as
$id) {
239 if ($this->tree->isDeleted($id)) {
240 throw new AlreadyDeletedException(
"Move To Trash: Object with ref_id: " . $id .
" already deleted.");
243 $subnodes = $this->tree->getSubtree($this->tree->getNodeData($id));
245 foreach ($subnodes as $subnode) {
246 $this->permission->revokePermission((
int) $subnode[
"child"]);
248 $affected_ids[$subnode[
"child"]] = $subnode[
"child"];
249 $affected_parents[$subnode[
"child"]] = $subnode[
"parent"];
252 $this->
event->beforeMoveToTrash($id, $subnodes);
254 if (!$this->tree->moveToTrash($id)) {
255 throw new AlreadyDeletedException(
"Move To Trash: Object with ref_id: " . $id .
" already deleted.");
261 foreach ($affected_ids as $aid) {
262 $this->
event->afterMoveToTrash($aid, $affected_parents[$aid]);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
◆ removeDeletedNodes()
ILIAS\Repository\Deletion\Deletion::removeDeletedNodes |
( |
int |
$a_node_id, |
|
|
array |
$a_checked, |
|
|
bool |
$a_delete_objects, |
|
|
array & |
$a_affected_ids |
|
) |
| |
|
protected |
Remove already deleted objects within the objects in trash.
Definition at line 170 of file Deletion.php.
References Vendor\Package\$e.
Referenced by ILIAS\Repository\Deletion\Deletion\removeObjectsFromSystemByRefIds().
177 foreach ($this->tree->getTrashedSubtrees($a_node_id) as $tree_id) {
180 if (!in_array($tree_id, $a_checked)) {
181 $deleted_tree = $this->tree->getTree($tree_id);
182 $a_checked[] = $tree_id;
186 $del_node_data = $deleted_tree->getNodeData($tree_id);
187 $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
191 if ($a_delete_objects) {
192 foreach ($del_subtree_nodes as $node) {
193 $object = $this->
object->getInstanceByRefId($node[
"ref_id"]);
194 if (!is_null($object)) {
195 $a_affected_ids[$node[
"ref_id"]] = [
196 "ref_id" => $node[
"ref_id"],
197 "obj_id" => $object->getId(),
198 "type" => $object->getType(),
199 "old_parent_ref_id" => $node[
"parent"]
201 $this->
event->beforeObjectRemoval(
210 $this->
event->failedRemoval(
222 $trash_tree = $this->tree->getTree((
int) $del_node_data[
'tree']);
223 $trash_tree->deleteTree($del_node_data);
224 $this->
event->afterTreeDeletion(
225 (
int) $del_node_data[
'tree'],
226 (
int) $del_node_data[
'child']
removeDeletedNodes(int $a_node_id, array $a_checked, bool $a_delete_objects, array &$a_affected_ids)
Remove already deleted objects within the objects in trash.
◆ removeObjectsFromSystemByRefIds()
ILIAS\Repository\Deletion\Deletion::removeObjectsFromSystemByRefIds |
( |
array |
$ref_ids, |
|
|
bool |
$direct_from_tree = false |
|
) |
| |
Remove objects from system directly ($direct_from_tree === true) or from trash ($direct_from_tree === false)
Definition at line 63 of file Deletion.php.
References Vendor\Package\$e, $id, null, ILIAS\Repository\object(), and ILIAS\Repository\Deletion\Deletion\removeDeletedNodes().
Referenced by ILIAS\Repository\Deletion\Deletion\deleteObjectsByRefIds().
70 foreach ($ref_ids as
$id) {
74 if (!$direct_from_tree) {
76 $saved_tree = $this->tree->getTrashTree($id);
77 $node_data = $saved_tree->getNodeData($id);
79 $subtree_nodes = $saved_tree->getSubTree($node_data);
82 $node_data = $this->tree->getNodeData($id);
84 $subtree_nodes = $this->tree->getSubTree($node_data);
87 $this->
event->beforeSubTreeRemoval(
92 if (!$direct_from_tree) {
100 foreach ($subtree_nodes as $node) {
101 if (!$node_obj = $this->
object->getInstanceByRefId($node[
"ref_id"])) {
108 $this->
event->beforeObjectRemoval(
110 $node_obj->getRefId(),
111 $node_obj->getType(),
112 $node_obj->getTitle()
114 $affected_ids[$node[
"ref_id"]] = [
115 "ref_id" => $node[
"ref_id"],
116 "obj_id" => $node_obj->getId(),
117 "type" => $node_obj->getType(),
118 "old_parent_ref_id" => $node[
"parent"]
125 if (!$direct_from_tree || $node_obj->getType() !==
"fold") {
129 $this->
event->failedRemoval(
131 $node_obj->getRefId(),
132 $node_obj->getType(),
133 $node_obj->getTitle(),
142 if (!$direct_from_tree) {
144 $saved_tree->deleteTree($node_data);
147 $this->tree->deleteTree($node_data);
150 $this->
event->afterTreeDeletion(
151 (
int) $node_data[
'tree'],
152 (
int) $node_data[
'child']
157 foreach ($affected_ids as $aid) {
158 $this->
event->afterObjectRemoval(
162 $aid[
"old_parent_ref_id"]
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
removeDeletedNodes(int $a_node_id, array $a_checked, bool $a_delete_objects, array &$a_affected_ids)
Remove already deleted objects within the objects in trash.
The documentation for this class was generated from the following file: