mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-08-31 21:56:55 +02:00
more changes
This commit is contained in:
@@ -29,7 +29,7 @@ use CommentStoreComment;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Revision\RenderedRevision;
|
||||
use MediaWiki\Revision\SlotRecord;
|
||||
use MediaWiki\Title\Title;
|
||||
use MediaWiki\Title\Title as MWTitle;
|
||||
use Status;
|
||||
use WikiPage;
|
||||
use User;
|
||||
@@ -103,11 +103,11 @@ class Extension {
|
||||
*
|
||||
* Entry point for the SpecialLinkTitles class and the LinkTitlesJob class.
|
||||
*
|
||||
* @param Title $title Title object.
|
||||
* @param MWTitle $title MWTitle object.
|
||||
* @param \RequestContext $context Current request context. If in doubt, call MediaWiki's `RequestContext::getMain()` to obtain such an object.
|
||||
* @return bool True if the page exists, false if the page does not exist
|
||||
*/
|
||||
public static function processPage( Title $title, \RequestContext $context ) {
|
||||
public static function processPage( MWTitle $title, \RequestContext $context ) {
|
||||
$config = new Config();
|
||||
$source = Source::createFromTitle( $title, $config );
|
||||
if ( $source->hasContent() ) {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
namespace LinkTitles;
|
||||
|
||||
use MediaWiki\Title\Title;
|
||||
use MediaWiki\Title\Title as MWTitle;
|
||||
|
||||
/**
|
||||
* Performs the actual linking of content to existing pages.
|
||||
@@ -63,12 +63,12 @@ class Linker {
|
||||
/**
|
||||
* Core function of the extension, performs the actual parsing of the content.
|
||||
*
|
||||
* This method receives a Title object and the string representation of the
|
||||
* This method receives a MWTitle object and the string representation of the
|
||||
* source page. It does not work on a WikiPage object directly because the
|
||||
* callbacks in the Extension class do not always get a WikiPage object in the
|
||||
* first place.
|
||||
*
|
||||
* @param Title &$title Title object for the current page.
|
||||
* @param MWTitle &$title MWTitle object for the current page.
|
||||
* @param String $text String that holds the article content
|
||||
* @return String|null Source page text with links to target pages, or null if no links were added
|
||||
*/
|
||||
|
@@ -25,7 +25,7 @@
|
||||
namespace LinkTitles;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Title\Title;
|
||||
use MediaWiki\Title\Title as MWTitle;
|
||||
|
||||
/**
|
||||
* Represents a page that is a potential link target.
|
||||
@@ -48,10 +48,10 @@ class Source {
|
||||
|
||||
/**
|
||||
* Creates a Source object from a Title.
|
||||
* @param Title $title Title object from which to create the Source.
|
||||
* @param MWTitle $title MWTitle object from which to create the Source.
|
||||
* @return Source Source object created from the title.
|
||||
*/
|
||||
public static function createFromTitle( Title $title, Config $config ) {
|
||||
public static function createFromTitle( MWTitle $title, Config $config ) {
|
||||
$source = new Source( $config );
|
||||
$source->title = $title;
|
||||
return $source;
|
||||
@@ -63,12 +63,12 @@ class Source {
|
||||
* This factory can be called e.g. from a onPageContentSave event handler
|
||||
* which knows both these parameters.
|
||||
*
|
||||
* @param Title $title Title of the source page
|
||||
* @param MWTitle $title MWTitle of the source page
|
||||
* @param String $text String representation of the page content
|
||||
* @param Config $config LinkTitles configuration
|
||||
* @return Source Source object created from the title and the text
|
||||
*/
|
||||
public static function createFromTitleAndText( Title $title, $text, Config $config ) {
|
||||
public static function createFromTitleAndText( MWTitle $title, $text, Config $config ) {
|
||||
$source = Source::createFromTitle( $title, $config);
|
||||
$source->text = $text;
|
||||
return $source;
|
||||
@@ -159,7 +159,7 @@ class Source {
|
||||
/**
|
||||
* Gets the title.
|
||||
*
|
||||
* @return Title Title of the source page.
|
||||
* @return MWTitle MWTitle of the source page.
|
||||
*/
|
||||
public function getTitle() {
|
||||
if ( $this->title === null ) {
|
||||
@@ -250,7 +250,7 @@ class Source {
|
||||
/**
|
||||
* Obtain a WikiPage object.
|
||||
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
|
||||
* @param Title $title
|
||||
* @param MWTitle $title
|
||||
* @return WikiPage object
|
||||
*/
|
||||
private static function getPageObject( $title ) {
|
||||
|
@@ -25,15 +25,15 @@
|
||||
namespace LinkTitles;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Title\Title;
|
||||
use MediaWiki\Title\Title as MWTitle;
|
||||
|
||||
/**
|
||||
* Represents a page that is a potential link target.
|
||||
*/
|
||||
class Target {
|
||||
/**
|
||||
* A Title object for the target page currently being examined.
|
||||
* @var Title $title
|
||||
* A MWTitle object for the target page currently being examined.
|
||||
* @var MWTitle $title
|
||||
*/
|
||||
private $title;
|
||||
|
||||
@@ -77,7 +77,7 @@ class Target {
|
||||
* @param String &$title Title of the target page
|
||||
*/
|
||||
public function __construct( $namespace, $title, Config &$config ) {
|
||||
$this->title = Title::makeTitleSafe( $namespace, $title );
|
||||
$this->title = MWTitle::makeTitleSafe( $namespace, $title );
|
||||
$this->titleValue = $this->title->getTitleValue();
|
||||
$this->config = $config;
|
||||
|
||||
@@ -253,7 +253,7 @@ class Target {
|
||||
/**
|
||||
* Obtain a page's content.
|
||||
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
|
||||
* @param Title $title
|
||||
* @param MWTitle $title
|
||||
* @return Content content object of the page
|
||||
*/
|
||||
private static function getPageContents( $title ) {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
namespace LinkTitles;
|
||||
|
||||
use \MediaWiki\Title\Title as MWTitle;
|
||||
use MediaWiki\Title\Title as MWTitle;
|
||||
|
||||
/**
|
||||
* Fetches potential target page titles from the database.
|
||||
|
Reference in New Issue
Block a user