From: Martin Helmling martin.helmling@octosoft.eu Date: Wed, 14 Jun 2017 05:40:13 +0000 (+0200) Subject: Filesystem Wurzelverzeichnis nun in kivitendo.conf X-Git-Tag: release-3.5.4~1047 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=bf980f4c7394345e77711c389c1b3b1c3c764213;p=kivitendo-erp.git Filesystem Wurzelverzeichnis nun in kivitendo.conf Das Rootverzeichnis für die Dokumente ist nun nicht mehr per Mandantenkonfig einstellbar sondern ist unter [paths] in kivitendo.conf zu setzen. Siehe auch Doku und kivitendo.conf.default behebt nochmals #525 (redmine) --- diff --git a/SL/File/Backend/Filesystem.pm b/SL/File/Backend/Filesystem.pm index 19d81e334..72e8f3063 100644 --- a/SL/File/Backend/Filesystem.pm +++ b/SL/File/Backend/Filesystem.pm @@ -85,7 +85,7 @@ sub get_mtime { die "unknown version" if $params{version} && ($params{version} < 0 || $params{version} > $params{dbfile}->backend_data) ; my $path = $self->_filesystem_path($params{dbfile},$params{version}); - die "no file found in backend" if !-f $path; + die "no file found in backend or configuration to filesystem is wrong" if !-f $path; my @st = stat($path); my $dt = DateTime->from_epoch(epoch => $st[9])->clone(); $main::lxdebug->message(LXDebug->DEBUG2(), "dt=" .$dt); @@ -109,9 +109,9 @@ sub get_content { } sub enabled { - return 0 unless $::instance_conf->get_doc_files || $::instance_conf->get_doc_files_rootpath; - $main::lxdebug->message(LXDebug->DEBUG2(), "root path=" . $::instance_conf->get_doc_files_rootpath . " isdir=" .( -d $::instance_conf->get_doc_files_rootpath?"YES":"NO")); - return 0 unless -d $::instance_conf->get_doc_files_rootpath; + return 0 unless $::instance_conf->get_doc_files; + return 0 unless $::lx_office_conf{paths}->{document_path}; + return 0 unless -d $::lx_office_conf{paths}->{document_path}; return 1; } @@ -123,12 +123,12 @@ sub enabled { sub _filesystem_path { my ($self, $dbfile, $version) = @_; - die "No files backend enabled" unless $::instance_conf->get_doc_files || $::instance_conf->get_doc_files_rootpath; + die "No files backend enabled" unless $::instance_conf->get_doc_files || $::lx_office_conf{paths}->{document_path}; # use filesystem with depth 3 $version = $dbfile->backend_data if !$version || $version < 1 || $version > $dbfile->backend_data; my $iddir = sprintf("%04d", $dbfile->id % 1000); - my $path = File::Spec->catdir($::instance_conf->get_doc_files_rootpath, $iddir, $dbfile->id); + my $path = File::Spec->catdir($::lx_office_conf{paths}->{document_path}, $::auth->client->{id}, $iddir, $dbfile->id); $main::lxdebug->message(LXDebug->DEBUG2(), "file path=" .$path." id=" .$dbfile->id." version=".$version." basename=".$dbfile->id . '_' . $version); if (!-d $path) { File::Path::make_path($path, { chmod => 0770 }); diff --git a/config/kivitendo.conf.default b/config/kivitendo.conf.default index f4b8fe437..60be4b326 100644 --- a/config/kivitendo.conf.default +++ b/config/kivitendo.conf.default @@ -102,6 +102,12 @@ memberfile = users/members # if set the export to geierlein is enabled # geierlein_path = geierlein +# +# document path for FileSystem FileManagement: +# (must be reachable read/write but not executable from webserver) +# document_path = /var/local/kivi_documents +# + [mail_delivery] # Delivery method can be 'sendmail' or 'smtp'. For 'method = sendmail' the # parameter 'mail_delivery.sendmail' is used as the executable to call. If diff --git a/doc/dokumentation.xml b/doc/dokumentation.xml index fd78ff81f..7e1f7baa3 100644 --- a/doc/dokumentation.xml +++ b/doc/dokumentation.xml @@ -6530,7 +6530,7 @@ Beschreibung: <%description%> Die einzelnen Backends sind einzeln einschaltbar. Spezifische Backend-Konfigurierungen sind hier - noch ergänzbar. Für das Backend Dateisystem ist das Wurzelverzeichnis für den Mandanten einzugeben. + noch ergänzbar. Reiter "Allgemeine Dokumentenanhänge" @@ -6569,7 +6569,17 @@ Beschreibung: <%description%> Es ist daran gedacht, statt dem default Eintrag später für bestimmte Benutzer ('login') bestimmte Quellen zuzulassen, dies wird nach Bedarf implementiert. - + + kivitendo-Konfigurationsdatei + Dort ist im Abschnitt [paths] der relative oder absolute Pfad zum Dokumentenwurzelverzeichnis einzutragen. + Dieser muss für den Webserver schreib- und lesbar sein, jedoch nicht ausführbar. + +[paths] +document_path = /var/local/kivi_documents + + Unter diesem Wurzelverzeichnis wird pro Mandant automatisch ein Unterverzeichnis mit der ID des Mandanten angelegt + + diff --git a/sql/Pg-upgrade2/filemanagement_filesystem.pl b/sql/Pg-upgrade2/filemanagement_filesystem.pl deleted file mode 100644 index bb4e1e2ff..000000000 --- a/sql/Pg-upgrade2/filemanagement_filesystem.pl +++ /dev/null @@ -1,26 +0,0 @@ -# @tag: filemanagement_filesystem -# @description: add directory for filemanagment -# @depends: filemanagement_feature -package SL::DBUpgrade2::filemanagement_filesystem; - -use strict; -use utf8; -use File::Path qw(make_path); - -use parent qw(SL::DBUpgrade2::Base); - -sub run { - my ($self) = @_; - - my $directory = $::instance_conf->get_doc_files_rootpath; - - if ( $directory && !-d $directory ) { - mkdir $directory; - if (! -d $directory) { - return 0; - } - } - return 1; -} - -1; diff --git a/templates/webpages/client_config/_features.html b/templates/webpages/client_config/_features.html index 9596c5933..9c9051583 100644 --- a/templates/webpages/client_config/_features.html +++ b/templates/webpages/client_config/_features.html @@ -75,11 +75,6 @@ [% L.yes_no_tag('defaults.doc_files', SELF.defaults.doc_files) %] [% LxERP.t8('Use File Storage backend') %] - - [% LxERP.t8('Root path for file storage') %] - [% L.input_tag('defaults.doc_files_rootpath',SELF.defaults.doc_files_rootpath, style=style, onchange="verifyRootPath(this);") %] - [% LxERP.t8('This is the root directory for the File storage backend, must be writable for webserver. If you have more than one client you need another direcctory. All other directories must be created by hand and reachable from the webserver') %] - [% LxERP.t8('WebDAV') %] [% L.yes_no_tag('defaults.doc_webdav', SELF.defaults.doc_webdav) %]