Path / documentation / ez publish / technical manual / 3.10 / reference / scripts / generic / ezsubtreeremove.php

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.



Safely removes large subtrees.





-c, --colors

Use ANSI colors when generating debug output (default).

-d[<option>[,<option2>...]], --debug[=<option>[,<option2>...]]

Output debug information. The following options can be used to control what the debug output should include: "all" (everything), "accumulator" (accumulators), "include" (included files), "timing" (timing points), "error" (errors), "warning" (warnings), "notice" (notices).

-h, --help

Output information about the script and supported parameters.


Permanently delete the specified subtrees. Without this parameter, the content will be moved to the trash (note that the tree structure will be lost forever).


Generate log files. This parameter must be used together with the debug parameter ("-d" or "--debug"). The log files (for example "warning.log") will be stored in the "var/log" directory of the eZ Publish installation.


Do not use ANSI colors when generating debug output.


Do not generate log files (default).


The node ID of the subtree or subtrees that should be removed. In case multiple subtrees are to be removed, their node IDs must be provided as a comma separated list. Both the specified nodes and their sub items will be removed. This parameter is required.

-q, --quiet

Run the script in "quiet" mode. No output will be generated.

-s <siteaccess>, --siteaccess=<siteaccess>

The siteaccess to run the script for. If omitted, the default siteaccess will be used.


This script makes it possible to remove subtrees. Typically, it is used to remove subtrees containing more nodes than the "MaxNodesRemoveSubtree" setting allows (these cannot be removed from within the administration interface).

By default, the script will remove content in the same way as it is done from within the administration interface when the "Move to trash" checkbox is selected. In other words, the removed objects will end up in the trash while the tree structure itself (the nodes) will be lost forever. The "--ignore-trash" parameter allows objects to be removed without being put in the trash first.

An object processed by this script will only be put in the trash (or removed when the "--ignore-trash" parameter is used) if it doesn't have other/additional locations than the ones that were specified using the "--nodes-id" parameter.

Note that the script will access the node tree as a certain user. This is controlled by the "UserCreatorID" setting. If the specified user is not allowed to remove a particular subtree, the script will output an error message.


Example 1

php bin/php/ezsubtreeremove.php --nodes-id=65

Remove node 65 and all its sub items. If the object encapsulated by node 65 does not have other locations, it will be moved to the trash.

Example 2

php bin/php/ezsubtreeremove.php --nodes-id=65 --ignore-trash

Remove node 65 and all its sub items. If the object encapsulated by node 65 does not have other locations, it will be permanently removed.

Example 3

php bin/php/ezsubtreeremove.php --nodes-id=60,65,78

Nodes 60, 65, 78 and all their sub items will be removed.

Julia Shymova (13/11/2007 4:32 pm)

Svitlana Shatokhina (20/03/2008 10:35 am)


There are no comments.