Path

7x / documentation / ez publish / technical manual / 4.x / reference / scripts / generic / ezsubtreeremove.php


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

ezsubtreeremove.php

Summary

Safely removes large subtrees.

Location

./bin/php/ezsubtreeremove.php

Parameters

colors
debug
help
ignore-trash
logfiles
no-colors
no-logfiles
nodes-id
quiet
siteaccess

-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.

--ignore-trash

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).

--logfiles

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.

--no-colors

Do not use ANSI colors when generating debug output.

--no-logfiles

Do not generate log files (default).

--nodes-id=<node_id>[,<node_id2>…]

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.

Description

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.

Examples

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)

Julia Shymova (01/04/2008 2:12 pm)

Svitlana Shatokhina, Julia Shymova


Comments

  • takes years to remove very large subtrees

    I have to test massive data import of 10000+ objects.
    If I have to remove the subtrees, it takes hours even on a dual core machine.
    If you want eZ to be a real enterprise level CMS , you should come up with something more efficient to do the job!

    My workaround is to hotcopy the ez db and restore it, if I have to run another import test...


    • Re: takes years to remove very large subtrees

      Hi, could you please report the problem to http://issues.ez.no with more detailed info? This is where things should be posted if you want them to affect future releases. Thank you!