MediaWiki master
MediaWiki\Rest\Handler\Helper\PageRedirectHelper Class Reference

Helper class for handling page redirects, for use with REST Handlers that provide access to resources bound to MediaWiki pages. More...

Public Member Functions

 __construct (RedirectStore $redirectStore, TitleFormatter $titleFormatter, ResponseFactory $responseFactory, Router $router, string $path, RequestInterface $request, LanguageConverterFactory $languageConverterFactory)
 
 createNormalizationRedirectResponseIfNeeded (PageIdentity $page, ?string $titleAsRequested)
 Check for Page Normalization Redirects and create a Permanent Redirect Response.
 
 createRedirectResponseIfNeeded (PageIdentity $page, ?string $titleAsRequested)
 Use this function for endpoints that check for both normalizations and wiki redirects.
 
 createWikiRedirectResponseIfNeeded (PageIdentity $page)
 Check for Page Wiki Redirects and create a Temporary Redirect Response.
 
 getTargetUrl ( $title)
 
 getWikiRedirectTargetUrl (PageIdentity $page)
 
 setFollowWikiRedirects (bool $followWikiRedirects)
 
 setUseRelativeRedirects (bool $useRelativeRedirects)
 

Detailed Description

Helper class for handling page redirects, for use with REST Handlers that provide access to resources bound to MediaWiki pages.

Since
1.41

Definition at line 23 of file PageRedirectHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::__construct ( RedirectStore $redirectStore,
TitleFormatter $titleFormatter,
ResponseFactory $responseFactory,
Router $router,
string $path,
RequestInterface $request,
LanguageConverterFactory $languageConverterFactory )

Definition at line 35 of file PageRedirectHelper.php.

References $path.

Member Function Documentation

◆ createNormalizationRedirectResponseIfNeeded()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::createNormalizationRedirectResponseIfNeeded ( PageIdentity $page,
?string $titleAsRequested )

Check for Page Normalization Redirects and create a Permanent Redirect Response.

Parameters
PageIdentity$page
?string$titleAsRequested
Returns
Response|null

Definition at line 73 of file PageRedirectHelper.php.

◆ createRedirectResponseIfNeeded()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::createRedirectResponseIfNeeded ( PageIdentity $page,
?string $titleAsRequested )

Use this function for endpoints that check for both normalizations and wiki redirects.

Parameters
PageIdentity$page
string | null$titleAsRequested
Returns
Response|null

Definition at line 212 of file PageRedirectHelper.php.

◆ createWikiRedirectResponseIfNeeded()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::createWikiRedirectResponseIfNeeded ( PageIdentity $page)

Check for Page Wiki Redirects and create a Temporary Redirect Response.

Parameters
PageIdentity$page
Returns
Response|null

Definition at line 97 of file PageRedirectHelper.php.

◆ getTargetUrl()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::getTargetUrl ( $title)
Parameters
string | LinkTarget | PageReference$title
Returns
string The target to use in the Location header. Will be relative, unless setUseRelativeRedirects( false ) was called.

Definition at line 182 of file PageRedirectHelper.php.

◆ getWikiRedirectTargetUrl()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::getWikiRedirectTargetUrl ( PageIdentity $page)
Parameters
PageIdentity$page
Returns
string|null

Definition at line 111 of file PageRedirectHelper.php.

◆ setFollowWikiRedirects()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::setFollowWikiRedirects ( bool $followWikiRedirects)
Parameters
bool$followWikiRedirects

Definition at line 63 of file PageRedirectHelper.php.

◆ setUseRelativeRedirects()

MediaWiki\Rest\Handler\Helper\PageRedirectHelper::setUseRelativeRedirects ( bool $useRelativeRedirects)
Parameters
bool$useRelativeRedirects

Definition at line 56 of file PageRedirectHelper.php.


The documentation for this class was generated from the following file: