0.14_16 commit r0_14_16
authorTony Cook <tony@develop-help.com>
Tue, 30 Mar 2004 01:54:28 +0000 (01:54 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Tue, 30 Mar 2004 01:54:28 +0000 (01:54 +0000)
Makefile
schema/mysql_build.pl
site/cgi-bin/admin/reorder.pl
site/cgi-bin/modules/BSE/DB/Mysql.pm
site/cgi-bin/modules/BSE/Request.pm
site/cgi-bin/modules/BSE/WebUtil.pm
site/cgi-bin/modules/DevHelp/Formatter.pm
site/cgi-bin/modules/Generate.pm
site/docs/bse.pod
site/util/upgrade_mysql.pl
test-nport.cfg [new file with mode: 0644]

index eb253f23d7622cc3852461d2a8901e2f92c60e48..f28f618f8b9fb1fdc213ea699b9b1e3462e84f98 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.14_15
+VERSION=0.14_16
 DISTNAME=bse-$(VERSION)
 DISTBUILD=$(DISTNAME)
 DISTTAR=../$(DISTNAME).tar
index 4286d93fc3ce376fe934973862ffe1963a52989b..3a65d30105ef7956e408e9fbc0053f21c5ccfac9 100644 (file)
@@ -57,7 +57,7 @@ for my $table (@tables) {
     for my $name (@want) {
       defined $row->[$names{$name}] or $row->[$names{$name}] = "NULL";
     }
-    print "Column ",join(",",@$row[@names{@want}]),
+    print "Column ",join(";",@$row[@names{@want}]),
     "\n";
   }
   undef $ti;
@@ -76,8 +76,8 @@ for my $table (@tables) {
   #print Dumper(\%indices);
   for my $index (sort keys %indices) {
     my @sorted = sort { $a->[1] <=> $b->[1] } @{$indices{$index}};
-    print "Index $index,$unique{$index},[",
-      join(",", map $_->[0], @sorted),
+    print "Index $index;$unique{$index};[",
+      join(";", map $_->[0], @sorted),
       "]\n";
   }
 }
index 86a10e3265191e3abea4f880290e6777928e21dd..6c3d6884dceaaef864a5cdd7fa225a3983831f7e 100755 (executable)
@@ -65,7 +65,8 @@ if ($req->user_can(edit_reorder_children => $parentid)) {
   
   
   my @order = sort { $b <=> $a } map $_->[1]{$_->[2]}, @kids;
-  my $sort = $cgi->param('sort') || 'current';
+  my $sort = join(",", $cgi->param('sort')) || 'current';
+  $sort =~ s/-,/-/g;
   my $reverse = $cgi->param('reverse');
   
   my $code;
@@ -86,9 +87,9 @@ if ($req->user_can(edit_reorder_children => $parentid)) {
     my @reverse = grep(s/^-// || 0, @fields);
     my %reverse;
     @reverse{@fields} = @reverse;
-    @fields = grep exists($kids[0]{$_}), @fields;
+    @fields = grep exists($kids[0][0]{$_}), @fields;
     my @num = 
-    my %num = map { $_ => 1 } $kids[0]->numeric;
+    my %num = map { $_ => 1 } Article->numeric;
 
     $code =
       sub {
index a4494f2fd6fef9ae7773b70010efec7ec00998a7..3847163e367b9db367bfa3164180d1ea6008e231 100644 (file)
@@ -270,13 +270,26 @@ sub _single
   $self;
 }
 
+my $get_sql_by_name = 'select sql_statement from sql_statements where name=?';
+
 sub stmt {
   my ($self, $name) = @_;
 
   $name =~ s/BSE.*:://;
 
-  $statements{$name} or confess "Statement named '$name' not found";
-  my $sth = $self->{dbh}->prepare($statements{$name})
+  my $sql = $statements{$name};
+  unless ($sql) {
+    my @row = $self->{dbh}->selectrow_array($get_sql_by_name, {}, $name);
+    if (@row) {
+      $sql = $row[0];
+      print STDERR "Found SQL '$sql'\n";
+    }
+    else {
+      print STDERR "SQL statment $name not found in sql_statements table\n";
+    }
+  }
+  $sql or confess "Statement named '$name' not found";
+  my $sth = $self->{dbh}->prepare($sql)
     or croak "Cannot prepare $name statment: ",$self->{dbh}->errstr;
 
   $sth;
index 6b5ad93ab326f0ef34d4861c32d25c7e66e9aa3e..66ab3111e5bd912d87281dfb6c8c82417caa9952 100644 (file)
@@ -29,9 +29,15 @@ sub cfg {
 }
 
 sub session {
+  $_[0]{session} or die "Session has been deleted already\n";
+
   return $_[0]{session};
 }
 
+sub end_request {
+  delete $_[0]{session};
+}
+
 sub extra_headers { return }
 
 sub user {
index ea306926474f8b22ac100dc7448e9ede7d31e768..f86942ee6eba2f980142fb28a6f81b51862dc99d 100644 (file)
@@ -19,7 +19,6 @@ sub refresh_to_admin {
   use Carp 'confess';
   defined $where or confess 'No url supplied';
 
-
   unless ($where =~ /^\w+:/) {
     require BSE::CfgInfo;
     my $adminbase = BSE::CfgInfo::admin_base_url($cfg);
index 13ec853e58d88417bf57a9718ccfed887905ceda..b864dcde926550ab269eaa13b80d6e63cf8ccab9 100644 (file)
@@ -38,7 +38,7 @@ sub _make_table {
   my $cellend = '';
   my $cellstart = '';
   if ($options =~ /=/) {
-    $tag .= " " . $options;
+    $tag .= " " . unescape_html($options);
   }
   elsif ($options =~ /\S/) {
     $options =~ s/\s+$//;
index ccb959115b4466fc2678afae776bc3d7ba992919..0d74f962b409710e654a00e3621d4e82694e7e31 100644 (file)
@@ -445,8 +445,8 @@ sub baseActs {
         or return "<:summary $which No id returned :>";
        my $article = $articles->getByPkey($id)
         or return "<:summary $which Cannot find article $id:>";
-       return $self->summarize($articles, $article->{body}, 
-                              $article->{summaryLength}, $acts)
+       return $self->summarize($articles, $article->{body}, $acts, 
+                              $article->{summaryLength})
      },
      ifAdmin => sub { $self->{admin} },
      
index 600b9e8b09853b0669736baa32a735edf92ae418..42f3042cb550b922935212a2c85c9f5f00eebb11 100644 (file)
@@ -10,6 +10,44 @@ Maybe I'll add some other bits here.
 
 =head1 CHANGES
 
+=head2 0.14_16
+
+=over
+
+=item *
+
+upgrade_mysql.pl now takes a -i filename for the extra table
+structures to be installed.  A -h for help option was added too.
+
+=item *
+
+the format of the database structure file for upgrade_mysql.pl has
+changed, to allow for column types containing commas (like
+decimal(9,2)).
+
+=item *
+
+tbe table[htmloption="value" ... ] form of the table body tag no
+longer HTML escapes the options. (#348)
+
+=item *
+
+one of the changes to use the new formatter for summaries mixed up an
+argument order, breaking the <:summary ... :> tag (#347)
+
+=item *
+
+fixed some problems with the new sorting features in reorder.pl.
+
+=item *
+
+BSE::DB::Mysql will now attempt to search the sql_statements table for
+any SQL needed that isn't found in its internal table.  This is
+intended for use by external applications using BSE's database support
+tools, specifically for the nport project.
+
+=back
+
 =head2 0.14_15
 
 This adds several destabilizing changes, test before using in any
index e28218020675a38767c0e874f86c7a696957ac69..203781b34c22f2d1bd079a1cf6345a2e0e25d2e7 100644 (file)
@@ -8,14 +8,20 @@ use Getopt::Long;
 my $verbose;
 my $pretend;
 my $didbackup;
+my $input = "mysql.str";
+my $wanthelp;
 
 Getopt::Long::Configure('bundling');
 GetOptions("v:i", \$verbose,
           "n", \$pretend,
-          "b", \$didbackup);
+          "b", \$didbackup,
+          "i=s", \$input,
+          "h", \$wanthelp);
 $verbose = 1 if defined $verbose && $verbose == 0;
 $verbose = 0 unless $verbose;
 
+help() if $wanthelp;
+
 if ($didbackup) {
   print "Since you gave the -b option, I assume you made a backup.\n";
 }
@@ -45,8 +51,8 @@ my $db = BSE::DB->single;
 UNIVERSAL::isa($db, 'BSE::DB::Mysql')
   or die "Sorry, this only works for Mysql databases\n";
 
-open STRUCT, "< mysql.str"
-  or die "Cannot open structure file mysql.str: $!\n";
+open STRUCT, "< $input"
+  or die "Cannot open structure file $input: $!\n";
 my %tables;
 my $table;
 while (<STRUCT>) {
@@ -55,7 +61,7 @@ while (<STRUCT>) {
   if (/^Table\s+([^,]+)/) {
     $table = $1;
   }
-  elsif (/^Column\s+(\w+),([^,]+),(\w*),([^,]*),([^,]*)/) {
+  elsif (/^Column\s+(\w+);([^;]+);(\w*);([^;]*);([^;]*)/) {
     $table or die "Column before Table";
     push(@{$tables{$table}{cols}}, 
         {
@@ -66,12 +72,12 @@ while (<STRUCT>) {
          extra=>$5,
         });                
   }
-  elsif (/^Index\s+(\w+),(\d+),\[(\w+(?:,\w+)*)\]/) {
+  elsif (/^Index\s+(\w+);(\d+);\[(\w+(?:;\w+)*)\]/) {
     $tables{$table}{indices}{$1} =
       {
        name=>$1,
        unique => $2,
-       cols => [ split /,/, $3 ],
+       cols => [ split /;/, $3 ],
       };
   }
   else {
@@ -141,8 +147,8 @@ for my $table (sort keys %tables) {
   my $indices = $tables{$table}{indices};
   for my $name (grep $_ ne 'PRIMARY', keys %$indices) {
     next if $cindices{$name};
-    print "Creating index $name for $table\n" if $verbose;
     my $index = $indices->{$name};
+    print "Creating index $name(@{$index->{cols}}) for $table\n" if $verbose;
 
     my $sql = "alter table $table add ";
     $sql .= $index->{unique} ? "unique " : "index ";
@@ -227,7 +233,16 @@ sub create_clauses {
   }
 }
 
-__END__
+sub help {
+  # dump the POD up to the AUTHOR heading
+  while (<DATA>) {
+    last if /^=head1 AUTHOR/;
+    print;
+  }
+  exit;
+}
+
+__DATA__
 
 =head1 NAME
 
@@ -270,6 +285,14 @@ executed.
 
 Level 3 prints information useful only to developers.
 
+=item -i filename
+
+Specify and input filename that isn't mysql.str.
+
+=item -h
+
+Display help.
+
 =back
 
 =head1 AUTHOR
diff --git a/test-nport.cfg b/test-nport.cfg
new file mode 100644 (file)
index 0000000..13cc591
--- /dev/null
@@ -0,0 +1,16 @@
+# where to install the site
+base_url = http://nport.dh.tp
+securl = http://nportsec.dh.tp
+# where to install the site
+base_dir = /var/www/httpd/nport.dh.tp
+# the database user/password/dsn
+dbuser = nport
+dbpass = nport
+dsn = dbi:mysql:nport
+dbclass = BSE::DB::Mysql
+sessionclass = Apache::Session::MySQL
+# the location of mysql
+mysql = mysql
+basic.access_control=0
+
+site.secureadmin=1