Vulnerability in EPiServer.Forms
Hi i want to delete a language branch from all pages where its used and from the website. On my site I have multiple language support over 1000 pages with I dont know exactly how many pages use polish (PL) language.I want to remove polish language. I just simply want to delet the language and all pages at once instead go page by page and delete polish individually and then from the site. I am unable to delete when i go to Admin>Config>Manage Website Languages I get this error
The language is used in language settings on the following pages and cannot be deleted: Root , Home ....
Deleting language from individual pages is not so option as there are so many pages in the website.
Can some one kindly help me out with this?
Not sure that's possible, at least nowhere in the UI.
Seems like you'd have to write a small job to loop through your pages and delete that specific language branch.
There are "delete language" methods in both the EPiServer.DataFactory and EPiServer.DataAbstraction.ContentStore namespaces, but they all take a PageReference or ContentReference as parameter, meaning they will only delete the language for the specified page, not all pages in the content tree.
Just for reference, I'm posting the updated solution by Adnan here:
The following code seems to work for me... Easy enough to wrap in an admin plugin.
var pages = _contentRepository.GetDescendents(ContentReference.RootPage);
var datafactory = new DataFactory();
foreach (var page in pages)
datafactory.DeleteLanguageBranch(page, language, AccessLevel.Delete);
// Ignore whether the page exists in the language or not