99 *
1010 * For more details see the README.md file distributed with this module.
1111 *
12- * @copyright 2013-2016 Teppo Koivula
12+ * @copyright 2013-2017 Teppo Koivula
1313 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License, version 2
1414 */
1515class ProcessVersionControl extends Process implements ConfigurableModule {
@@ -25,7 +25,7 @@ class ProcessVersionControl extends Process implements ConfigurableModule {
2525 'summary' => 'Provides the interface required by Version Control.',
2626 'href' => 'http://modules.processwire.com/modules/version-control/',
2727 'author' => 'Teppo Koivula',
28- 'version' => '1.2.4 ',
28+ 'version' => '1.2.5 ',
2929 'singular' => true,
3030 'autoload' => false,
3131 'permission' => 'version-control',
@@ -239,9 +239,12 @@ class ProcessVersionControl extends Process implements ConfigurableModule {
239239 }
240240
241241 // find values
242+ // - MIN() function calls are required in order to avoid errors when
243+ // MySQL is using SQL mode ONLY_FULL_GROUP_BY
244+ // - some MIN() function calls may not be necessary for MySQL 5.7.5+
242245 $stmt = $this->database->prepare("
243- SELECT r.pages_id, f.name AS field_name, r.timestamp, r.users_id, r.username, d.revisions_id, d.property, d. data
244- FROM fields AS f, " . VersionControl::TABLE_REVISIONS . " AS r, " . VersionControl::TABLE_DATA . " AS d
246+ SELECT MIN( r.pages_id) pages_id, MIN( f.name) field_name, MIN( r.timestamp) timestamp, MIN( r.users_id) users_id, MIN( r.username) username, MIN( d.revisions_id) revisions_id, MIN( d.property) property, MIN(d.data) data
247+ FROM fields f, " . VersionControl::TABLE_REVISIONS . " r, " . VersionControl::TABLE_DATA . " d
245248 WHERE r.pages_id IN (" . rtrim(str_repeat('?, ', count($page_ids)), ', ') . ") AND d.revisions_id = r.id AND f.id = d.fields_id
246249 GROUP BY r.id, f.id
247250 ORDER BY f.id, d.id DESC
0 commit comments