For resolving this issue should be implemented service for easy sending request to UptimeRobot API.
cURL shouldn't be used. Use Guzzle Http Client instead (default drupal http client).
So to be able to use
\Drupal::service('uptime_widget')->getMonitors($params);
\Drupal::service('uptime_widget')->getCurrentMonitor($params);
Or inject the sevice to the custom class.
Also need to replace current API's calls.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | uptime_widget-service-fix-2939954-10.patch | 631 bytes | id.rem.dev |
| #6 | uptime_widget-service-fix-2939954-6.patch | 5.16 KB | knyshuk.vova |
| #5 | uptime_widget_service-2939954.patch | 5.18 KB | id.rem.dev |
Comments
Comment #2
knyshuk.vova commentedComment #3
id.rem.dev commentedI`ll try to handle this.
Comment #4
knyshuk.vova commentedComment #5
id.rem.dev commentedPlease review. Single service method to handle all requests.
Comment #6
knyshuk.vova commentedWhat was changed in previous patch:
- removed wrong interface implemention
- changed comment
Comment #8
knyshuk.vova commentedComment #9
lolandese commentedAfter saving the settings form at admin/config/system/uptime-widget:
Recoverable fatal error: Argument 1 passed to Drupal\\uptime_widget\\Service\\UptimeWidgetService::sendPost() must be an instance of Drupal\\uptime_widget\\Service\\string, string given, called in /modules/contrib/uptime_widget/src/Form/UptimeAdminSettingsForm.php on line 298 and defined in /modules/contrib/uptime_widget/src/Service/UptimeWidgetService.php on line 75
Comment #10
id.rem.dev commentedRemoved string declaration. Can`t reproduce with Drupal 8.6.x-dev, 8.5.x-dev, 8.4.4, 8.4.x.
Made patch from 8.x-1.x branch.
Comment #12
lolandese commentedI used Drupal Version 8.4.3. The last change fixed the issue for this version.