[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 36fc75edf3f3b991be742cf0b19518aef96809a7

Stefan Hornburg racke at rt.icdevgroup.org
Wed Jan 6 13:36:54 UTC 2010


       via  36fc75edf3f3b991be742cf0b19518aef96809a7 (commit)
      from  795c813ccbefedcb4a339650fd3513e429defc87 (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 36fc75edf3f3b991be742cf0b19518aef96809a7
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Wed Jan 6 14:35:44 2010 +0100

    [path-redirect]: prevent self-referencing records and redirects

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

Summary of changes and diff:
 plugins/path_redirect/code/path_redirect.tag |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/plugins/path_redirect/code/path_redirect.tag b/plugins/path_redirect/code/path_redirect.tag
index 1fdcc39..a95b8c5 100644
--- a/plugins/path_redirect/code/path_redirect.tag
+++ b/plugins/path_redirect/code/path_redirect.tag
@@ -10,6 +10,10 @@ sub {
 	%update_mode = (add => 'insert', modify => 'update', set => 'upsert');
 
 	if (exists $update_mode{$function}) {
+		# drop old record when reverting redirects
+		$Db{path_redirect}->query(q{delete from path_redirect where path_source = '%s'},
+			$target);
+
 		# in case target exists we have to rewrite it
 		$Db{path_redirect}->query(q{update path_redirect set path_target = '%s' where path_target = '%s'},
 			$target, $source);
@@ -47,6 +51,12 @@ sub {
 			return;
 		}
 
+		if ($recref->{source} eq $recref->{target}) {
+			# redirection points to itself, move ahead
+			Log("Redirection for $recref->{source} points to itself.");
+			return;
+		}	
+
 		if ($opt->{bump}) {
 			$Db{path_redirect}->set_field($source, 'last_used', $Tag->time({format => '%s'}));
 		}


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list