Jump to:

23355 Posts in 17691 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Versioned.php Problem

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

Page: 1
Go to End
Author Topic: 282 Views
  • tazzydemon
    Avatar
    Community Member
    120 Posts

    Versioned.php Problem Link to this post

    In my post yesterday entitled "Subsite Module SS3 "All Pages, Including Deleted" Broken" I hinted at a Versioned.php issue

    I believe the augment sql code at line 242 to be in error. It does not even work when used in mysql directly as there appears to be a join missing.

    The sql should be thus

       if($dataQuery->getQueryParam('Versioned.mode') == 'latest_versions') {
                $query->addWhere(
                   "\"{$alias}_versions\".\"Version\" IN
                   (SELECT LatestVersion FROM
                      (SELECT
                         \"{$alias}_versions\".\"RecordID\",
                         MAX(\"{$alias}_versions\".\"Version\") AS LatestVersion
                         FROM \"{$alias}_versions\"
                         GROUP BY \"{$alias}_versions\".\"RecordID\"
                      ) AS \"{$alias}_versions_latest\" JOIN \"{$alias}_versions\"
                      WHERE \"{$alias}_versions_latest\".\"RecordID\" = \"{$alias}_versions\".\"RecordID\"
                   )");
             }

    Note the join in the next to last line. I have not refined this further and there are still probable subsite issues. Feel free to test this by deleted all the pages in a site and then try viewing "All pages, including deleted" with and without this join.

    I was unable to post this as an issue on github as it is not enabled for me.

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