eZ Community » Forums » Discussions » Restore a sub tree from the trash in...
expandshrink

Thursday 16 February 2012 7:42:55 pm - 9 replies

» Read full blog post

Introduction

The trash is great: it just happens that you will accidentally delete an item, and you can simply recover and place it in the original location. This works well if you deleted a single item, but If the item you deleted has many sub items, this becomes cumbersome. A long time ago  this issue had been raised, but so far no solution has been created.

As it recently happened that I had to restore a large number of items from a sub tree from the trash, I created this script. Given a node ID, it restores the node itself and all items from the trash that are sub items (to any depth) from this node.

Thursday 16 February 2012 8:36:26 pm

Wow, just wow!

Thanks Harry for this fine contribution. I'm sure it will save me many headaches! happy.gif Emoticon

Friday 17 February 2012 1:18:14 pm

VERY usefull, thanks !

This script should find his way to ezpublish bin/php scripts, pull request ?

Friday 17 February 2012 9:47:45 pm

I think theres a bug, should be:

    $location = eZNodeAssignment::fetch( $object->ID, $version->Version, $parentNodeID );

Otherwise thanks!  Just what i needed right now!  Silly users, deleting stuff left and right happy.gif Emoticon

Saturday 18 February 2012 1:09:13 am

I think theres a bug, should be:

    $location = eZNodeAssignment::fetch( $object->ID, $version->Version, $parentNodeID );

Otherwise thanks!  Just what i needed right now!  Silly users, deleting stuff left and right happy.gif Emoticon

Double-checked, but I don't see a difference with the given code, do I overlook something?

Saturday 18 February 2012 10:53:22 am

It should find its way to the BO's GUI, don't aim so modestly low. blunk.gif Emoticon

Thursday 19 April 2012 12:40:52 pm

I'm currently in the situation where I'm trying to restore a subtree, but the top node of this tree cannot be restored at the original location. Where do I find the original node_id that I should enter in the --restore-id parameter of the script? Afaik an item in the trash has no node_id anymore. Or am I missing something?

Thursday 19 April 2012 12:48:28 pm

Quote from Sander van den Akker :

I'm currently in the situation where I'm trying to restore a subtree, but the top node of this tree cannot be restored at the original location. Where do I find the original node_id that I should enter in the --restore-id parameter of the script? Afaik an item in the trash has no node_id anymore. Or am I missing something?

Hi Sander,

It should be in eznode_assignment table, i think. Have you checked there.

Thursday 19 April 2012 12:54:00 pm

Thanks, I already found it in $object.current.main_node_id

This script just saved me a lot of work, thanks Harry!

Thursday 19 April 2012 9:34:25 pm

Thanks for the feedback, always nice to hear that the script is being used.

You found the node ID already. You can also find it in the admin site, after creating the node, under the 'Details' tab.

Regards,

Harry

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from