From 845543b2ba917f48a9a7df731c00a5a37275a092 Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 20 Mar 2015 22:45:33 +0000 Subject: [PATCH] fixes #478 - import now uses AddAliasEvent rather than manually adding itself --- ext/alias_editor/main.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index 71add3fb..d6923693 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -153,11 +153,12 @@ class AliasEditor extends Extension { foreach(explode("\n", $csv) as $line) { $parts = str_getcsv($line); if(count($parts) == 2) { - $pair = array("oldtag" => $parts[0], "newtag" => $parts[1]); - if(!$database->get_row("SELECT * FROM aliases WHERE oldtag=:oldtag AND lower(newtag)=lower(:newtag)", $pair)){ - if(!$database->get_row("SELECT * FROM aliases WHERE oldtag=:newtag", array("newtag" => $pair['newtag']))){ - $database->execute("INSERT INTO aliases(oldtag, newtag) VALUES(:oldtag, :newtag)", $pair); - } + try { + $aae = new AddAliasEvent($parts[0], $parts[1]); + send_event($aae); + } + catch(AddAliasException $ex) { + $this->theme->display_error(500, "Error adding alias", $ex->getMessage()); } } }