summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-09-25 11:47:45 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-09-25 11:47:53 +0200
commit15e02726d76555ea9eb2dd59a88d2310bcd9b08c (patch)
tree8c6c28d05aab0dfb62097cf0802fa65a763d57e8 /apps
parenta8ff1505d658d027168afb5b1b18475bf0d1d9eb (diff)
downloadnextcloud-server-15e02726d76555ea9eb2dd59a88d2310bcd9b08c.tar.gz
nextcloud-server-15e02726d76555ea9eb2dd59a88d2310bcd9b08c.zip
Fix files_sharing update script, by making filesystem and users available
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/appinfo/update.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php
index 5ef7a8bbb9c..dc8c8dd73fc 100644
--- a/apps/files_sharing/appinfo/update.php
+++ b/apps/files_sharing/appinfo/update.php
@@ -5,6 +5,10 @@ if (version_compare($installedVersion, '0.3', '<')) {
$query = OCP\DB::prepare('SELECT * FROM `*PREFIX*sharing`');
$result = $query->execute();
$groupShares = array();
+ //we need to set up user backends, otherwise creating the shares will fail with "because user does not exist"
+ OC_User::useBackend(new OC_User_Database());
+ OC_Group::useBackend(new OC_Group_Database());
+ OC_App::loadApps(array('authentication'));
while ($row = $result->fetchRow()) {
$itemSource = OC_FileCache::getId($row['source'], '');
if ($itemSource != -1) {
@@ -39,6 +43,8 @@ if (version_compare($installedVersion, '0.3', '<')) {
$shareWith = $row['uid_shared_with'];
}
OC_User::setUserId($row['uid_owner']);
+ //we need to setup the filesystem for the user, otherwise OC_FileSystem::getRoot will fail and break
+ OC_Util::setupFS($row['uid_owner']);
try {
OCP\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions);
}
@@ -46,6 +52,7 @@ if (version_compare($installedVersion, '0.3', '<')) {
$update_error = true;
echo 'Skipping sharing "'.$row['source'].'" to "'.$shareWith.'" (error is "'.$e->getMessage().'")<br/>';
}
+ OC_Util::tearDownFS();
}
}
if ($update_error) {