Revision 204

Date:
2012/04/05 13:04:04
Author:
ahitrov
Revision Log:
New webfile storage option:
FILE_WEB_STORAGE = Common|Separate
Common - for NFS
Separate - for independent front-ends
Files:

Legend:

 
Added
 
Removed
 
Modified
  • koi8/core/GNUmakefile

     
    1158 1158 DEVELOPMENT \
    1159 1159 ERROR_MODE \
    1160 1160 FILES \
    1161 FILE_WEB_STORAGE \
    1161 1162 HOSTNAME \
    1162 1163 HTTPD_DOCS \
    1163 1164 HTTPD_ELOG_LEVEL \
  • koi8/core/lib/Contenido/File.pm

     
    44 44
    45 45 my $dt = Contenido::DateTime->new()->set_locale('en')->set_time_zone("UTC");
    46 46
    47 my @successful;
    47 my (@successful, @failure);
    48 my %result;
    48 49
    49 50 #������� ��������� � ����� /
    50 51 $filename =~ s#/+#/#g;
     
    52 53 $filename =~ s#^/##;
    53 54
    54 55 foreach my $dir (@{$state->{"files_dir"}}) {
    55 seek $fh, 0, 0;
    56 my $path = $dir . '/' . $filename;
    56 seek $fh, 0, 0;
    57 my $path = $dir . '/' . $filename;
    58 my $scheme = uc(scheme($path));
    57 59
    58 no strict "refs";
    59 my $return = &{"Contenido::File::Scheme::".uc(scheme($path))."::store"}($path, $fh, $dt);
    60 push @successful, $path if $return;
    60 if ( $scheme eq 'FILE' || $state->{file_web_storage} eq 'separate' || ($state->{file_web_storage} eq 'common' && !exists $result{HTTP}{success}) ) {
    61 no strict "refs";
    62 my $return = &{"Contenido::File::Scheme::".$scheme."::store"}($path, $fh, $dt);
    63 if ( $return ) {
    64 push @successful, $path;
    65 push @{$result{$scheme}{success}}, $path;
    66 } else {
    67 push @failure, $path;
    68 push @{$result{$scheme}{fail}}, $path;
    69 }
    70 }
    61 71 }
    72 if (!$IgnoreErrors && ( exists $result{FILE}{fail} || ($state->{file_web_storage} eq 'separate' && exists $result{HTTP}{fail})
    73 || ($state->{file_web_storage} eq 'common' && exists $result{HTTP}{fail} && !exists($result{HTTP}{success})) ) ) {
    74 foreach my $path (@successful) {
    75 no strict "refs";
    76 &{"Contenido::File::Scheme::".uc(scheme($path))."::remove"}($path);
    77 }
    78 return;
    79 }
    62 80
    63 if (
    64 !@successful or
    65 (
    66 (scalar @successful != scalar @{$state->{"files_dir"}}) and
    67 !$IgnoreErrors
    68 )
    69 ) {
    70 foreach my $path (@successful) {
    71 no strict "refs";
    72 &{"Contenido::File::Scheme::".uc(scheme($path))."::remove"}($path);
    73 }
    74 return;
    75 }
    76 81 1;
    77 82 }
    78 83
  • koi8/core/lib/Contenido/State.pm.proto

     
    78 78 }
    79 79
    80 80 $self->{convert_binary} = '@CONVERT@';
    81 $self->{file_web_storage} = lc('@FILE_WEB_STORAGE@');
    81 82
    82 83 $self->{core_src} = '@CORE_SRC@';
    83 84 $self->{plug_src} = '@PLUG_SRC@';
  • koi8/core/project-default.mk

     
    147 147 IMAGES ?= ${MASON_COMP}/images
    148 148 STATIC_SOURCE_TOUCH_FILE ?= ${MASON_COMP}/.touch
    149 149
    150 # Files are stored in NFS (=Common) or independently on each front (=Separate)
    151 FILE_WEB_STORAGE ?= Separate
    152
    150 153 HTTPD_DOCS ?= ${MASON_COMP}/www
    151 154 CONF ?= ${PROJ_USR}/${PROJECT}/conf
    152 155