Author
|
Message
|
Ciaran McGrath
|
Friday 29 August 2008 9:28:29 am
I need to remove a lot of objects, specifically users from a particular user group. Is there any way to do this en-masse? Selecting 50 users at a time and clicking remove is going to take quite some time as there are about 50,000 users. Is there any way to safely remove these quickly? In case it's relevant, I'm using ez 3.9.0
|
Ekkehard Dörre
|
Friday 29 August 2008 10:15:22 am
Hi Ciaran, you can look at http://ez.no/doc/ez_publish/technical_manual/3_10/reference/scripts/generic/ezsubtreeremove_php Greetings ekke
http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing
|
James Stevens
|
Friday 29 August 2008 10:38:39 am
Hi Ciaran, I don't believe the admin panel will allow you to delete many objects over 100 in one go. I know i've hit limits previously, where it advised me to use ezsubtreeremove.php. I used this recently to delete a bunch of unrequired objects:-
php ./bin/php/ezsubtreeremove.php --ignore-trash --nodes-id=1600 --siteaccess=mysiteaccess
I believe the --ignore-trash and --siteaccess switches are optional. To delete multiple subtrees in one go you can separate the node ids by a comma:- --nodes-id=1600,2667,2980 I hope this helps. James
|
Ciaran McGrath
|
Monday 01 September 2008 6:55:52 am
Hi Guys, Thanks for the responses. Does the ezsubtree remove delete the parent object as well? that is, if I use it to remove users, will it also delete the user group they're contained in? I'm trying to avoid that as I think we'll have to rewrite a custom script we've had written for us that refers to the specific node id of the user group.
Regards Ciaran.
|
James Stevens
|
Monday 01 September 2008 8:59:29 am
<i>
Does the ezsubtree remove delete the parent object as well? that is, if I use it to remove users, will it also delete the user group they're contained in? </i> Good question. I haven't used it to remove user objects, but as your're probably going to use the User Group node id to delete all the user below, i would assume yes it will delete the user group as well. Like i said i haven't tried it with user objects. Definitely worth testing it on another unimportant dev ez pubish base first, to check the behavior.
|
Mark Marsiglio
|
Monday 01 September 2008 9:59:28 am
Try creating a new user group called "delete me" or something, then swapping it with the group with all the accounts you want to delete. If you want to keep some of the accounts in that group, you can move them back in the original group after you swap it. This will keep the existing group in tact while giving you a new subtree that you can remove completely. "Swap with another node" is a function in the Advanced submenu of the Content Structure Menu popup menu. You definitely want to use the command line script to delete a subtree with that many objects in it.
http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions
|
André R.
|
Monday 01 September 2008 12:29:51 pm
>Try creating a new user group called "delete me" or something, then swapping it with the group with all the accounts you want to delete.
Just guessing here, but I think Ciaran want to keep it to avoid recreating any role assignments. If so I would consider creating a copy of the script where you fetch the children node id's of the passed nodes and pass those id's to '$deleteIDArrayResult'. Rough ( as in not tested) 4.x patch for the script so it doesn't remove the root of the subtree:
Index: bin/php/ezsubtreeremove.php
===================================================================
--- bin/php/ezsubtreeremove.php (revision 22323)
+++ bin/php/ezsubtreeremove.php (working copy)
@@ -78,13 +78,16 @@
$deleteIDArrayResult = array();
foreach ( $deleteIDArray as $nodeID )
{
- $node = eZContentObjectTreeNode::fetch( $nodeID );
- if ( $node === null )
+ $nodes = eZContentObjectTreeNode::subTreeByNodeID( array('AsObject' => false), $nodeID );
+ if ( $nodes === null )
{
$cli->error( "\nSubtree remove Error!\nCannot find subtree with nodeID: '$nodeID'." );
continue;
}
- $deleteIDArrayResult[] = $nodeID;
+ foreach( $nodes as $node )
+ {
+ $deleteIDArrayResult[] = $node['node_id'];
+ }
}
// Get subtree removal information
$info = eZContentObjectTreeNode::subtreeRemovalInformation( $deleteIDArrayResult );
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom
|
Ciaran McGrath
|
Friday 26 September 2008 4:41:21 am
Hi guys, Thanks for your help. In the end we just created a new empty user group and started using that instead which allowed us to delete the old group including the parent node.
|