We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
- If spawning fails and Passenger is running inside unit tests, then print 
exception backtraces.
- Fix the Rails stubs.
- Fix a regression introduced by the page caching fix.
- Reestablish ActiveRecord database connection if the database was 
connected to during environment.rb. Should fix issue #14.
Hongli Lai (Phusion) (author)
Tue Apr 15 02:06:52 -0700 2008
commit  c4ae459ed1f7f7617b04c360a03b4e7fa5bc3c5a
tree    161224a145f2bbb29797b91ef12dd3a9235765aa
parent  bf379a18cfa3356c184195b10c6183ce3654b6e2
...
182
183
184
 
 
 
185
186
187
...
232
233
234
235
 
236
237
238
...
279
280
281
 
 
 
 
 
 
 
282
283
284
...
182
183
184
185
186
187
188
189
190
...
235
236
237
 
238
239
240
241
...
282
283
284
285
286
287
288
289
290
291
292
293
294
0
@@ -182,6 +182,9 @@ protected
0
       lower_privilege! if @lower_privilege
0
       preload_application
0
     rescue StandardError, ScriptError, NoMemoryError => e
0
+ if ENV['TESTING_PASSENGER'] == '1'
0
+ print_exception(self.class.to_s, e)
0
+ end
0
       client.write('exception')
0
       client.write_scalar(marshal_exception(e))
0
       return
0
@@ -232,7 +235,7 @@ private
0
       Rails::Initializer.run(:set_load_path)
0
     end
0
     require 'config/environment'
0
- if ActionController::Base.page_cache_directory.empty?
0
+ if ActionController::Base.page_cache_directory.blank?
0
       ActionController::Base.page_cache_directory = "#{RAILS_ROOT}/public"
0
     end
0
     if defined?(ActionController::Dispatcher) \
0
@@ -279,6 +282,13 @@ private
0
     $0 = "Rails: #{@app_root}"
0
     reader, writer = IO.pipe
0
     begin
0
+ # Re-establish connection if a connection was established
0
+ # in environment.rb. This prevents us from concurrently
0
+ # accessing the same MySQL connection handle.
0
+ if defined?(::ActiveRecord::Base) && ::ActiveRecord::Base.connected?
0
+ ::ActiveRecord::Base.establish_connection
0
+ end
0
+
0
       handler = RequestHandler.new(reader)
0
       client.write(Process.pid, handler.socket_name,
0
         handler.using_abstract_namespace?)
...
14
15
16
 
17
18
19
...
14
15
16
17
18
19
20
0
@@ -14,6 +14,7 @@ int main() {
0
   tut::runner.get().set_callback(&reporter);
0
   signal(SIGPIPE, SIG_IGN);
0
   setenv("RAILS_ENV", "production", 1);
0
+ setenv("TESTING_PASSENGER", "1", 1);
0
   try {
0
     tut::runner.get().run_tests();
0
   } catch (const std::exception &ex) {
...
1
2
 
 
 
 
3
4
5
...
1
2
3
4
5
6
7
8
9
0
@@ -1,5 +1,9 @@
0
 module ActionController
0
   class Base
0
+ def self.page_cache_directory
0
+ nil
0
+ end
0
+
0
     def self.page_cache_directory=(dir)
0
     end
0
   end
...
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
0
@@ -0,0 +1,7 @@
0
+class ActiveRecord
0
+ class Base
0
+ def self.connected?
0
+ return false
0
+ end
0
+ end
0
+end

Comments

    No one has commented yet.