Update of /cvsroot/openinteract/OpenInteract/pkg/base_page/script
In directory usw-pr-cvs1:/tmp/cvs-serv2703/script
Modified Files:
static_page2base_page.pl
Log Message:
add docs, try to find mime_type of content
Index: static_page2base_page.pl
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_page/script/static_page2base_page.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** static_page2base_page.pl 2001/11/27 12:09:03 1.2
--- static_page2base_page.pl 2001/11/27 13:21:03 1.3
***************
*** 10,25 ****
use OpenInteract::Startup;
- # Do you want to add '.html' to any pages that don't have it? This can
- # be useful if you need to use the files for something else, or ensure
- # that they can be used
-
- my $ADD_HTML = 'yes';
-
- # Do you want your pages saved in the filesystem? This is encouraged.
-
- my $AS_FILE = 'yes';
-
{
! my $R = OpenInteract::Startup->setup_static_environment_options();
# First retrieve all the static page objects
--- 10,21 ----
use OpenInteract::Startup;
{
! my ( $OPT_add_html, $OPT_as_file, $OPT_as_database );
! my %opts = ( 'add_html' => \$OPT_add_html,
! 'as_file' => \$OPT_as_file,
! 'as_database' => \$OPT_as_database );
! my $R = OpenInteract::Startup->setup_static_environment_options( '', \%opts );
!
! $OPT_as_file++ unless ( $OPT_as_file or $OPT_as_database );
# First retrieve all the static page objects
***************
*** 35,39 ****
my $location => $static_page->{location};
! if ( $ADD_HTML eq 'yes' and $location !~ /\.html$/ ) {
$location .= '.html';
}
--- 31,35 ----
my $location => $static_page->{location};
! if ( $OPT_add_html and $location !~ /\.\w+$/ ) {
$location .= '.html';
}
***************
*** 51,65 ****
is_active => $static_page->{is_active},
notes => $static_page->{notes},
- mime_type => 'text/html',
location => $location });
# Set file status
! if ( $AS_FILE eq 'yes' ) {
! $page->{storage} = 'file';
! }
! else {
! $page->{storage} = 'database';
! }
# Set the content
--- 47,56 ----
is_active => $static_page->{is_active},
notes => $static_page->{notes},
location => $location });
# Set file status
! $page->{storage} = 'database' if ( $OPT_as_database );
! $page->{storage} = 'file' if ( $OPT_as_file );
# Set the content
***************
*** 75,78 ****
--- 66,73 ----
}
+ $page->{mime_type} = OpenInteract::Page->mime_type_content( $page->{content} ) ||
+ 'text/html';
+ $page->{size} = length $page->{content};
+
# Save the page object (automatically saves the content) and
# display a status
***************
*** 89,90 ****
--- 84,145 ----
}
}
+
+ __END__
+
+ =pod
+
+ =head1 NAME
+
+ static_page2base_page.pl - Migrate pages from the 'static_page' to the 'base_page' package
+
+ =head1 SYNOPSIS
+
+ $ export OIWEBSITE=/home/httpd/mysite
+ $ perl static_page2base_page.pl --add_html --as_file
+
+ =head1 DESCRIPTION
+
+ As of OpenInteract 1.35, all functionality for serving 'static' pages
+ and files is now in the 'base_page' package. (Previously it was in the
+ 'static_page' package.)
+
+ The new package has been entirely rewritten and uses a different table
+ structure, so you will need to migrate the pages from the structure of
+ the earlier package to this one. This script should do the job.
+
+ =head1 OPTIONS
+
+ B<--add_html>
+
+ If pass we will add C<.html> to any file that does not have an
+ extension.
+
+ B<--as_file>
+
+ B<--as_database>
+
+ These two options are mutually exclusive. They determine where the
+ page content will be stored. If not specified, we use B<--as_file>.
+
+ =head1 BUGS
+
+ None known.
+
+ =head1 TO DO
+
+ Nothing known.
+
+ =head1 SEE ALSO
+
+ =head1 COPYRIGHT
+
+ Copyright (c) 2001 intes.net, inc.. All rights reserved.
+
+ This library is free software; you can redistribute it and/or modify
+ it under the same terms as Perl itself.
+
+ =head1 AUTHORS
+
+ Chris Winters <ch...@cw...>
+
+ =cut
|