From 28bd71eb8c1b7c3d11779a8d954017933f7938a5 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 28 Jun 2013 11:26:03 +0200 Subject: [PATCH] Mandanten-WebDAV-Upgrade: nicht an Konfigurationseinstellung sondern Existenz von Dateien festmachen --- locale/de/all | 2 +- sql/Pg-upgrade2-auth/clients_webdav.pl | 18 ++++++++++++++++-- .../dbupgrade/auth/clients_webdav.html | 2 +- webdav/.gitignore | 2 -- 4 files changed, 18 insertions(+), 6 deletions(-) delete mode 100644 webdav/.gitignore diff --git a/locale/de/all b/locale/de/all index 5c36e7bc3..6dfde56ea 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1968,7 +1968,7 @@ $self->{texts} = { 'The LDAP server "#1:#2" is unreachable. Please check config/kivitendo.conf.' => 'Der LDAP-Server "#1:#2" ist nicht erreichbar. Bitte überprüfen Sie die Angaben in config/kivitendo.conf.', 'The SEPA export has been created.' => 'Der SEPA-Export wurde erstellt', 'The SEPA strings have been saved.' => 'Die bei SEPA-Überweisungen verwendeten Begriffe wurden gespeichert.', - 'The WebDAV feature is activated.' => 'Das WebDAV-Feature ist aktiviert.', + 'The WebDAV feature has been used.' => 'Das WebDAV-Feature wurde benutzt.', 'The access rights a user has within a client instance is still governed by his group membership.' => 'Welche Zugriffsrechte ein Benutzer innerhalb eines Mandanten hat, wird weiterhin über Gruppenmitgliedschaften geregelt.', 'The access rights have been saved.' => 'Die Zugriffsrechte wurden gespeichert.', 'The account 3804 already exists, the update will be skipped.' => 'Das Konto 3804 existiert schon, das Update wird übersprungen.', diff --git a/sql/Pg-upgrade2-auth/clients_webdav.pl b/sql/Pg-upgrade2-auth/clients_webdav.pl index 2476e8ac2..6f73f216b 100644 --- a/sql/Pg-upgrade2-auth/clients_webdav.pl +++ b/sql/Pg-upgrade2-auth/clients_webdav.pl @@ -9,6 +9,7 @@ use utf8; use parent qw(SL::DBUpgrade2::Base); +use File::Find (); use File::Path qw(make_path); use IO::Dir; use List::MoreUtils qw(any all); @@ -81,11 +82,24 @@ sub _create_symlink { symlink '../' . $client->{id}, "webdav/links/${name}"; } +sub _webdav_folders_used { + my ($self, %params) = @_; + + my $contains_files = 0; + my $wanted = sub { + $contains_files = 1 if -f && !m{/(?:\.gitignore|.dummy|webdav-user)$}; + }; + + File::Find::find({ wanted => $wanted, no_chdir => 1 }, 'webdav'); + + return $contains_files; +} + sub run { my ($self) = @_; - # WebDAV not activated? Remove old folders, and we're done. - return $self->_unlink_old_folders if !$::lx_office_conf{features}->{webdav}; + # WebDAV not used? Remove old folders, and we're done. + return $self->_unlink_old_folders if !$self->_webdav_folders_used; # Ensure at least one client exists. $self->_ensure_one_client_exists; diff --git a/templates/webpages/dbupgrade/auth/clients_webdav.html b/templates/webpages/dbupgrade/auth/clients_webdav.html index f56032301..6fbd2f2ea 100644 --- a/templates/webpages/dbupgrade/auth/clients_webdav.html +++ b/templates/webpages/dbupgrade/auth/clients_webdav.html @@ -5,7 +5,7 @@

[%- LxERP.t8("Introduction of clients") %] -- [% LxERP.t8("Handling of WebDAV") %]

- [% LxERP.t8("The WebDAV feature is activated.") %] + [% LxERP.t8("The WebDAV feature has been used.") %] [% LxERP.t8("With the introduction of clients each client gets its own WebDAV folder.") %] [% LxERP.t8("In order to migrate the old folder structure into the new structure you have to chose which client the old structure will be assigned to.") %] [% LxERP.t8("All the other clients will start with an empty set of WebDAV folders.") %] diff --git a/webdav/.gitignore b/webdav/.gitignore deleted file mode 100644 index d6b7ef32c..000000000 --- a/webdav/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore -- 2.20.1