This commit is contained in:
2025-07-09 23:03:00 +02:00
7 changed files with 16 additions and 16 deletions

View File

@@ -102,11 +102,11 @@ class Extension {
* *
* Entry point for the SpecialLinkTitles class and the LinkTitlesJob class. * Entry point for the SpecialLinkTitles class and the LinkTitlesJob class.
* *
* @param MediaWiki\Title\Title $title Title object. * @param \MediaWiki\Title\Title $title Title object.
* @param \RequestContext $context Current request context. If in doubt, call MediaWiki's `RequestContext::getMain()` to obtain such an 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 * @return bool True if the page exists, false if the page does not exist
*/ */
public static function processPage( MediaWiki\Title\Title $title, \RequestContext $context ) { public static function processPage( \MediaWiki\Title\Title $title, \RequestContext $context ) {
$config = new Config(); $config = new Config();
$source = Source::createFromTitle( $title, $config ); $source = Source::createFromTitle( $title, $config );
if ( $source->hasContent() ) { if ( $source->hasContent() ) {

View File

@@ -66,7 +66,7 @@ class Linker {
* callbacks in the Extension class do not always get a WikiPage object in the * callbacks in the Extension class do not always get a WikiPage object in the
* first place. * first place.
* *
* @param MediaWiki\Title\Title &$title Title object for the current page. * @param \MediaWiki\Title\Title &$title Title object for the current page.
* @param String $text String that holds the article content * @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 * @return String|null Source page text with links to target pages, or null if no links were added
*/ */

View File

@@ -46,11 +46,11 @@ class Source {
private $content; private $content;
/** /**
* Creates a Source object from a MediaWiki\Title\Title. * Creates a Source object from a \MediaWiki\Title\Title.
* @param MediaWiki\Title\Title $title Title object from which to create the Source. * @param \MediaWiki\Title\Title $title Title object from which to create the Source.
* @return Source Source object created from the title. * @return Source Source object created from the title.
*/ */
public static function createFromTitle( MediaWiki\Title\Title $title, Config $config ) { public static function createFromTitle( \MediaWiki\Title\Title $title, Config $config ) {
$source = new Source( $config ); $source = new Source( $config );
$source->title = $title; $source->title = $title;
return $source; return $source;
@@ -158,7 +158,7 @@ class Source {
/** /**
* Gets the title. * Gets the title.
* *
* @return MediaWiki\Title\Title Title of the source page. * @return \MediaWiki\Title\Title Title of the source page.
*/ */
public function getTitle() { public function getTitle() {
if ( $this->title === null ) { if ( $this->title === null ) {
@@ -249,7 +249,7 @@ class Source {
/** /**
* Obtain a WikiPage object. * Obtain a WikiPage object.
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory. * Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
* @param MediaWiki\Title\Title $title * @param \MediaWiki\Title\Title $title
* @return WikiPage object * @return WikiPage object
*/ */
private static function getPageObject( $title ) { private static function getPageObject( $title ) {

View File

@@ -25,7 +25,7 @@
namespace LinkTitles; namespace LinkTitles;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use MediaWiki\Title\Title as MWTitle; use \MediaWiki\Title\Title as MWTitle;
/** /**
* Represents a page that is a potential link target. * Represents a page that is a potential link target.
@@ -33,7 +33,7 @@ use MediaWiki\Title\Title as MWTitle;
class Target { class Target {
/** /**
* A Title object for the target page currently being examined. * A Title object for the target page currently being examined.
* @var MediaWiki\Title\Title $title * @var \MediaWiki\Title\Title $title
*/ */
private $title; private $title;
@@ -253,7 +253,7 @@ class Target {
/** /**
* Obtain a page's content. * Obtain a page's content.
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory. * Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
* @param MediaWiki\Title\Title $title * @param \MediaWiki\Title\Title $title
* @return Content content object of the page * @return Content content object of the page
*/ */
private static function getPageContents( $title ) { private static function getPageContents( $title ) {

View File

@@ -24,7 +24,7 @@
*/ */
namespace LinkTitles; namespace LinkTitles;
use MediaWiki\Title\Title; use \MediaWiki\Title\Title;
/** /**
* Fetches potential target page titles from the database. * Fetches potential target page titles from the database.
@@ -85,7 +85,7 @@ class Targets {
/** /**
* The constructor is private to enforce using the singleton pattern. * The constructor is private to enforce using the singleton pattern.
* @param MediaWiki\Title\Title $title * @param \MediaWiki\Title\Title $title
*/ */
private function __construct( MediaWiki\Title\Title $title, Config $config) { private function __construct( MediaWiki\Title\Title $title, Config $config) {
$this->config = $config; $this->config = $config;

View File

@@ -143,7 +143,7 @@ class Cli extends \Maintenance {
private function singlePage() { private function singlePage() {
$pageName = strval( $this->getOption( 'page' ) ); $pageName = strval( $this->getOption( 'page' ) );
$this->output( "Processing single page: '$pageName'\n" ); $this->output( "Processing single page: '$pageName'\n" );
$title = MediaWiki\Title\Title::newFromText( $pageName ); $title = \MediaWiki\Title\Title::newFromText( $pageName );
$success = Extension::processPage( $title, \RequestContext::getMain() ); $success = Extension::processPage( $title, \RequestContext::getMain() );
if ( $success ) { if ( $success ) {
$this->output( "Finished.\n" ); $this->output( "Finished.\n" );
@@ -184,7 +184,7 @@ class Cli extends \Maintenance {
$numProcessed = 0; $numProcessed = 0;
foreach ( $res as $row ) { foreach ( $res as $row ) {
$title = MediaWiki\Title\Title::makeTitleSafe( $row->page_namespace, $row->page_title ); $title = \MediaWiki\Title\Title::makeTitleSafe( $row->page_namespace, $row->page_title );
$numProcessed += 1; $numProcessed += 1;
$index += 1; $index += 1;
if ( $verbose ) { if ( $verbose ) {

View File

@@ -36,7 +36,7 @@ class TargetsTest extends LinkTitles\TestCase {
// LinkTitlesLinkerTest::testLinkContentTargetNamespaces() is every changed, // LinkTitlesLinkerTest::testLinkContentTargetNamespaces() is every changed,
// this test will fail. // this test will fail.
$config->targetNamespaces = [ 4000 ]; $config->targetNamespaces = [ 4000 ];
$title = MediaWiki\Title\Title::newFromText( 'link target' ); $title = \MediaWiki\Title\Title::newFromText( 'link target' );
$targets = LinkTitles\Targets::singleton( $title, $config ); $targets = LinkTitles\Targets::singleton( $title, $config );
// Count number of articles: Inspired by updateArticleCount.php maintenance // Count number of articles: Inspired by updateArticleCount.php maintenance