[PHP-WEBMASTER] [web-php] master: Additional redirects for mongodb set-to-book conversion (#1103)

Author: Jeremy Mikola (jmikola)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2024-10-25T11:42:44+08:00

Commit: Additional redirects for mongodb set-to-book conversion (#1103) · php/web-php@08cc46b · GitHub
Raw diff: https://github.com/php/web-php/commit/08cc46bd86fd4ea19d2fa9cd4426908c09210807.diff

Additional redirects for mongodb set-to-book conversion (#1103)

Changed paths:
  M error.php

Diff:

diff --git a/error.php b/error.php
index e436cc11fe..32e5612cf3 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.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])) {
@@ -262,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 = [