Skip to content

Commit 5d2b121

Browse files
authored
Replace call to removed MWHttpRequest::factory (#493)
Since 1.34 MWHttpRequest::factory has been deprecated and it was removed in 1.41. This patch replaces it with what I believe is the obvious successor: HttpRequestFactory This follows the recommended pattern from the mediawiki.org docs[1] of creating the factory from MediaWikiServices and then calls it with the options as before. [1] https://www.mediawiki.org/wiki/Manual:HttpRequestFactory.php Bug: T407480
1 parent b45f10a commit 5d2b121

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

dist-persist/wbstack/src/Settings/Hooks.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use MediaWiki\MediaWikiServices;
4+
35
//// CUSTOM Sidebar for WBStack
46
// https://www.mediawiki.org/wiki/Manual:Hooks/SkinBuildSidebar
57
$wgHooks['SkinBuildSidebar'][] = function ( $skin, &$sidebar ) use ( $wikiInfo ) {
@@ -68,7 +70,8 @@ private static function scheduleDeferredUpdateIfNeeded() {
6870
$options['method'] = 'POST';
6971
$options['timeout'] = 5;
7072
$options['postData'] = json_encode($data);
71-
$request = \MWHttpRequest::factory(
73+
$httpRequestFactory = MediaWikiServices::getInstance()->getHttpRequestFactory();
74+
$request = $httpRequestFactory->create(
7275
'http://' . getenv( 'PLATFORM_API_BACKEND_HOST' ) . '/backend/event/pageUpdateBatch',
7376
$options
7477
);

dist/wbstack/src/Settings/Hooks.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use MediaWiki\MediaWikiServices;
4+
35
//// CUSTOM Sidebar for WBStack
46
// https://www.mediawiki.org/wiki/Manual:Hooks/SkinBuildSidebar
57
$wgHooks['SkinBuildSidebar'][] = function ( $skin, &$sidebar ) use ( $wikiInfo ) {
@@ -68,7 +70,8 @@ private static function scheduleDeferredUpdateIfNeeded() {
6870
$options['method'] = 'POST';
6971
$options['timeout'] = 5;
7072
$options['postData'] = json_encode($data);
71-
$request = \MWHttpRequest::factory(
73+
$httpRequestFactory = MediaWikiServices::getInstance()->getHttpRequestFactory();
74+
$request = $httpRequestFactory->create(
7275
'http://' . getenv( 'PLATFORM_API_BACKEND_HOST' ) . '/backend/event/pageUpdateBatch',
7376
$options
7477
);

0 commit comments

Comments
 (0)