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.

Data Model Questions /

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

Suppress page versioning?


Go to End


5 Posts   1777 Views

Avatar
johnmblack

Community Member, 62 Posts

16 July 2011 at 6:59am

Is there a way to turn off version control of a page or page class?

We might be using SS to display news from another news provider. The news articles are already available to us historically and there is no need to take up space with multiple page versions -- and in fact we would like to delete old articles after 3 months and reclaim the DB space. I'm concerned that the versioned features, normally a great idea, would prevent the deletions from actually saving space.

We expect to grow the articles by 5-10 per day, so it could get unwieldy after a while.

Thanks!

-John

Avatar
martimiz

Forum Moderator, 1391 Posts

16 July 2011 at 8:01am

I'm not sure if you can safely disable versioned for pages... but you could maybe use cron to remove old versions from the versioned tables...

Avatar
Willr

Forum Moderator, 5523 Posts

16 July 2011 at 1:49pm

If you're importing news from another source then perhaps it would be nicer to make those articles as DataObjects rather than pages? That would save the overhead of versions and other sitetree related things which by the sounds of it you won't need (like CMS fields, editing etc)

Avatar
johnmblack

Community Member, 62 Posts

16 July 2011 at 5:23pm

Very interesting -- so I would be subclassing DataObject instead? This would assume that we would not want to ever tweak an article's content in our CMS -- that's a business decision I'll have to run by some folks. But I like the sound of it.

Would the items' properties be usable in SS templates the same way?

Is there a way to inherit any customizations I've done in other extended classes? For example, I've put a lot of stuff in a base item class that underlies all page types... but that extends SiteTree, so I won't get any of those definitions when extending DataObject. I could copy/paste the same customizations, but maybe there's a way to run them on the fly? Wonder if I could parse out the extra fields into a function that could be injected into either class...

Thanks for all your help. If I come up with anything that's half elegant (no guarantees) :-) I'll post it here.

Avatar
Willr

Forum Moderator, 5523 Posts

16 July 2011 at 5:36pm

Very interesting -- so I would be subclassing DataObject instead? This would assume that we would not want to ever tweak an article's content in our CMS -- that's a business decision I'll have to run by some folks. But I like the sound of it.

Yes of course, a number of things you have to consider in this situation and without knowing all the requirements of the project I can't say which will be better, that'll be something to weigh up!

Is there a way to inherit any customizations I've done in other extended classes? For example, I've put a lot of stuff in a base item class that underlies all page types...

Are these tied to the SiteTree model records or to the controller class? Often things are tied to the controller so you can keep your NewsItemController extending the page controller you have already, all you're doing is passing in a Dataobject rather than a Sitetree model.

If you need shared functionality between model types, you can look at things like Decorator classes to apply to both your models.

Would the items' properties be usable in SS templates the same way?

Yes I believe most of the functionality in the templates comes from the ContentController (things like Menu() etc).