summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/Migration.php
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-03-28 15:11:07 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2017-04-03 10:20:49 +0200
commit0d5147bd492e11dcb1ed264bcc27d21dc026c6f1 (patch)
tree987445dafba0171b933727e6b4060ba7ad4845e6 /apps/files_sharing/lib/Migration.php
parentd0eefd17d3c47de8d13d41e57a2a6966af94428f (diff)
downloadnextcloud-server-0d5147bd492e11dcb1ed264bcc27d21dc026c6f1.tar.gz
nextcloud-server-0d5147bd492e11dcb1ed264bcc27d21dc026c6f1.zip
add new password column to the share table in order to set passwords for share by mails
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/files_sharing/lib/Migration.php')
-rw-r--r--apps/files_sharing/lib/Migration.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Migration.php b/apps/files_sharing/lib/Migration.php
index 605a11fd22c..49e275cbe6e 100644
--- a/apps/files_sharing/lib/Migration.php
+++ b/apps/files_sharing/lib/Migration.php
@@ -123,6 +123,24 @@ class Migration {
$this->config->deleteAppValue('core', 'shareapi_allow_public_notification');
}
+ public function addPasswordColumn() {
+ $query = $this->connection->getQueryBuilder();
+ $query
+ ->update('share')
+ ->set('password', 'share_with')
+ ->where($query->expr()->eq('share_type', $query->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK)))
+ ->andWhere($query->expr()->isNotNull('share_with'));
+ $query->execute();
+
+ $clearQuery = $this->connection->getQueryBuilder();
+ $clearQuery
+ ->update('share')->set('share_with', $clearQuery->createNamedParameter(null))
+ ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK)));
+
+ $clearQuery->execute();
+
+ }
+
/**
* find the owner of a re-shared file/folder
*