- Removed ActionController::Base.relative_url_root as current Redmine + Rails do not seem to require it?

- Added handling for "no caching" case, hopefully should fix #2.
This commit is contained in:
Alexander Tsvyashchenko 2010-10-12 22:16:17 +03:00
parent 19440f038f
commit 4b1e7cc051
2 changed files with 13 additions and 5 deletions

View File

@ -40,19 +40,27 @@ module WikiExternalFilterHelper
if expires > 0
cache_key = self.construct_cache_key(macro, name)
content = read_fragment cache_key, :expires_in => expires.seconds
begin
content = read_fragment cache_key, :expires_in => expires.seconds
rescue
RAILS_DEFAULT_LOGGER.error "Failed to load cache: #{cache_key}, error: $!"
end
end
if content
result[:source] = text
result[:content] = content
RAILS_DEFAULT_LOGGER.debug "from cache: #{name}"
RAILS_DEFAULT_LOGGER.debug "from cache: #{cache_key}"
else
result = self.build_forced(text, attachments, info)
if result[:status]
if expires > 0
write_fragment cache_key, result[:content], :expires_in => expires.seconds
RAILS_DEFAULT_LOGGER.debug "cache saved: #{name}"
begin
write_fragment cache_key, result[:content], :expires_in => expires.seconds
RAILS_DEFAULT_LOGGER.debug "cache saved: #{cache_key}"
rescue
RAILS_DEFAULT_LOGGER.error "Failed to save cache: #{cache_key}, error: $!"
end
end
else
raise "Error applying external filter: stdout is #{result[:content]}, stderr is #{result[:errors]}"

View File

@ -12,7 +12,7 @@
<script language="JavaScript" type="text/javascript">
//<![CDATA[
window.onload = function () {
flowplayer("a.flowplayer-video", "<%= ActionController::Base.relative_url_root + Engines::RailsExtensions::AssetHelpers.plugin_asset_path('wiki_external_filter', 'javascripts', 'flowplayer.swf') %>", { clip: { bufferLength: 1 } });
flowplayer("a.flowplayer-video", "<%= Engines::RailsExtensions::AssetHelpers.plugin_asset_path('wiki_external_filter', 'javascripts', 'flowplayer.swf') %>", { clip: { bufferLength: 1 } });
};
//]]>
</script>