From: Sven Schöling Date: Thu, 15 Nov 2012 14:09:13 +0000 (+0100) Subject: SessionFile optional mit session_id laden X-Git-Tag: release-3.1.0beta1~738 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=08d78ff5c14d302d3e86d368d752195625c3120d;p=kivitendo-erp.git SessionFile optional mit session_id laden (wird für background_jobs benötigt --- diff --git a/SL/SessionFile.pm b/SL/SessionFile.pm index f4c509c33..08f905bc8 100644 --- a/SL/SessionFile.pm +++ b/SL/SessionFile.pm @@ -13,6 +13,7 @@ use POSIX qw(strftime); use Rose::Object::MakeMethods::Generic ( scalar => [ qw(fh file_name) ], + 'scalar --get_set_init' => [ qw(session_id) ], ); sub new { @@ -64,18 +65,22 @@ sub displayable_mtime { } sub get_path { - die "No session ID" unless $::auth->get_session_id; - return "users/session_files/" . $::auth->get_session_id; + die "No session ID" unless $_[0]->session_id; + return "users/session_files/" . $_[0]->session_id; } sub prepare_path { - my $path = get_path(); + my $path = $_[0]->get_path; return $path if -d $path; mkpath $path; die "Creating ${path} failed" unless -d $path; return $path; } +sub init_session_id { + $::auth->get_session_id; +} + sub destroy_session { my ($class, $session_id) = @_;