[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 4e231341ff74388440111e2006bd8ab68ed48fda

Stefan Hornburg racke at rt.icdevgroup.org
Fri Feb 6 14:57:14 UTC 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange wellwell catalog".

The branch, master has been updated
       via  4e231341ff74388440111e2006bd8ab68ed48fda (commit)
      from  6ac3ebd60d830772598242ee21ccddc37b0a4c04 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4e231341ff74388440111e2006bd8ab68ed48fda
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Fri Feb 6 15:56:24 2009 +0100

    keep existing URLs
    fix hardcoded field name for URI field

-----------------------------------------------------------------------

Summary of changes and diff:
 code/generate_uri.tag |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/code/generate_uri.tag b/code/generate_uri.tag
index af1bcb5..0991b85 100644
--- a/code/generate_uri.tag
+++ b/code/generate_uri.tag
@@ -14,7 +14,10 @@ generate-uri - Generates a pretty URL for a hierarchical structure and stores it
 
 Generates an URL for hierarchical structures such as categories and menus. If it is defined, it can use parent field in the table to get the parents to the root item and generate a pretty url (parents_parent/parent/child). This url is stored in the same table (usually in the URL field). 
 
-This tag is normally used in an Interchange job, which fills the entire table, or as a part of administration interface (where you run it when you add or edit a category, for example).
+This tag is normally used in an Interchange job, which fills the entire table, or as a part of administration interface (where you run it when you add or edit a category, for example). 
+
+Existing URLs are not overwritten unless explicitly requested by the
+override parameter.
 
 The URL is retrieved by using an ActionMap or a similar approach to display the page.
 
@@ -64,6 +67,12 @@ Generate URI only for record with key.
 
 =back
 
+=item overwrite
+
+Overwrite existing URIs.
+
+=back
+
 =head1 EXAMPLES
 
 [generate_uri categories]
@@ -102,9 +111,12 @@ sub {
 	if ($opt->{key}) {
 		$sql = qq{SELECT $key_field,$display_field,$parent FROM $table WHERE $key_field = } . $db->quote($opt->{key});
 	}
-	else {
+	elsif ($opt->{overwrite}) {
 		$sql = qq{SELECT $key_field,$display_field,$parent FROM $table};
 	}
+	else {
+		$sql = qq{SELECT $key_field,$display_field,$parent FROM $table WHERE $uri_field = ''};
+	}
 	
 	my $rows = $db->query({sql => $sql, hashref => 1});
 
@@ -146,9 +158,8 @@ sub {
 
 		$uri = join( $dir_divider, @parents );
 
-		# Insert the URI into database
-		my %columns = ( uri => $uri );
-		$db->set_slice($row->{$key_field}, \%columns);
+		# Update URI in database
+		$db->set_field($row->{$key_field}, $uri_field, $uri);
 	}
 	return 1;
 }


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list