Skip to content

Commit

Permalink
the constant IN_PHUSION_PASSENGER is deprecated in 3.9.0
Browse files Browse the repository at this point in the history
Per Phusion (Hongli Lai): "The IN_PHUSION_PASSENGER constant is a
private implementation detail and was never meant to be part of the
public API."

3.9.0 (4.0.0 Beta 1) has removed defining the constant
IN_PHUSION_PASSENGER.

This commit looks for the proper ::PhusionPassenger, which is also
compatible with older versions.

As a workaround before implementing this, I have been doing:
"IN_PHUSION_PASSENGER = true if defined?(::PhusionPassenger)"
  • Loading branch information
cwholt authored and gnarg committed Oct 23, 2012
1 parent ec3cff5 commit 37d78e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
@name = :passenger

depends_on do
defined?(PhusionPassenger)
defined?(::PhusionPassenger)
end

executes do
NewRelic::Agent.logger.debug "Installing Passenger event hooks."

PhusionPassenger.on_event(:stopping_worker_process) do
::PhusionPassenger.on_event(:stopping_worker_process) do
NewRelic::Agent.logger.debug "Passenger stopping this process, shutdown the agent."
NewRelic::Agent.instance.shutdown
end

PhusionPassenger.on_event(:starting_worker_process) do |forked|
::PhusionPassenger.on_event(:starting_worker_process) do |forked|
# We want to reset the stats from the stats engine in case any carried
# over into the spawned process. Don't clear them in case any were
# cached. We do this even in conservative spawning.
Expand All @@ -24,7 +24,7 @@

DependencyDetection.defer do
depends_on do
defined?(::Passenger) && defined?(::Passenger::AbstractServer) || defined?(::IN_PHUSION_PASSENGER)
defined?(::Passenger) && defined?(::Passenger::AbstractServer)
end

executes do
Expand Down
2 changes: 1 addition & 1 deletion lib/new_relic/local_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def check_for_litespeed
end

def check_for_passenger
if (defined?(::Passenger) && defined?(::Passenger::AbstractServer)) || defined?(::IN_PHUSION_PASSENGER)
if (defined?(::Passenger) && defined?(::Passenger::AbstractServer)) || defined?(::PhusionPassenger)
@dispatcher = :passenger
end
end
Expand Down

0 comments on commit 37d78e7

Please sign in to comment.