Ladsgroup has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/400398 )
Change subject: Use ExtensionRegistry instead of class_exists
......................................................................
Use ExtensionRegistry instead of class_exists
Bug: T183096
Change-Id: I4e47cddb3435199d7d11c14d3b1bdaaf38fae791
---
M includes/MobileFrontend.body.php
M includes/MobileFrontend.hooks.php
M includes/api/ApiMobileView.php
3 files changed, 8 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/98/400398/1
diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index d2b059a..44de98c 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -3,6 +3,7 @@
* MobileFrontend.body.php
*/
+use ExtensionRegistry;
use Wikibase\Client\WikibaseClient;
use Wikibase\DataModel\Entity\ItemId;
use MobileFrontend\ContentProviders\ContentProviderFactory;
@@ -132,7 +133,7 @@
* @return mw.wikibase.entity|null
*/
public static function getWikibaseEntity( $item ) {
- if ( !class_exists( 'Wikibase\\Client\\WikibaseClient' ) ) {
+ if ( !ExtensionRegistry::getInstance()->isLoaded(
'WikibaseClient' ) ) {
return null;
}
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index 37636b8..888a3cb 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -3,6 +3,7 @@
* MobileFrontend.hooks.php
*/
+use ExtensionRegistry;
use MediaWiki\Auth\AuthManager;
/**
@@ -905,7 +906,7 @@
self::registerMobileLoggingSchemasModule( $resourceLoader );
// add VisualEditor related modules only, if VisualEditor seems
to be installed - T85007
- if ( class_exists( 'VisualEditorHooks' ) ) {
+ if ( ExtensionRegistry::getInstance()->isLoaded( 'VisualEditor'
) ) {
$resourceLoader->register( [
'mobile.editor.ve' => $resourceBoilerplate + [
'dependencies' => [
@@ -1038,7 +1039,7 @@
$schemaMobileWebMainMenuClickTracking =
$mfResourceFileModuleBoilerplate;
$schemaMobileWebSearch = $mfResourceFileModuleBoilerplate;
- if ( class_exists( 'EventLogging' ) ) {
+ if ( ExtensionRegistry::getInstance()->isLoaded( 'EventLogging'
) ) {
// schema.Edit is provided by WikimediaEvents
if ( $resourceLoader->isModuleRegistered( 'schema.Edit'
) ) {
$schemaEdit += [
diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index c3380c9..458d422 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -1,7 +1,6 @@
<?php
-/**
- * ApiMobileView.php
- */
+
+use ExtensionRegistry;
/**
* Extends Api of MediaWiki with actions for mobile devices. For further
information see
@@ -248,7 +247,7 @@
// https://bugzilla.wikimedia.org/show_bug.cgi?id=51586
// Inform ppl if the page is infested with LiquidThreads but
that's the
// only thing we support about it.
- if ( class_exists( 'LqtDispatch' ) && LqtDispatch::isLqtPage(
$title ) ) {
+ if ( ExtensionRegistry::getInstance()->isLoaded(
'LiquidThreads' ) && LqtDispatch::isLqtPage( $title ) ) {
$resultObj->addValue( null, $moduleName,
[ 'liquidthreads' => true ]
);
--
To view, visit https://gerrit.wikimedia.org/r/400398
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e47cddb3435199d7d11c14d3b1bdaaf38fae791
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits