When using the module, I get a message in rollbar that I'm using an old version of rollbar.js. The attached patch uses the latest version and the message is removed in the rollbar dashboard.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jesse.d created an issue. See original summary.

vijaycs85’s picture

Status: Needs review » Closed (won't fix)

Sorry, 7.x is minimally maintained and maintenance fixes only.

intrafusion’s picture

Category: Feature request » Bug report
Status: Closed (won't fix) » Needs review

This patch is the definition of a maintenance fix:

This project is considered feature complete by its present owner.

The project has reached the target the owner/maintainer aimed for, and as a general rule, no new features will be added (though it's always possible to make a compelling case). Bug reports filed in the project's issue queue are looked at and eventually fixed. If a patch is provided to fix an issue, it may lead to a more timely issue resolution.

If you're genuinely not going to apply this patch then the module should be marked No further development

eddie_c’s picture

@vijaycs85 has kindly let me help maintain the 7.x branch of this module. When this has been RTBCd I'd be happy to apply it.

intrafusion’s picture

@eddie_c, I doubt whether this can be marked RTBC as there are only 30 sites report using this module primarily as this has never had a stable release for 7.x

I can report that I applied this patch successfully myself, plus with a bit of manipulation managed to get the module to work with the latest Rollbar release (1.4.1) which requires installation via composer

eddie_c’s picture

@intrafusion Great to hear that it works for you. Please could you expand on the manipulation you had to do to get it to work with Rollbar 1.4.1?

intrafusion’s picture

@eddie_c it was fairly straightforward:

  1. You need to install Rollbar for PHP using composer, I did this by following steps 1-3 at Manual installation if you are not using composer.json for your project, at step 2 I was in sites/all/libraries before running git clone
  2. At the top of rollbar.module, there is a helper function _rollbar_get_library_path(), I set the default value to sites/all/libraries/rollbar-php/vendor/autoload.php
  3. There are 2 instances where the class Rollbar is called, one inside rollbar_boot() and one inside rollbar_watchdog(), these calls need to be changed from Rollbar:: to \Rollbar\Rollbar::

These were the only steps I needed to take to get it working, however I discovered that if you try to upgrade a site which already has Rollbar installed there are serious errors, but if you install fresh it works without issue. I suspect that this due to the variable in _rollbar_get_library_path() returning the wrong path, etc.

jesse.d’s picture

Wouldn't this patch be out of date at this point? I created it years ago and haven't really kept up with rollbar since as I haven't been on that project in a while. It seems like their quickstart snippet has evolved since then: see the quickstart js docs.

It may be worthwhile for someone that is currently using the service to reroll and do some initial testing with the updated quickstart snippet.

eddie_c’s picture

jesse.d This is a good point. Also, if we're going to upgrade the Rollbar PHP library as @intrafusion suggests then perhaps we should be using this method for integrating with Rollbar.js: https://github.com/rollbar/rollbar-php#integration-with-rollbarjs

My concern is that we'd be introducing a dependency on composer and I don't know if that's acceptable in a Drupal 7 module. Do you know?

jesse.d’s picture

@eddie_c the Composer Manager module was created for just that purpose actually.

Composer Manager allows contributed modules to depend on PHP libraries managed via Composer.

eddie_c’s picture

Thanks @jesse.d. Following up on your advice I've created a patch that introduces a dependency on Composer Manager in order to use the latest version of the PHP Rollbar library (which also includes a more up to date Rollbar.js).

As @intrafusion pointed out, this breaks backwards compatibility with Rollbar 7.x-1.x, so I suggest if we go with this solution we commit it to a new 7.x-2.x branch.

I've not tested this thoroughly yet, but initial testing shows I'm at least getting some messages showing successfully in rollbar.

retrodans’s picture

An update of the previous patch to add in an extra class_exists() check to stop it failing

retrodans’s picture

Another update, adding a missing composer.json file and a few other fixes

eddie_c’s picture

@retrodans, Should the rollbar library version be pinned to v1.x or v1.7.x in order to avoid composer upgrading to a version that may not be compatible with the module in future?

Other than that, I've tested this and it appears to work well.

intrafusion’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Fixed

Patch applied to new 7.x-2.x branch

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.