Upgrade to use of new MediaWiki\Title for use in MW 1.44

This commit is contained in:
2025-07-09 22:27:34 +02:00
parent 90edd23e4f
commit 5a32049982
10 changed files with 30 additions and 26 deletions

View File

@@ -24,6 +24,8 @@
*/
namespace LinkTitles;
use MediaWiki\Title\Title;
/**
* Fetches potential target page titles from the database.
*/
@@ -41,7 +43,7 @@ class Targets {
* @param String $sourceNamespace The namespace of the current page.
* @param Config $config LinkTitles configuration.
*/
public static function singleton( \Title $title, Config $config ) {
public static function singleton( \MediaWiki\Title\Title $title, Config $config ) {
if ( ( self::$instance === null ) || ( self::$instance->sourceNamespace != $title->getNamespace() ) ) {
self::$instance = new Targets( $title, $config );
}
@@ -83,9 +85,9 @@ class Targets {
/**
* The constructor is private to enforce using the singleton pattern.
* @param \Title $title
* @param MediaWiki\Title\Title $title
*/
private function __construct( \Title $title, Config $config) {
private function __construct( MediaWiki\Title\Title $title, Config $config) {
$this->config = $config;
$this->sourceNamespace = $title->getNamespace();
$this->fetch();
@@ -135,7 +137,7 @@ class Targets {
// shortest to longest. Only titles from 'normal' pages (namespace uid
// = 0) are returned. Since the db may be sqlite, we need a try..catch
// structure because sqlite does not support the CHAR_LENGTH function.
$dbr = wfGetDB( DB_REPLICA );
$dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_REPLICA );
$this->queryResult = $dbr->select(
'page',
array( 'page_title', 'page_namespace' , "weight" => $weightSelect),