View | Details | Raw Unified | Return to bug 20727
Collapse All | Expand All

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 1745-1751 sub _get_session_params { Link Here
1745
    }
1745
    }
1746
    else {
1746
    else {
1747
        # catch all defaults to tmp should work on all systems
1747
        # catch all defaults to tmp should work on all systems
1748
        my $dir = Koha::UploadedFile->temporary_directory;
1748
        my $dir = C4::Context::temporary_directory;
1749
        my $instance = C4::Context->config( 'database' ); #actually for packages not exactly the instance name, but generally safer to leave it as it is
1749
        my $instance = C4::Context->config( 'database' ); #actually for packages not exactly the instance name, but generally safer to leave it as it is
1750
        return { dsn => "driver:File;serializer:yaml;id:md5", dsn_args => { Directory => "$dir/cgisess_$instance" } };
1750
        return { dsn => "driver:File;serializer:yaml;id:md5", dsn_args => { Directory => "$dir/cgisess_$instance" } };
1751
    }
1751
    }
(-)a/C4/Context.pm (+12 lines)
Lines 1076-1081 sub only_my_library { Link Here
1076
      && C4::Context->userenv->{branch};
1076
      && C4::Context->userenv->{branch};
1077
}
1077
}
1078
1078
1079
=head3 temporary_directory
1080
1081
Returns root directory for temporary storage
1082
1083
=cut
1084
1085
sub temporary_directory {
1086
    my ( $class ) = @_;
1087
    return C4::Context->config('tmp_path') || File::Spec->tmpdir;
1088
}
1089
1090
1079
1;
1091
1;
1080
1092
1081
__END__
1093
__END__
(-)a/C4/InstallAuth.pm (-1 / +1 lines)
Lines 240-246 sub checkauth { Link Here
240
    my $dbh = C4::Context->dbh();
240
    my $dbh = C4::Context->dbh();
241
    my $template_name;
241
    my $template_name;
242
    $template_name = "installer/auth.tt";
242
    $template_name = "installer/auth.tt";
243
    my $sessdir = File::Spec->catdir( Koha::UploadedFile->temporary_directory, 'cgisess_' . C4::Context->config('database') ); # same construction as in C4/Auth
243
    my $sessdir = File::Spec->catdir( C4::Context::temporary_directory, 'cgisess_' . C4::Context->config('database') ); # same construction as in C4/Auth
244
244
245
    # state variables
245
    # state variables
246
    my $loggedin = 0;
246
    my $loggedin = 0;
(-)a/Koha/Edifact/Transport.pm (-1 / +1 lines)
Lines 40-46 sub new { Link Here
40
    my $self     = {
40
    my $self     = {
41
        account     => $acct,
41
        account     => $acct,
42
        schema      => $schema,
42
        schema      => $schema,
43
        working_dir => Koha::UploadedFile->temporary_directory,    #temporary work directory
43
        working_dir => C4::Context::temporary_directory,    #temporary work directory
44
        transfer_date => DateTime->now( time_zone => 'local' ),
44
        transfer_date => DateTime->now( time_zone => 'local' ),
45
    };
45
    };
46
46
(-)a/Koha/UploadedFile.pm (-11 lines)
Lines 160-176 sub permanent_directory { Link Here
160
    return C4::Context->config('upload_path');
160
    return C4::Context->config('upload_path');
161
}
161
}
162
162
163
=head3 tmp_directory
164
165
Returns root directory for temporary storage
166
167
=cut
168
169
sub temporary_directory {
170
    my ( $class ) = @_;
171
    return C4::Context->config('tmp_path') || File::Spec->tmpdir;
172
}
173
174
=head3 _type
163
=head3 _type
175
164
176
Returns name of corresponding DBIC resultset
165
Returns name of corresponding DBIC resultset
(-)a/Koha/Uploader.pm (-1 / +1 lines)
Lines 189-195 sub _init { Link Here
189
    my ( $self, $params ) = @_;
189
    my ( $self, $params ) = @_;
190
190
191
    $self->{rootdir} = Koha::UploadedFile->permanent_directory;
191
    $self->{rootdir} = Koha::UploadedFile->permanent_directory;
192
    $self->{tmpdir} = Koha::UploadedFile->temporary_directory;
192
    $self->{tmpdir} = C4::Context::temporary_directory;
193
193
194
    $params->{tmp} = $params->{temp} if !exists $params->{tmp};
194
    $params->{tmp} = $params->{temp} if !exists $params->{tmp};
195
    $self->{temporary} = $params->{tmp}? 1: 0; #default false
195
    $self->{temporary} = $params->{tmp}? 1: 0; #default false
(-)a/about.pl (-1 / +1 lines)
Lines 263-269 if ( ! defined C4::Context->config('upload_path') ) { Link Here
263
}
263
}
264
264
265
if ( ! C4::Context->config('tmp_path') ) {
265
if ( ! C4::Context->config('tmp_path') ) {
266
    my $temporary_directory = Koha::UploadedFile->temporary_directory;
266
    my $temporary_directory = C4::Context::temporary_directory;
267
    push @xml_config_warnings, {
267
    push @xml_config_warnings, {
268
        error             => 'tmp_path_missing',
268
        error             => 'tmp_path_missing',
269
        effective_tmp_dir => $temporary_directory,
269
        effective_tmp_dir => $temporary_directory,
(-)a/misc/cronjobs/fines.pl (-1 / +1 lines)
Lines 184-190 sub set_holiday { Link Here
184
sub get_filename {
184
sub get_filename {
185
    my $directory = shift;
185
    my $directory = shift;
186
    if ( !$directory ) {
186
    if ( !$directory ) {
187
        $directory = Koha::UploadedFile->temporary_directory;
187
        $directory = C4::Context::temporary_directory;
188
    }
188
    }
189
    if ( !-d $directory ) {
189
    if ( !-d $directory ) {
190
        carp "Could not write to $directory ... does not exist!";
190
        carp "Could not write to $directory ... does not exist!";
(-)a/t/db_dependent/Plugins.t (-1 / +1 lines)
Lines 63-69 is( $plugin->get_plugin_http_path(), '/plugin/Koha/Plugin/Test', 'Test $plugin-> Link Here
63
# test absolute path change in get_template with Koha::Plugin::Test
63
# test absolute path change in get_template with Koha::Plugin::Test
64
# using the mock set before
64
# using the mock set before
65
# we also add tmpdir as an approved template dir
65
# we also add tmpdir as an approved template dir
66
t::lib::Mocks::mock_config( 'pluginsdir', [ Koha::UploadedFile->temporary_directory ] );
66
t::lib::Mocks::mock_config( 'pluginsdir', [ C4::Context::temporary_directory ] );
67
my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1 );
67
my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1 );
68
print $fh 'I am [% filename %]';
68
print $fh 'I am [% filename %]';
69
close $fh;
69
close $fh;
(-)a/t/db_dependent/Sitemapper.t (-1 / +1 lines)
Lines 64-70 $db->mock( Link Here
64
    _new_schema => sub { return Schema(); }
64
    _new_schema => sub { return Schema(); }
65
);
65
);
66
66
67
my $dir = Koha::UploadedFile->temporary_directory;
67
my $dir = C4::Context::temporary_directory;
68
68
69
my $data = [
69
my $data = [
70
    [qw/ 1         2013-11-15 2013-11-15/],
70
    [qw/ 1         2013-11-15 2013-11-15/],
(-)a/t/db_dependent/Templates.t (-2 / +2 lines)
Lines 126-134 subtest "Absolute path change in _get_template_file" => sub { Link Here
126
    # We create a simple template in /tmp.
126
    # We create a simple template in /tmp.
127
    # We simulate an anonymous OPAC session; the OPACBaseURL template variable
127
    # We simulate an anonymous OPAC session; the OPACBaseURL template variable
128
    # should be filled by get_template_and_user.
128
    # should be filled by get_template_and_user.
129
    t::lib::Mocks::mock_config( 'pluginsdir', [ Koha::UploadedFile->temporary_directory ] );
129
    t::lib::Mocks::mock_config( 'pluginsdir', [ C4::Context::temporary_directory ] );
130
    t::lib::Mocks::mock_preference( 'OPACBaseURL', 'without any doubt' );
130
    t::lib::Mocks::mock_preference( 'OPACBaseURL', 'without any doubt' );
131
    my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1, DIR => Koha::UploadedFile->temporary_directory );
131
    my ( $fh, $fn ) = tempfile( SUFFIX => '.tt', UNLINK => 1, DIR => C4::Context::temporary_directory );
132
    print $fh q|I am a [% quality %] template [% OPACBaseURL %]|;
132
    print $fh q|I am a [% quality %] template [% OPACBaseURL %]|;
133
    close $fh;
133
    close $fh;
134
    my ( $template, $login, $cookie ) = C4::Auth::get_template_and_user({
134
    my ( $template, $login, $cookie ) = C4::Auth::get_template_and_user({
(-)a/t/db_dependent/Upload.t (-2 / +1 lines)
Lines 74-80 subtest 'permanent_directory and temporary_directory' => sub { Link Here
74
    # Check mocked directories
74
    # Check mocked directories
75
    is( Koha::UploadedFile->permanent_directory, $tempdir,
75
    is( Koha::UploadedFile->permanent_directory, $tempdir,
76
        'Check permanent directory' );
76
        'Check permanent directory' );
77
    is( Koha::UploadedFile->temporary_directory, $tempdir,
77
    is( C4::Context::temporary_directory, $tempdir,
78
        'Check temporary directory' );
78
        'Check temporary directory' );
79
};
79
};
80
80
81
- 

Return to bug 20727