Skip to content

Commit

Permalink
Adjusted base class SingSquashfsDataProvider
Browse files Browse the repository at this point in the history
Needed for the Multilevel subclass of previous commit.
  • Loading branch information
prioux committed Feb 20, 2025
1 parent a1e2740 commit 50bab2c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions BrainPortal/app/models/sing_squashfs_data_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ def impl_sync_to_cache(userfile) #:nodoc:
# since this DP type is for static, read-only data.
def impl_provider_list_all(user=nil,browse_path=nil) #:nodoc:
cache_key = "#{self.class}-#{self.id}-file_infos"
cache_key += "-#{browse_path.to_s}" if browse_path.present?

file_infos = Rails.cache.fetch(cache_key, :expires_in => BROWSE_CACHE_EXPIRATION) do
text = remote_in_sing_stat_all(self.containerized_path,".",true)
sourcedir = Pathname.new(self.containerized_path)
sourcedir += browse_path if browse_path.present?
text = remote_in_sing_stat_all(sourcedir.to_s, "." ,true)
stat_reports_to_fileinfos(text)
end

Expand All @@ -172,13 +175,13 @@ def impl_provider_collection_index(userfile, directory = :all, allowed_types = :
# The behavior of the *collection_index methods is weird.
basedir = Pathname.new(self.containerized_path)
if directory == :all
subdir = userfile.name
subdir = userfile.browse_name
one_level = false
elsif directory == :top
subdir = userfile.name
subdir = userfile.browse_name
one_level = true
else
subdir = Pathname.new(userfile.name) + directory
subdir = Pathname.new(userfile.browse_name) + directory
one_level = true
end

Expand Down

0 comments on commit 50bab2c

Please sign in to comment.