Skip to content

Commit

Permalink
Merge pull request #22 from MindscapeHQ/setup-async-option
Browse files Browse the repository at this point in the history
Update dependencies to latest versions and add async sending option
  • Loading branch information
BenjaminHarding authored Feb 25, 2018
2 parents d260edc + 422657f commit c7addf8
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ You can enter a comma-delimited list in the field on the settings page to preven

Introduced in 1.1.3, this provider will now send asynchronously on *nix servers (async sockets) resulting in a massive speedup - POSTing to Raygun now takes ~56ms including SSL handshakes. This behaviour can be disabled in code if desired to fall back to blocking socket sends. Async sending is also unavailable on Windows due to a bug in PHP 5.3, and as a result it uses cURL processes. This can be disabled if your server is running a newer environment; please create an issue if you'd like help with this.

As of 1.9.0, you can now toggle asynchronous sending through the Raygun settings page in the admin dashboard.

## Multisite Support

It is recommended to use the most recent version WordPress and PHP possible. This procedure should be first followed on a staging server that matches your production environment as closely as possible, then replicated live.
Expand All @@ -95,6 +97,7 @@ Finally, if you so desire you should be able to visit the root network site, act
Changelog
---------

- 1.9.0: Add async sending option to dashboard; Bump Raygun4JS dependency to v2.8.5; Bump Raygun4PHP dependency to v1.8.2
- 1.8.3: Fix XSS vulnerability in settings; Replace the iframe with a link to the Raygun dashboard
- 1.8.2: Bump Raygun4JS version to v2.6.2
- 1.8.1: XSS bug fix
Expand Down
16 changes: 14 additions & 2 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function rg4wp_install()
add_option('rg4wp_ignoredomains', '', '', 'yes');
add_option('rg4wp_pulse', '', '', 'yes');
add_option('rg4wp_js_tags', '', '', 'yes');
add_option('rg4wp_async', '0', '', 'yes');
}

function rg4wp_uninstall()
Expand All @@ -110,6 +111,7 @@ function rg4wp_uninstall()
delete_option('rg4wp_ignoredomains');
delete_option('rg4wp_pulse');
delete_option('rg4wp_js_tags');
delete_option('rg4wp_async');
}

function rg4wp_checkUser($client)
Expand All @@ -128,13 +130,22 @@ function rg4wp_isIgnoredDomain()
return in_array($_SERVER['SERVER_NAME'], $domains);
}

function rg4wp_useAsyncSending()
{
$async = get_option('rg4wp_async');
if($async === "1") {
return true;
}
return false;
}

function rg4wp_404_handler()
{
if (get_option('rg4wp_status') && get_option('rg4wp_404s') &&
!rg4wp_isIgnoredDomain() && is_404() && get_option('rg4wp_apikey'))
{
require_once dirname(__FILE__).'/external/raygun4php/src/Raygun4php/RaygunClient.php';
$client = new Raygun4php\RaygunClient(get_option('rg4wp_apikey'), false);
$client = new Raygun4php\RaygunClient(get_option('rg4wp_apikey'), rg4wp_useAsyncSending());
$tags = array_map('trim', explode(',', get_option('rg4wp_tags')));

if (!is_array($tags)) {
Expand All @@ -155,7 +166,7 @@ function rg4wp_404_handler()
{

require_once dirname(__FILE__).'/external/raygun4php/src/Raygun4php/RaygunClient.php';
$client = new Raygun4php\RaygunClient(get_option('rg4wp_apikey'), false);
$client = new Raygun4php\RaygunClient(get_option('rg4wp_apikey'), rg4wp_useAsyncSending());
$tags = explode(',', get_option('rg4wp_tags'));

if (!is_array($tags)) {
Expand Down Expand Up @@ -223,6 +234,7 @@ function rg4wp_register_settings(){
register_setting( 'rg4wp', 'rg4wp_ignoredomains');
register_setting( 'rg4wp', 'rg4wp_pulse');
register_setting( 'rg4wp', 'rg4wp_js_tags');
register_setting( 'rg4wp', 'rg4wp_async');
}

function rg4wp_admin_styles($hook) {
Expand Down
2 changes: 1 addition & 1 deletion raygun4wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Raygun4WP
Plugin URI: http://github.com/mindscapehq/raygun4wordpress
Description: Exceptional error, performance, user tracking and more with Raygun.com. This service integrates Raygun Crash Reporting which lets you monitor your site's health with beautiful graphs and comprehensive reports, so you are always aware of any points of failure. With Raygun's Real User Monitoring you can monitor the performance of every individual user session, so you can discover and fix fundamental bottlenecks that affect your end user experience. This plugin has a simple one-minute, no-code-required installation.
Version: 1.8.3.0
Version: 1.9.0.0
Author: Mindscape
Author URI: http://raygun.com
License: MIT
Expand Down
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: mindscapehq
Donate link: http://raygun.com
Tags: error reporting, raygun, exception, 404, crash reporting, JavaScript, PHP, error monitoring, error tracking, bug tracking, real user monitoring, pulse
Requires at least: 3.4
Tested up to: 4.8.2
Stable tag: 1.8.3.0
Tested up to: 4.9.4
Stable tag: 1.9.0.0
License: MIT
License URI: http://opensource.org/licenses/MIT

Expand Down Expand Up @@ -80,6 +80,12 @@ If you enable this feature the currently logged in user's email address, first n

== Changelog ==

= 1.9.0 =

* Add async sending option to dashboard
* Bump Raygun4PHP dependency to v1.8.2
* Bump Raygun4JS dependency to v2.8.5

= 1.8.3 =

* Fix XSS vulnerability in settings
Expand Down
15 changes: 15 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@
</td>
</tr>

<tr>
<th scope="row"><label for="rg4wp_async"><?php _e("Serverside sending method") ?></label></th>
<td>
<fieldset>
<legend class="screen-reader-text"><span>Serverside sending method</span></legend>

<label for="rg4wp_async">
<input type="checkbox" name="rg4wp_async" id="rg4wp_async"<?php echo get_option('rg4wp_async') ? ' checked="checked"': ''; ?> value="1" />
<?php _e("Send errors asynchronously"); ?>
</label>
<p class="description"><?php _e("Use asynchronous when sending server-side errors."); ?><em>(Only available on *Unix operating systems)</em></p>
</fieldset>
</td>
</tr>

</table>

<h3 class="title">Crash Reporting - Tags</h3>
Expand Down

0 comments on commit c7addf8

Please sign in to comment.