[interchange-cvs] interchange - jon modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Sat Feb 24 00:48:27 EST 2007


User:      jon
Date:      2007-02-24 05:48:27 GMT
Modified:  lib/Vend Config.pm Data.pm
Log:
Add new catalog directives:

NoExport __TABLENAME__
NoExportExternal Yes

These prevent any export of some or all SQL tables to products/*.txt
from being done, to stop clutter in products/ from auto-export which
helps make the products/ directory nicer to use under version control.
Note that this makes the admin export function silently do nothing for
SQL tables, though it still works for GDBM tables.

With help from Mark Johnson <mark at endpoint.com>.

Revision  Changes    Path
2.213     +4 -2      interchange/lib/Vend/Config.pm


rev 2.213, prev_rev 2.212
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.212
retrieving revision 2.213
diff -u -u -r2.212 -r2.213
--- Config.pm	6 Feb 2007 12:17:49 -0000	2.212
+++ Config.pm	24 Feb 2007 05:48:26 -0000	2.213
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.212 2007/02/06 12:17:49 racke Exp $
+# $Id: Config.pm,v 2.213 2007/02/24 05:48:26 jon Exp $
 #
 # Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -54,7 +54,7 @@
 use Vend::Data;
 use Vend::Cron;
 
-$VERSION = substr(q$Revision: 2.212 $, 10);
+$VERSION = substr(q$Revision: 2.213 $, 10);
 
 my %CDname;
 my %CPname;
@@ -618,6 +618,8 @@
 	['MinQuantityField', undef,     	     ''],
 	['LogFile', 		  undef,     	     'etc/log'],
 	['Pragma',		 	 'boolean_value',    ''],
+	['NoExport',		 'boolean',			 ''],
+	['NoExportExternal', 'yesno',			 'no'],
 	['NoImport',	 	 'boolean',     	 ''],
 	['NoImportExternal', 'yesno',	     	 'no'],
 	['CommonAdjust',	 undef,  	     	 ''],



2.62      +16 -6     interchange/lib/Vend/Data.pm


rev 2.62, prev_rev 2.61
Index: Data.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Data.pm,v
retrieving revision 2.61
retrieving revision 2.62
diff -u -u -r2.61 -r2.62
--- Data.pm	24 Feb 2007 03:17:06 -0000	2.61
+++ Data.pm	24 Feb 2007 05:48:26 -0000	2.62
@@ -1,8 +1,8 @@
 # Vend::Data - Interchange databases
 #
-# $Id: Data.pm,v 2.61 2007/02/24 03:17:06 jon Exp $
+# $Id: Data.pm,v 2.62 2007/02/24 05:48:26 jon Exp $
 # 
-# Copyright (C) 2002-2006 Interchange Development Group
+# Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
 #
 # This program was originally based on Vend 0.2 and 0.3
@@ -1135,14 +1135,13 @@
 
 sub export_database {
 	my($db, $file, $type, $opt) = @_;
-	my(@data);
-	my ($field, $delete);
 	return undef unless defined $db;
 
+	my (@data, $field, $delete);
+
 	$field  = $opt->{field}         if $opt->{field};
 	$delete = $opt->{delete}		if $opt->{delete};
 
-
 	$db = database_exists_ref($db)
 		or do {
 			logError("Vend::Data export: non-existent database %s" , $db);
@@ -1151,6 +1150,18 @@
 
 	$db = $db->ref();
 
+	if ($Vend::Cfg->{NoExportExternal}) {
+		# Skip export only for "external" tables (currently SQL and LDAP),
+		# just like NoImportExternal does
+		my $class = $db->config('Class');
+		my $class_config = $db_config{$class || $Global::Default_database};
+		return 1 if $class_config->{RestrictedImport};
+	}
+
+	my $table_name = $db->config('name');
+
+	return 1 if $Vend::Cfg->{NoExport}->{$table_name};
+
 	my $qual;
 	if($qual = $opt->{where}) {
 		if(ref $qual) {
@@ -1166,7 +1177,6 @@
 		}
 	}
 
-	my $table_name = $db->config('name');
 	my $notes;
 	if("\U$type" eq 'NOTES') {
 		$type = 2;








More information about the interchange-cvs mailing list