From de761c11d779837119aabb1a7b0b574734889d95 Mon Sep 17 00:00:00 2001 From: Daku Date: Thu, 8 Oct 2015 19:20:40 +0100 Subject: [PATCH] speed: don't check tag for metatag if doesn't contain : or = --- ext/tag_edit/main.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 918a0111..12be5ab7 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -110,6 +110,13 @@ class TagSetEvent extends Event { $tag_array = Tag::resolve_aliases($tag_array); foreach($tag_array as $tag) { + if((strpos($tag, ':') === FALSE) && (strpos($tag, '=') === FALSE)) { + //Tag doesn't contain : or =, meaning it can't possibly be a metatag. + //This should help speed wise, as it avoids running every single tag through a bunch of preg_match instead. + array_push($this->tags, $tag); + continue; + } + $ttpe = new TagTermParseEvent($tag, $this->image->id, FALSE); //Only check for metatags, don't parse. Parsing is done after set_tags. send_event($ttpe);