Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Bulk Change Page Type? - Solved


Reply


3 Posts   607 Views

Avatar
johnmblack

Community Member, 61 Posts

5 May 2011 at 3:50am

Is there a way to change the page type of a large collection of pages in one action?

For example, if someone entered in 100 press release pages, and selected the wrong page type for every one of them, is there anything I can do besides clicking into each one individually and changing the type on the Behavior tab?

I am familiar with sql, so if there's a relatively-safe backhanded way of doing it, I'm OK with that.

Thanks,

-John

Avatar
swaiba

Forum Moderator, 1798 Posts

5 May 2011 at 4:27am

this should work (i.e. UNTESTED)...

UPDATE SiteTree SET ClassName='NewClass' WHERE ClassName='OldClass';
UPDATE SiteTree_Live SET ClassName='NewClass' WHERE ClassName='OldClass';
UPDATE SiteTree_versions SET ClassName='NewClass' WHERE ClassName='OldClass';

Avatar
johnmblack

Community Member, 61 Posts

6 May 2011 at 7:13am

@swaiba - Thanks, that was the approach that worked -- though I did where ParentID = X instead, since it was only one group of pages with the problem and not all pages of the first type.