From 65b3d293ce7446d8940820f78263a0d9862a3f40 Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Wed, 11 Jun 2014 14:28:30 +0200
Subject: [PATCH] Added ORDER BY to enforce share entry order

Sometimes MySQL decides to return the shares in the wrong order, but
some parts of the code seem to require the order to be known, at least
so that the parent shares come before the children shares.

This fix adds an ORDER BY clause to force the order by id.
---
 lib/private/share/share.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 883fbd1b29..a3de8ebc0e 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -1211,6 +1211,7 @@ class Share extends \OC\Share\Constants {
 			}
 		} else {
 			$queryLimit = null;
+			$where .= ' ORDER BY `*PREFIX*share`.`id` ASC';
 		}
 		$select = self::createSelectStatement($format, $fileDependent, $uidOwner);
 		$root = strlen($root);
-- 
GitLab