Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
MiniVend 3.15-beta3
Browse files Browse the repository at this point in the history
  • Loading branch information
perusionmike authored and jonjensen committed Jan 2, 2009
1 parent b02c8fc commit 29134cc
Show file tree
Hide file tree
Showing 27 changed files with 5,221 additions and 313 deletions.
9 changes: 8 additions & 1 deletion MANIFEST
Expand Up @@ -278,7 +278,14 @@ dist/src/tlink.c
dist/src/tlink.pl
dist/src/vlink.c
dist/src/vlink.pl
dist/userdb.cfg
dist/usertag/bar_button
dist/usertag/db_count
dist/usertag/db_date
dist/usertag/email
dist/usertag/loc
dist/usertag/summary
dist/usertag/var
doc/Tagref.pm
doc/bullet.gif
doc/frtoc.html
doc/intro.html
Expand Down
16 changes: 16 additions & 0 deletions dist/WHATSNEW
Expand Up @@ -142,6 +142,22 @@ MiniVend 3.15 incorporates some new features -- I couldn't resist. 8-)

in the demo, this will demonstrate it.

* The idiom:

#include directory/*

now is supported (and used in the demo minivend.cfg file). This
includes all files in that directory (but not subdirectories)
and allows you to include the whole directory. It should make
maintaining multiple servers a bit easier.

* Made some minor changes in the demo:

- updated flypage to show attribute-based price tag
- added [email to=addr from=addr subject=subj] message [/email]
UserTag which is better then the form_mail GlobalSub. It will
allow $Tag->email() to be used, among other things.

MiniVend 3.14 is a bug fix release with a couple of new features:

* You can now specify a database in minivend.cfg. It becomes
Expand Down
2 changes: 1 addition & 1 deletion dist/bin/localize
Expand Up @@ -2,7 +2,7 @@
#
# MiniVend localizer
#
# $Id: localize,v 1.3 1999/08/09 02:32:21 mike Exp mike $
# $Id: localize,v 1.3 1999/08/09 02:32:21 mike Exp $
#
# Copyright 1996-1998 by Michael J. Heins <mikeh@minivend.com>
#
Expand Down
88 changes: 67 additions & 21 deletions dist/bin/minivend
Expand Up @@ -2,7 +2,7 @@
#
# MiniVend version 3.15
#
# $Id: minivend,v 1.46 1999/08/09 02:32:31 mike Exp mike $
# $Id: minivend,v 1.48 1999/08/10 10:24:35 mike Exp mike $
#
# This program is largely based on Vend 0.2
# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
Expand Down Expand Up @@ -43,7 +43,7 @@ BEGIN {
($Global::VendRoot = $ENV{MINIVEND_ROOT})
if defined $ENV{MINIVEND_ROOT};

$Global::VendRoot = $Global::VendRoot || '/home/minivend';
$Global::VendRoot = $Global::VendRoot || '/home/mike/mvend';
$Global::ConfigFile = 'minivend.cfg';

die "MiniVend not configured, no $Global::ConfigFile.\n"
Expand Down Expand Up @@ -151,7 +151,7 @@ sub debug {
}

BEGIN {
$VERSION = '3.15beta2';
$VERSION = '3.15beta3';
}
use strict;
use Fcntl;
Expand Down Expand Up @@ -669,12 +669,11 @@ sub do_scan {
}

sub fake_scan {

my($argument,$path) = @_;
my($path) = @_;
my ($key,$page);
my $c = {};
find_search_params($c,$path);
return perform_search($c,$argument);
return perform_search($c);
}

# Returns undef if interaction error
Expand Down Expand Up @@ -1562,9 +1561,10 @@ $Global::DEBUG = $Global::DebugMode || 0;
# STATICPAGE
READSTATIC: {
my $basedir = $c->{PageDir};
last READSTATIC unless -f "$basedir/.build";
last READSTATIC if ! -f "$basedir/.static";
if ($c->{Static}) {
print "loading static page names...";
last READSTATIC if $c->{StaticDBM};
open STATICPAGE, "$basedir/.static"
or warn <<EOF;
Couldn't read static page status file $basedir/.static: $!
Expand Down Expand Up @@ -1730,7 +1730,6 @@ sub build_page {
my $status = 1;

Vend::Interpolate::reset_calc();

eval {
unless($scan) {
$page = readin($name);
Expand Down Expand Up @@ -1768,7 +1767,7 @@ sub build_page {
my $count = 0;
my($search, $file, $newpage);
my $string = $Vend::Cfg->{VendURL} . "/scan/" ;
while($page =~ s!$string([^?]+)[^"]+!"__POST_" . $count++ . "__"!e) {
while($page =~ s!$string([^?"]+)[^"]*"!"__POST_" . $count++ . "__" . '"'!e) {
undef $Vend::CachePage;
undef $Vend::ForceBuild;
$search = $1;
Expand All @@ -1779,7 +1778,7 @@ sub build_page {
push @post, $Vend::Found_scan{$search};
print "cached.";
}
elsif ($newpage = fake_scan('', $search) ) {
elsif ($newpage = fake_scan($search) ) {
$file = "scan" . ++$Vend::ScanCount .
$Vend::Cfg->{StaticSuffix};
pop @post;
Expand Down Expand Up @@ -1834,11 +1833,41 @@ sub build_page {
$status = 0;
}
};
$status = 0 if $@;
if($@) {
$status = 0;
::logError("build_page died: $@");
}
return $status;

}

sub tie_static_dbm {
if($Global::GDBM) {
tie(%Vend::StaticDBM,
'GDBM_File',
"$Vend::Cfg->{StaticDBM}.gdbm",
&GDBM_WRCREAT,
$Vend::Cfg->{'FileCreationMask'},
)
or undef $Vend::Cfg->{StaticDBM};
}
elsif ($Global::DB_File) {
tie(%Vend::StaticDBM,
'DB_File',
"$Vend::Cfg->{StaticDBM}.db",
&O_RDWR | &O_CREAT,
$Vend::Cfg->{'FileCreationMask'},
)
or undef $Vend::Cfg->{StaticDBM};
}
else {
undef $Vend::Cfg->{StaticDBM};
}
::logError("Failed to create StaticDBM $Vend::Cfg->{StaticDBM}")
unless $Vend::Cfg->{StaticDBM} || shift;
return $Vend::Cfg->{StaticDBM} ? '1' : undef;
}


# Build a static page tree from the database
# The session is faked, but all other operations
Expand Down Expand Up @@ -1961,6 +1990,12 @@ sub build_all {
$Vend::SessionID = '';
$Vend::SessionName = '';
init_session();
if($Vend::Cfg->{StaticDBM}) {
for(glob("$Vend::Cfg->{StaticDBM}.gdbm $Vend::Cfg->{StaticDBM}.db")) {
unlink $_;
}
}
unlink "$basedir/.static" if $Vend::Cfg->{StaticDBM};
$CGI::cookie = $Vend::Cookie = "MV_SESSION_ID=building:local.host";
$Vend::Session->{'frames'} = $Vend::Cfg->{FramesDefault};
require File::Find or die "No standard Perl library File::Find!\n";
Expand Down Expand Up @@ -2032,8 +2067,8 @@ sub build_all {
last FLYCHECK unless $Vend::Cfg->{StaticFly};
last FLYCHECK if @build_file;
my $save = $Vend::Session->{frames};
for (@Vend::Productbase) {
$p = database_ref($_);
foreach $p (@Vend::Productbase) {
$p = database_ref($p);
while( ($key,$val) = $p->each_record() ) {
next if $build_list && ! defined $build{$key};
next unless $key =~ m{^$spec}o;
Expand Down Expand Up @@ -2071,8 +2106,8 @@ sub build_all {
last FLY unless $Vend::Cfg->{StaticFly};
last FLY if @build_file;
my $save = $Vend::Session->{frames};
for (@Vend::Productbase) {
$p = database_ref($_);
foreach $p (@Vend::Productbase) {
$p = database_ref($p);
while( ($key,$val) = $p->each_record() ) {
FRAMES:
if($Vend::Cfg->{FrameFlyPage}) {
Expand All @@ -2088,7 +2123,7 @@ sub build_all {
next unless defined $Vend::Cfg->{StaticPage}->{$key};
print do_msg("Building part number $key");
build_page($key,$outdir)
or (delete($Vend::Cfg->{StaticPage}->{$key}), next);
or ( print "skipped.\n" and delete($Vend::Cfg->{StaticPage}->{$key}), next);
$Vend::Session->{'pageCount'} = -1;
print "done.\n";
}
Expand All @@ -2097,8 +2132,11 @@ sub build_all {
}
open STATICPAGE, ">$basedir/.static"
or die "Couldn't write static page file: $!\n";
tie_static_dbm if $Vend::Cfg->{StaticDBM};
for(sort keys %{$Vend::Cfg->{StaticPage}}) {
print STATICPAGE "$_\t$Vend::Cfg->{StaticPage}{$_}\n";
$Vend::StaticDBM{$_} = $Vend::Cfg->{StaticPage}{$_}
if defined %Vend::StaticDBM;
}
close STATICPAGE;

Expand All @@ -2109,6 +2147,7 @@ sub build_all {
}
close UNBUILT;
unlink "$basedir/.build" if @build_file;
unlink "$basedir/.static" if $Vend::Cfg->{StaticDBM};

# Second level of search, no more than 1 is recommended, but
# can be set by StaticDepth
Expand Down Expand Up @@ -2311,13 +2350,19 @@ sub dispatch {
$Global::DEBUG |= $Vend::Cfg->{DebugMode};
}
if ($Vend::Cfg->{SetGroup}) {
eval {$) = "$Vend::Cfg->{SetGroup} $Vend::Cfg->{SetGroup}"};
eval {
$) = "$Vend::Cfg->{SetGroup} $Vend::Cfg->{SetGroup}";
};
if ($@) {
my $msg = $@;
# logGlobal("Can't set group to GID $Vend::Cfg->{SetGroup}: $msg");
logGlobal( errmsg('bin/minivend:16', "Can't set group to GID %s: %s" , $Vend::Cfg->{SetGroup}, $msg) );
# logError("Can't set group to GID $Vend::Cfg->{SetGroup}: $msg");
logError( errmsg('bin/minivend:17', "Can't set group to GID %s: %s" , $Vend::Cfg->{SetGroup}, $msg) );
logGlobal( errmsg('bin/minivend:16',
"Can't set group to GID %s: %s" ,
$Vend::Cfg->{SetGroup},
$msg ) );
logError( errmsg('bin/minivend:17',
"Can't set group to GID %s: %s",
$Vend::Cfg->{SetGroup},
$msg ) );
}
}

Expand Down Expand Up @@ -2349,6 +2394,7 @@ EOF
chdir $Vend::Cfg->{'VendRoot'}
or die "Couldn't change to $Vend::Cfg{'VendRoot'}: $!\n";
set_file_permissions();
tie_static_dbm('nolog') if $Vend::Cfg->{StaticDBM};
umask $Vend::Cfg->{'Umask'};
open_database();

Expand Down
5 changes: 5 additions & 0 deletions dist/form_mail.cfg
Expand Up @@ -7,6 +7,11 @@ sub form_mail {

$reply = '' unless defined $reply;
$reply = "Reply-to: $reply\n" if $reply;
if ($reply !~ /^from:/mi) {
my $from = $Vend::Cfg->{MailOrderTo};
$from =~ s/,.*//;
$reply = "From: $from\n$reply";
}

$ok = 0;
SEND: {
Expand Down

0 comments on commit 29134cc

Please sign in to comment.