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

Versioned.php Problem




25 October 2012 at 9:42am Community Member, 122 Posts

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') {
               "\"{$alias}_versions\".\"Version\" IN
               (SELECT LatestVersion FROM
                     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.