The concept of a redirect chain didn't really work for a value of max redirect > 1. In the ideal world, we just want to have a source which points to target (source -> target) discarding the concept of a redirect chain completely. Having something like: source -> target -> target1 -> target2 doesn't really work well with the current database design. NOTE: Support for $wgMaxRedirect will be removed soon hence deprecation without interfaces for replacement. Bug: T290639 Change-Id: I469de6f85e405e8ddbe7abaa5b99b77cb9cf415d
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
*
|
|
* @file
|
|
* @author Derick Alangi
|
|
*/
|
|
|
|
namespace MediaWiki\Page;
|
|
|
|
use MediaWiki\Linker\LinkTarget;
|
|
|
|
/**
|
|
* @since 1.38
|
|
*
|
|
* @unstable
|
|
*/
|
|
class RedirectStore implements RedirectLookup {
|
|
/** @var WikiPageFactory */
|
|
private $wikiPageFactory;
|
|
|
|
/**
|
|
* @param WikiPageFactory $wikiPageFactory
|
|
*/
|
|
public function __construct( WikiPageFactory $wikiPageFactory ) {
|
|
$this->wikiPageFactory = $wikiPageFactory;
|
|
}
|
|
|
|
public function getRedirectTarget( PageIdentity $page ): ?LinkTarget {
|
|
return $this->wikiPageFactory->newFromTitle( $page )->getRedirectTarget();
|
|
}
|
|
}
|