Instiki 0.16.3: Rails 2.3.0
Instiki now runs on the Rails 2.3.0 Candidate Release. Among other improvements, this means that it now automagically selects between WEBrick and Mongrel. Just run ./instiki --daemon
This commit is contained in:
parent
43aadecc99
commit
4e14ccc74d
893 changed files with 71965 additions and 28511 deletions
|
@ -1,3 +1,5 @@
|
|||
require 'delegate'
|
||||
|
||||
CGI.module_eval { remove_const "Cookie" }
|
||||
|
||||
# TODO: document how this differs from stdlib CGI::Cookie
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
require 'digest/md5'
|
||||
require 'cgi/session'
|
||||
require 'cgi/session/pstore'
|
||||
|
||||
class CGI #:nodoc:
|
||||
# * Expose the CGI instance to session stores.
|
||||
# * Don't require 'digest/md5' whenever a new session id is generated.
|
||||
class Session #:nodoc:
|
||||
def self.generate_unique_id(constant = nil)
|
||||
ActiveSupport::SecureRandom.hex(16)
|
||||
end
|
||||
|
||||
# Make the CGI instance available to session stores.
|
||||
attr_reader :cgi
|
||||
attr_reader :dbman
|
||||
alias_method :initialize_without_cgi_reader, :initialize
|
||||
def initialize(cgi, options = {})
|
||||
@cgi = cgi
|
||||
initialize_without_cgi_reader(cgi, options)
|
||||
end
|
||||
|
||||
private
|
||||
# Create a new session id.
|
||||
def create_new_id
|
||||
@new_session = true
|
||||
self.class.generate_unique_id
|
||||
end
|
||||
|
||||
# * Don't require 'digest/md5' whenever a new session is started.
|
||||
class PStore #:nodoc:
|
||||
def initialize(session, option={})
|
||||
dir = option['tmpdir'] || Dir::tmpdir
|
||||
prefix = option['prefix'] || ''
|
||||
id = session.session_id
|
||||
md5 = Digest::MD5.hexdigest(id)[0,16]
|
||||
path = dir+"/"+prefix+md5
|
||||
path.untaint
|
||||
if File::exist?(path)
|
||||
@hash = nil
|
||||
else
|
||||
unless session.new_session
|
||||
raise CGI::Session::NoSession, "uninitialized session"
|
||||
end
|
||||
@hash = {}
|
||||
end
|
||||
@p = ::PStore.new(path)
|
||||
@p.transaction do |p|
|
||||
File.chmod(0600, p.path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue