projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Typo in GuV Gruppenüberschrift
[kivitendo-erp.git]
/
SL
/
SessionFile.pm
diff --git
a/SL/SessionFile.pm
b/SL/SessionFile.pm
index
dbed415
..
08f905b
100644
(file)
--- 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) ],
use Rose::Object::MakeMethods::Generic
(
scalar => [ qw(fh file_name) ],
+ 'scalar --get_set_init' => [ qw(session_id) ],
);
sub new {
);
sub new {
@@
-24,6
+25,8
@@
sub new {
$file_name =~ s:.*/::g;
$file_name = "${path}/${file_name}";
$file_name =~ s:.*/::g;
$file_name = "${path}/${file_name}";
+ $self->file_name($file_name);
+
if ($params{mode}) {
my $mode = $params{mode};
if ($params{mode}) {
my $mode = $params{mode};
@@
-35,11
+38,14
@@
sub new {
$self->fh(IO::File->new($file_name, $mode));
}
$self->fh(IO::File->new($file_name, $mode));
}
- $self->file_name($file_name);
-
return $self;
}
return $self;
}
+sub open {
+ my ($self, $mode) = @_;
+ return $self->fh(IO::File->new($self->file_name, $mode));
+}
+
sub exists {
my ($self) = @_;
return -f $self->file_name;
sub exists {
my ($self) = @_;
return -f $self->file_name;
@@
-59,18
+65,22
@@
sub displayable_mtime {
}
sub get_path {
}
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 {
}
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;
}
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) = @_;
sub destroy_session {
my ($class, $session_id) = @_;
@@
-95,7
+105,7
@@
destroyed or expires
use SL::SessionFile;
# Create a session file named "customer.csv" (relative names only)
use SL::SessionFile;
# Create a session file named "customer.csv" (relative names only)
- my $sfile = SL::SessionFile->new(
"customer.csv", "w"
);
+ my $sfile = SL::SessionFile->new(
'customer.csv', mode => 'w'
);
$sfile->fh->print("col1;col2;col3\n" .
"value1;value2;value3\n");
$sfile->fh->close;
$sfile->fh->print("col1;col2;col3\n" .
"value1;value2;value3\n");
$sfile->fh->close;
@@
-139,6
+149,10
@@
Returns the full relative file name associated with this instance. If
it has been created for "customer.csv" then the value returned might
be C<users/session_files/e8789b98721347/customer.csv>.
it has been created for "customer.csv" then the value returned might
be C<users/session_files/e8789b98721347/customer.csv>.
+=item C<open, %params]>
+
+Opens the file_name given at creation with the given parameters.
+
=item C<exists>
Returns trueish if the file exists.
=item C<exists>
Returns trueish if the file exists.
@@
-162,7
+176,7
@@
C<22.01.2011 14:12:22>.
=item C<get_path>
Returns the name of the session-specific directory used for file
=item C<get_path>
Returns the name of the session-specific directory used for file
-storage relative to the
Lx-Office
installation folder.
+storage relative to the
kivitendo
installation folder.
=item C<prepare_path>
=item C<prepare_path>