Page MenuHomePhabricator

Provide title 'pattern' suggestions for redirects
Open, Needs TriagePublicFeature

Description

Often it's useful to create a redirect that has a title that includes something such as an identifier, or a date and time, or random letters, etc. It would be good if RedirectManager could allow such patterns to be defined (e.g. site-wide as a system message, and perhaps also per-user as a preference value).

For example, in the dialog below the list of existing redirects, it could have a list such as:

  • Next item identifier: RB{number}BR27
  • Current date: {date:Y-m-d}2026-05-20
  • Random shortcut: Person {rand:length=4|chars=ABCDEFGHJKMNPQRSTUVWXYZ23456789}Person KWR9
  • Based on current page title Foo Bar: {titleabbr}FB4

And next to each list item would be a 'Use' button which would put that value into the input box at the top (the user would still have to click the 'Add' button).

Event Timeline

Change #1293660 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/RedirectManager@master] Add 'suggested redirects' section

https://gerrit.wikimedia.org/r/1293660

Samwilson renamed this task from Provide title 'patterns' for redirect pages to Provide title 'pattern' suggestions for redirects.Tue, May 26, 9:38 AM
Samwilson updated the task description. (Show Details)

For the {number} pattern we could do it in one query probably, e.g. for A{number}:

WITH nums AS (
	SELECT CAST(SUBSTRING(page_title, 1) AS UNSIGNED) AS x
	FROM page
	WHERE page_title REGEXP '^A[0-9]+$'
) SELECT COALESCE(
	(SELECT MIN(n.x) + 1 FROM nums n LEFT JOIN nums n2 ON n2.x = n.x + 1 WHERE n2.x IS NULL),
	1
) AS next_x;