diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-09-21 23:25:57 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-09-21 23:31:44 +0200 |
commit | 8cfa618df51801359736e43b4aa4044aadb0ed23 (patch) | |
tree | e676517b0316466dbb8e615b370b46d7531dd51a /apps/files_sharing/appinfo/update.php | |
parent | 11bdc8baa88ebb56cef25c0dd45dbd26268f97b4 (diff) | |
download | nextcloud-server-8cfa618df51801359736e43b4aa4044aadb0ed23.tar.gz nextcloud-server-8cfa618df51801359736e43b4aa4044aadb0ed23.zip |
Catch exceptions in upgrading files_sharing, skip the errors for now
Diffstat (limited to 'apps/files_sharing/appinfo/update.php')
-rw-r--r-- | apps/files_sharing/appinfo/update.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php index eabd1167c97..5ef7a8bbb9c 100644 --- a/apps/files_sharing/appinfo/update.php +++ b/apps/files_sharing/appinfo/update.php @@ -1,6 +1,7 @@ <?php $installedVersion = OCP\Config::getAppValue('files_sharing', 'installed_version'); if (version_compare($installedVersion, '0.3', '<')) { + $update_error = false; $query = OCP\DB::prepare('SELECT * FROM `*PREFIX*sharing`'); $result = $query->execute(); $groupShares = array(); @@ -38,10 +39,19 @@ if (version_compare($installedVersion, '0.3', '<')) { $shareWith = $row['uid_shared_with']; } OC_User::setUserId($row['uid_owner']); - OCP\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions); + try { + OCP\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions); + } + catch (Exception $e) { + $update_error = true; + echo 'Skipping sharing "'.$row['source'].'" to "'.$shareWith.'" (error is "'.$e->getMessage().'")<br/>'; + } } } + if ($update_error) { + throw new Exception('There were some problems upgrading the sharing of files'); + } // NOTE: Let's drop the table after more testing // $query = OCP\DB::prepare('DROP TABLE `*PREFIX*sharing`'); // $query->execute(); -}
\ No newline at end of file +} |