Compare commits

...

4 Commits

Author SHA1 Message Date
Jayden Bailey bbff717a24 Add extra debug log message 2019-11-23 09:55:16 +00:00
Jayden Bailey 6d8b2c33cb Add Content-Type header for curl requests 2019-11-23 09:53:09 +00:00
Jayden Bailey 47eef3c35d Small fix for error message 2019-11-23 09:00:24 +00:00
Jayden Bailey 7f51c4f310 Update README 2019-07-24 12:29:13 +01:00
3 changed files with 7 additions and 2 deletions
+1
View File
@@ -68,6 +68,7 @@ This extension can be configured using the `LocalSettings.php` file in your Medi
- `UploadComplete` - File was uploaded
- `FileDeleteComplete` - File revision was deleted
- `FileUndeleteComplete` - File revision was restored
- `AfterImportPage` - Page was imported
## Translation
This extension can be translated through the messages in the `ì18n` folder if you're a developer. As a wiki administrator, you may find it a better option to edit the messages on-site in the MediaWiki namespace.
+1 -1
View File
@@ -4,7 +4,7 @@
"[https://github.com/jaydenkieran Jayden Bailey]"
],
"url": "https://github.com/jaydenkieran/mw-discord",
"version": "1.0.8",
"version": "1.0.10",
"descriptionmsg": "discord-desc",
"license-name": "MIT",
"manifest_version": 1,
+5 -1
View File
@@ -73,7 +73,7 @@ class DiscordUtils {
$stripped = $dateString . ' ' . $stripped;
}
DeferredUpdates::addCallableUpdate( function() use ( $stripped, $urls ) {
DeferredUpdates::addCallableUpdate( function() use ( $stripped, $urls, $wgDiscordUseFileGetContents ) {
$user_agent = 'mw-discord/1.0 (github.com/jaydenkieran)';
$json_data = [ 'content' => "$stripped" ];
$json = json_encode($json_data);
@@ -111,6 +111,9 @@ class DiscordUtils {
curl_setopt( $c_handlers[$value], CURLOPT_CONNECTTIMEOUT, 10 ); // Add a timeout for connecting to the site
curl_setopt( $c_handlers[$value], CURLOPT_TIMEOUT, 10 ); // Do not allow cURL to run for a long time
curl_setopt( $c_handlers[$value], CURLOPT_USERAGENT, $user_agent ); // Add a unique user agent
curl_setopt( $c_handlers[$value], CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
));
curl_multi_add_handle( $mh, $c_handlers[$value] );
}
@@ -122,6 +125,7 @@ class DiscordUtils {
// Remove all handlers and then close the multi handler
foreach($c_handlers as $k => $ch) {
$result[$k] = curl_multi_getcontent($ch);
wfDebugLog( 'discord', 'Result of cURL was: ' . $result[$k] );
curl_multi_remove_handle($mh, $ch);
}