[otrs-cvs] otrs/Kernel/System/Ticket ArticleStorageFS.pm, 1.77.2.2, 1.77.2.3
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/System/Ticket
In directory lancelot:/tmp/cvs-serv23334/Kernel/System/Ticket
Modified Files:
Tag: rel-3_0
ArticleStorageFS.pm
Log Message:
- 2012-12-03 Fixed bug#8933 - ArticleStorageInit permission check problem.
Author: mg
Index: ArticleStorageFS.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/Ticket/ArticleStorageFS.pm,v
retrieving revision 1.77.2.2
retrieving revision 1.77.2.3
diff -2 -u -d -r1.77.2.2 -r1.77.2.3
--- ArticleStorageFS.pm 20 Mar 2012 20:49:11 -0000 1.77.2.2
+++ ArticleStorageFS.pm 3 Dec 2012 13:29:28 -0000 1.77.2.3
@@ -14,7 +14,8 @@
use strict;
use warnings;
-use File::Path;
-use File::Basename;
-use MIME::Base64;
+
+use File::Path qw();
+use MIME::Base64 qw();
+use Time::HiRes qw();
# to get it writable for the otrs group (just in case)
@@ -37,14 +38,12 @@
$Self->{ArticleContentPath} = $Year . '/' . $Month . '/' . $Day;
- # check fs write permissions!
- my $Path = "$Self->{ArticleDataDir}/$Self->{ArticleContentPath}/check_permissions.$$";
- if ( -d $Path ) {
- File::Path::rmtree( [$Path] );
- }
- if ( mkdir( "$Self->{ArticleDataDir}/check_permissions_$$", 022 ) ) {
- rmdir("$Self->{ArticleDataDir}/check_permissions_$$");
- if ( File::Path::mkpath( [$Path], 0, 0775 ) ) {
- File::Path::rmtree( [$Path] );
- }
+ # Check fs write permissions.
+ # Generate a thread-safe article check directory.
+ my ( $Seconds, $Microseconds ) = Time::HiRes::gettimeofday();
+ my $PermissionCheckDirectory
+ = "check_permissions_${$}_" . ( int rand 1_000_000_000 ) . "_${Seconds}_${Microseconds}";
+ my $Path = "$Self->{ArticleDataDir}/$Self->{ArticleContentPath}/" . $PermissionCheckDirectory;
+ if ( File::Path::make_path( $Path, { mode => 0775 } ) ) {
+ rmdir $Path;
}
else {
@@ -52,9 +51,7 @@
$Self->{LogObject}->Log(
Priority => 'notice',
- Message => "Can't create $Self->{ArticleDataDir}/check_permissions_$$: $Error, "
- . "Try: \$OTRS_HOME/bin/otrs.SetPermissions.pl !",
+ Message => "Can't create $Path: $Error, try: \$OTRS_HOME/bin/otrs.SetPermissions.pl!",
);
- die "Error: Can't create $Self->{ArticleDataDir}/check_permissions_$$: $Error \n\n "
- . "Try: \$OTRS_HOME/bin/otrs.SetPermissions.pl !!!\n";
+ die "Can't create $Path: $Error, try: \$OTRS_HOME/bin/otrs.SetPermissions.pl!";
}
return 1;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log