mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-23 15:57:10 +00:00
Fixes for 1.39 (#90)
This commit is contained in:
parent
20a96bde1d
commit
574e709a45
14
.github/workflows/mediawiki-tests.yml
vendored
14
.github/workflows/mediawiki-tests.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
|||
matrix:
|
||||
include:
|
||||
# Latest stable MediaWiki - PHP 7.4 (phan)
|
||||
- mw: 'REL1_37'
|
||||
- mw: 'REL1_39'
|
||||
php: 7.4
|
||||
php-docker: 74
|
||||
experimental: false
|
||||
|
@ -35,7 +35,7 @@ jobs:
|
|||
stage: coverage
|
||||
|
||||
# Latest stable MediaWiki - PHP 7.4 (phpunit-unit)
|
||||
- mw: 'REL1_37'
|
||||
- mw: 'REL1_39'
|
||||
php: 7.4
|
||||
php-docker: 74
|
||||
experimental: false
|
||||
|
@ -49,7 +49,7 @@ jobs:
|
|||
stage: phpunit-unit
|
||||
|
||||
# Latest stable MediaWiki - PHP 7.4 (phpunit)
|
||||
- mw: 'REL1_37'
|
||||
- mw: 'REL1_39'
|
||||
php: 7.4
|
||||
php-docker: 74
|
||||
experimental: false
|
||||
|
@ -63,7 +63,7 @@ jobs:
|
|||
stage: phpunit
|
||||
|
||||
# Latest stable MediaWiki - PHP 7.4 (selenium)
|
||||
- mw: 'REL1_37'
|
||||
- mw: 'REL1_39'
|
||||
php: 7.4
|
||||
php-docker: 74
|
||||
experimental: false
|
||||
|
@ -77,7 +77,7 @@ jobs:
|
|||
stage: selenium
|
||||
|
||||
# Latest stable MediaWiki - PHP 7.4 (qunit)
|
||||
- mw: 'REL1_37'
|
||||
- mw: 'REL1_39'
|
||||
php: 7.4
|
||||
php-docker: 74
|
||||
experimental: false
|
||||
|
@ -91,14 +91,14 @@ jobs:
|
|||
stage: qunit
|
||||
|
||||
# Latest stable MediaWiki - PHP 7.4 (npm-test)
|
||||
- mw: 'REL1_38'
|
||||
- mw: 'REL1_39'
|
||||
php: 7.4
|
||||
php-docker: 74
|
||||
experimental: false
|
||||
stage: npm-test
|
||||
|
||||
# Latest stable MediaWiki - PHP 7.4 (composer-test)
|
||||
- mw: 'REL1_38'
|
||||
- mw: 'REL1_39'
|
||||
php: 7.4
|
||||
php-docker: 74
|
||||
experimental: false
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# PortableInfobox
|
||||
Port of FANDOM's https://github.com/Wikia/app/tree/dev/extensions/wikia/PortableInfobox extension to MediaWiki 1.37.0+
|
||||
Port of FANDOM's https://github.com/Wikia/app/tree/dev/extensions/wikia/PortableInfobox extension to MediaWiki 1.39.0+ (1.37-1.38 are available in release branches)
|
||||
|
||||
## Installation
|
||||
Grab the latest release from [GitHub](https://github.com/Universal-Omega/PortableInfobox) and unpack it into `extensions\PortableInfobox` directory in your MediaWiki installation or clone this repository, by using these commands:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"type": "parserhook",
|
||||
"license-name": "GPL-3.0-or-later",
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.37.0",
|
||||
"MediaWiki": ">= 1.39.0",
|
||||
"platform": {
|
||||
"php": ">= 7.3"
|
||||
}
|
||||
|
|
|
@ -176,23 +176,11 @@ class PortableInfoboxParserTagController {
|
|||
}
|
||||
|
||||
private static function parserOutputGetPageProperty( \ParserOutput $parserOutput, string $name ) {
|
||||
if ( method_exists( \ParserOutput::class, 'getPageProperty' ) ) {
|
||||
// @phan-suppress-next-line PhanUndeclaredMethod since 1.38
|
||||
return $parserOutput->getPageProperty( $name );
|
||||
} else {
|
||||
// @phan-suppress-next-line PhanDeprecatedFunction deprecated since 1.38
|
||||
return $parserOutput->getProperty( $name );
|
||||
}
|
||||
return $parserOutput->getPageProperty( $name );
|
||||
}
|
||||
|
||||
private static function parserOutputSetPageProperty( \ParserOutput $parserOutput, string $name, $value ) {
|
||||
if ( method_exists( \ParserOutput::class, 'setPageProperty' ) ) {
|
||||
// @phan-suppress-next-line PhanUndeclaredMethod since 1.38
|
||||
$parserOutput->setPageProperty( $name, $value );
|
||||
} else {
|
||||
// @phan-suppress-next-line PhanDeprecatedFunction deprecated since 1.38
|
||||
$parserOutput->setProperty( $name, $value );
|
||||
}
|
||||
$parserOutput->setPageProperty( $name, $value );
|
||||
}
|
||||
|
||||
private function handleError( $message ) {
|
||||
|
|
|
@ -33,7 +33,7 @@ class AllInfoboxesQueryPage extends PageQueryPage {
|
|||
]
|
||||
];
|
||||
|
||||
$dbr = $this->getDBLoadBalancer()->getConnectionRef( DB_REPLICA );
|
||||
$dbr = $this->getDBLoadBalancer()->getConnection( DB_REPLICA );
|
||||
|
||||
$subpagesBlacklist = $this->getConfig()->get( 'AllInfoboxesSubpagesBlacklist' );
|
||||
foreach ( $subpagesBlacklist as $subpage ) {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace PortableInfobox\Helpers;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
class PagePropsProxy {
|
||||
|
||||
protected $atomicStarted;
|
||||
|
@ -12,7 +14,8 @@ class PagePropsProxy {
|
|||
}
|
||||
|
||||
public function get( $id, $property ) {
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$dbLoadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
|
||||
$dbr = $dbLoadBalancer->getConnection( DB_REPLICA );
|
||||
$propValue = $dbr->selectField(
|
||||
'page_props',
|
||||
'pp_value',
|
||||
|
@ -26,7 +29,8 @@ class PagePropsProxy {
|
|||
}
|
||||
|
||||
public function set( $id, array $props ) {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbLoadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
|
||||
$dbw = $dbLoadBalancer->getConnection( DB_PRIMARY );
|
||||
|
||||
if ( !$this->atomicStarted ) {
|
||||
$dbw->startAtomic( __METHOD__ );
|
||||
|
@ -59,7 +63,10 @@ class PagePropsProxy {
|
|||
|
||||
public function write() {
|
||||
if ( $this->atomicStarted && $this->manualWrite ) {
|
||||
wfGetDB( DB_PRIMARY )->endAtomic( __CLASS__ . '::set' );
|
||||
$dbLoadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
|
||||
$dbLoadBalancer->getConnection( DB_PRIMARY )
|
||||
->endAtomic( __CLASS__ . '::set' );
|
||||
|
||||
$this->atomicStarted = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,13 +74,7 @@ class PortableInfoboxParsingHelper {
|
|||
}
|
||||
|
||||
private static function parserOutputGetPageProperty( \ParserOutput $parserOutput, string $name ) {
|
||||
if ( method_exists( \ParserOutput::class, 'getPageProperty' ) ) {
|
||||
// @phan-suppress-next-line PhanUndeclaredMethod since 1.38
|
||||
return $parserOutput->getPageProperty( $name );
|
||||
} else {
|
||||
// @phan-suppress-next-line PhanDeprecatedFunction deprecated since 1.38
|
||||
return $parserOutput->getProperty( $name );
|
||||
}
|
||||
return $parserOutput->getPageProperty( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,22 +94,14 @@ class MediaWikiParserService implements ExternalParser {
|
|||
|
||||
// Pass PI images to PageImages extension if available (Popups and og:image)
|
||||
if ( method_exists(
|
||||
ParserFileProcessingHookHandlers::class, 'onParserMakeImageParams'
|
||||
) ) {
|
||||
$params = [];
|
||||
// @phan-suppress-next-line PhanUndeclaredStaticMethod
|
||||
ParserFileProcessingHookHandlers::onParserMakeImageParams(
|
||||
$title, $file, $params, $this->parser
|
||||
);
|
||||
} elseif ( method_exists(
|
||||
ParserFileProcessingHookHandlers::class, 'onParserModifyImageHTML'
|
||||
) ) {
|
||||
// 1.38+
|
||||
$handler = new ParserFileProcessingHookHandlers();
|
||||
|
||||
$params = [];
|
||||
$html = '';
|
||||
|
||||
// @phan-suppress-next-line PhanUndeclaredStaticMethod
|
||||
ParserFileProcessingHookHandlers::onParserModifyImageHTML(
|
||||
$handler->onParserModifyImageHTML(
|
||||
$this->parser, $file, $params, $html
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue