summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'GentooPackages')
-rw-r--r--GentooPackages/GentooPackages.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/GentooPackages/GentooPackages.php b/GentooPackages/GentooPackages.php
index fe73bda4..f8ecfd79 100644
--- a/GentooPackages/GentooPackages.php
+++ b/GentooPackages/GentooPackages.php
@@ -14,10 +14,18 @@ class GentooPackages {
static function fetchOrError($atom, $type) {
global $wgVersion;
+ $url = "https://packages.gentoo.org/packages/${atom}.json";
if(version_compare( $wgVersion, '1.33', '<=' ))
- $json_str = Http::get("https://packages.gentoo.org/packages/${atom}.json");
- else
- $json_str = \MediaWiki\Http\HttpRequestFactory::get("https://packages.gentoo.org/packages/${atom}.json");
+ $json_str = Http::get($url);
+ else {
+ $httpRequest = \MediaWiki\MediaWikiServices::getInstance()->getHttpRequestFactory()
+ ->create($url, [ 'method' => 'GET' ], __METHOD__ );
+ $status = $httpRequest->execute();
+ if ($status->isOK())
+ $json_str = $httpRequest->getContent();
+ else
+ $json_str = false;
+ }
if ($json_str === false) {
return '<div class="alert alert-danger">Cannot load package information. Is the atom <em>' . htmlspecialchars($atom) . '</em> correct?</div>';