Skip to content

migrate doc redirects to redirects.json sidecar from doc-en#1960

Open
jordikroon wants to merge 1 commit into
php:masterfrom
jordikroon:doc-redirects
Open

migrate doc redirects to redirects.json sidecar from doc-en#1960
jordikroon wants to merge 1 commit into
php:masterfrom
jordikroon:doc-redirects

Conversation

@jordikroon

Copy link
Copy Markdown
Member

The goal for this PR is to migrate all doc related redirects out of web-php.
Instead we generate a redirects.json from redirects.xml which is then loaded in-place.

Redirects not related to docs are NOT migrated. However shortcuts are.

Depends on:

php/phd#260
php/doc-en#5658

@sy-records

Copy link
Copy Markdown
Member

Do other languages also need to generate a redirects.xml file?

@jordikroon

Copy link
Copy Markdown
Member Author

No. While technically they can, we should only load doc-en. The file is explicitly marked as <?do-not-translate?> in doc-en and should not have a copy in doc-lang repos.

Though it will be very likely that we will add a variant of redirects.xml to doc-ext (third-party extension manual) in the future.

Having the redirects.xml in doc-en (not doc-base) allows us to manage redirects from one PR, rather than having PRs to depend on each other. It also allows a variant in doc-ext in later on.

Comment thread error.php
// 'both' - matches at either entry point

$docRedirects = is_file(__DIR__ . '/manual/en/redirects.json')
? json_decode(file_get_contents(__DIR__ . '/manual/en/redirects.json'), true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json_decode() can also fail of the JSON file is corrupted for some reason. Please guard against that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants