9

I want to remove a publication with over 5000 components. First I unpublished all pages. Then I ran a decommission script. When finished, I deleted all pages. Now are only the components left.

I wrote a script for those last components, to remove it all... The script has a do while loop and loops until no component can be deleted anymore. About 1500 of the 5000 components are left. They link to each other. Like: A has a componentlink to B and the other way around.

Before any database hacks or something like that, I wonder what options do I have to delete these components? Let's skip the manual way (where used, and delete). It could be automated though. Or is there a way via the core service to force deletion (I do now use $core.delete(id)).

Any tips?

2 Answers 2

8

Although it sounds like you now have this sorted, two possible alternatives (if you needed to keep the Publication) would have been:

  1. Update the Schemas of the remaining Components to remove the Component Link fields and the use the Component Synchroniser PowerTool to update the remaining Components and then delete them. (This is assuming that these Schemas aren't also used elsewhere (i.e. in another Publication)

  2. Create new 'dummy' Components and then write a Core Service application to iterate through each of the remaining Components and update their Component Link fields to link to the new dummy Components. Once all of the links were updated then you could delete the original Components and then the dummy Components.

2
  • Yeah... thank you. I could overwrite the fields with the component links make them empty using a script (open/save/close component with empty values). Your second option is also valid, but less effective I guess.
    – Harmen
    Commented Feb 23, 2016 at 21:18
  • Yes. The second option is less efficient, but would work if you had shared Schemas that you don't want to modify. Commented Feb 23, 2016 at 21:31
8

What about just deleting the entire Publication?

3
  • Ok. I should have mentioned that deleting the whole publication with these many items will cause a timeout (after 10 minutes). That's why I want to remove as many items as possible. When some left, I can delete the publication.
    – Harmen
    Commented Feb 23, 2016 at 18:52
  • 1
    AFAIK, a complete Publication delete can be done rather efficiently (it's not actually deleting each item individually). If it still takes over 10 minutes, it makes sense to analyze the performance of your DB and maybe improve it by updating stats and rebuilding indices. Commented Feb 23, 2016 at 18:56
  • OK... I just removed the publication like you said. The DB seems to perform outstanding at the moment; everything is gone. Also the 1500 items which were still there before deletion.
    – Harmen
    Commented Feb 23, 2016 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.