From 2a07f0145a47756f024d0938f56be46ea1fe371b Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 24 Oct 2024 11:51:37 -0400 Subject: [PATCH 1/2] Additional redirects for mongodb set-to-book conversion The first redirect was added in php/web-php#1100, but additional sections that no longer have their own page were missed. The original conversion was done in php/doc-en#3627 and php/doc-base#138. https://jira.mongodb.org/browse/PHPC-1247 --- error.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/error.php b/error.php index e436cc11fe..1d262d82a7 100644 --- a/error.php +++ b/error.php @@ -252,8 +252,14 @@ 'regexp.reference' => 'regexp.introduction', "security" => "manual/security", - // Set to book + // MongoDB converted from set to book 'set.mongodb' => 'book.mongodb', + 'mongodb.installation.homebrew' => 'mongodb.installation', + 'mongodb.installation.manual' => 'mongodb.installation', + 'mongodb.installation.pecl' => 'mongodb.installation', + 'mongodb.installation.windows' => 'mongodb.installation', + 'mongodb.persistence.deserialization' => 'mongodb.persistence', + 'mongodb.persistence.serialization' => 'mongodb.persistence', ]; if (isset($manual_page_moves[$URI])) { From 899d9f08b02c08d311135b7e138d7fe955a4e237 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 24 Oct 2024 13:51:32 -0400 Subject: [PATCH 2/2] Handle redirects with fragment components See: https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2 --- error.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/error.php b/error.php index 1d262d82a7..32e5612cf3 100644 --- a/error.php +++ b/error.php @@ -254,12 +254,12 @@ // MongoDB converted from set to book 'set.mongodb' => 'book.mongodb', - 'mongodb.installation.homebrew' => 'mongodb.installation', - 'mongodb.installation.manual' => 'mongodb.installation', - 'mongodb.installation.pecl' => 'mongodb.installation', - 'mongodb.installation.windows' => 'mongodb.installation', - 'mongodb.persistence.deserialization' => 'mongodb.persistence', - 'mongodb.persistence.serialization' => 'mongodb.persistence', + 'mongodb.installation.homebrew' => 'mongodb.installation#mongodb.installation.homebrew', + 'mongodb.installation.manual' => 'mongodb.installation#mongodb.installation.manual', + 'mongodb.installation.pecl' => 'mongodb.installation#mongodb.installation.pecl', + 'mongodb.installation.windows' => 'mongodb.installation#mongodb.installation.windows', + 'mongodb.persistence.deserialization' => 'mongodb.persistence#mongodb.persistence.deserialization', + 'mongodb.persistence.serialization' => 'mongodb.persistence#mongodb.persistence.serialization', ]; if (isset($manual_page_moves[$URI])) { @@ -268,7 +268,13 @@ } elseif (preg_match("!^manual/([^/]+)/([^/]+).php$!", $URI, $match) && isset($manual_page_moves[$match[2]])) { status_header(301); - mirror_redirect("/manual/$match[1]/" . $manual_page_moves[$match[2]] . ".php"); + + $parts = explode('#', $manual_page_moves[$match[2]], 2); + if (count($parts) === 1) { + mirror_redirect("/manual/{$match[1]}/{$parts[0]}.php"); + } else { + mirror_redirect("/manual/{$match[1]}/{$parts[0]}.php#{$parts[1]}"); + } } $manual_redirections = [