Jump to:

3372 Posts in 998 Topics by 712 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Suppress page versioning?

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

Page: 1
Go to End
Author Topic: 813 Views
  • johnmblack
    Avatar
    Community Member
    61 Posts

    Suppress page versioning? Link to this post

    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

  • martimiz
    Avatar
    Forum Moderator
    1035 Posts

    Re: Suppress page versioning? Link to this post

    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...

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Suppress page versioning? Link to this post

    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)

  • johnmblack
    Avatar
    Community Member
    61 Posts

    Re: Suppress page versioning? Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Suppress page versioning? Link to this post

    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).

    813 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.