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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Bulk Change Page Type? - Solved


Go to End


3 Posts   1183 Views

Avatar
johnmblack

Community Member, 62 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, 1899 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, 62 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.