From c1fea2f645ad4c7b5477bce1837d8f6e96ca21c6 Mon Sep 17 00:00:00 2001 From: Sergio Date: Tue, 16 Jul 2019 16:42:48 +0100 Subject: [PATCH] DD-1449 : fixed issues with mce_href --- src/Dennis/Link/Checker/Processor.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Dennis/Link/Checker/Processor.php b/src/Dennis/Link/Checker/Processor.php index 42c963f..d8eb564 100644 --- a/src/Dennis/Link/Checker/Processor.php +++ b/src/Dennis/Link/Checker/Processor.php @@ -56,6 +56,11 @@ public function run() { return FALSE; } + // Clear the queue if nids are present as parameters. + if (!empty($this->config->getNodeList())) { + $this->getQueue()->deleteQueue(); + } + $end = time() + $this->timeLimit; // Remove any old items from the queue. @@ -305,7 +310,6 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) { $entity = $field->getEntity(); foreach ($links as $link) { - // If url is protocol neutral, force it to use http. if (substr( $link->originalHref(), 0, 2 ) === "//") { $url = ltrim($link->originalHref(), '//'); @@ -342,6 +346,14 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) { . ' => ' . $suggested); } + // Remove mce_href parameter from links. + if ($link->removeMceHref()) { + $this->config->getLogger()->info('mce_href removed | ' + . $entity->entityType() . '/' . $entity->entityId() + . ' | ' . $link->originalHref() . " => " . $link->correctedHref()); + $do_field_save = TRUE; + } + // Do the correction if needed. if ($link->corrected() && $this->updateLink($entity, $link)) { $do_field_save = TRUE; @@ -369,11 +381,6 @@ public function updateLink(EntityInterface $entity, LinkInterface $link) { . ' | ' . $link->originalHref() . " => " . $link->correctedHref()); } else { - if ($link->removeMceHref()) { - $this->config->getLogger()->info('mce_href removed | ' - . $entity->entityType() . '/' . $entity->entityId() - . ' | ' . $link->originalHref() . " => " . $link->correctedHref()); - } if ($link->replace()) { $this->config->getLogger()->info('Link corrected | ' . $entity->entityType() . '/' . $entity->entityId()