From d51ece7308f9af64fb67e20d173e87da310ed402 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 10 Nov 2017 14:53:56 +1300 Subject: [PATCH] FIX Ensure first processed stable version is treated as canonical --- code/DocumentationManifest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/DocumentationManifest.php b/code/DocumentationManifest.php index bd7463d..3d83a61 100644 --- a/code/DocumentationManifest.php +++ b/code/DocumentationManifest.php @@ -459,7 +459,12 @@ class DocumentationManifest { $fromLink = $this->stripLinkBase($from); $toLink = $this->stripLinkBase($to); - $this->redirects[$fromLink] = $toLink; + + // If the redirect "from" is already registered with a "to", don't override it. This ensures + // that the first version processed is treated as the canonical version. + if (!isset($this->redirects[$fromLink])) { + $this->redirects[$fromLink] = $toLink; + } } /**