[post_tags] avoid DB call if not needed
This commit is contained in:
parent
b97827a6af
commit
5c4b7c1284
1 changed files with 8 additions and 4 deletions
|
@ -186,11 +186,15 @@ class PostTags extends Extension
|
|||
|
||||
public function onParseLinkTemplate(ParseLinkTemplateEvent $event): void
|
||||
{
|
||||
// get_tag_list can trigger a database query,
|
||||
// so we only want to do it if we need to
|
||||
if (str_contains($event->link, '$tags')) {
|
||||
$tags = $event->image->get_tag_list();
|
||||
$tags = str_replace("/", "", $tags);
|
||||
$tags = ltrim($tags, ".");
|
||||
$event->replace('$tags', $tags);
|
||||
}
|
||||
}
|
||||
|
||||
private function mass_tag_edit(string $search, string $replace, bool $commit): void
|
||||
{
|
||||
|
|
Reference in a new issue