汇合点 wiki有一个很好的方法来存储附件,可以将数百个文件上传到一个页面。每个页面就像一个文件夹,其中的页面内容和附件在文件夹中。附件可以通过转到Tools >附件并选择要下载的文件来下载。为了使事情变得更简单,可以选择下载所有的。这会将所有文件压缩起来,并将其发送给将其视为具有随机名称的.zip的用户。
用户在工作时间内下载的带有大量附件的页面存在问题,导致服务器负载过重。需要一种方法,用于在办公时间期间禁用下载功能或禁用在办公时间期间创建的大型压缩文件。
发布于 2016-03-22 00:53:22
编辑confluence/confluence/pages/viewattachments.vm并更改显示下载所有链接的逻辑,以便它只在购物时间之外显示。
添加代码:
## Only display Download All link during business hours ##
#set ($tdate = $action.dateFormatter.getCurrentDateTime() ) ## Get todays date
#set ($thour = $tdate.replaceAll(".* ([0-9]+):..", "$1") ) ## Extract the current hour value from the datetime string
#if (!$thour.matches("8|9|10|11|12|13|14"))
#if ($action.latestVersionsOfAttachments.size() > 1)
<a id="download-all-link" href="$req.contextPath/pages/downloadallattachments.action?pageId=$pageId" title="$action.getText('download.all.desc')">$action.getText('download.all')</a>
#end
#else
Download all attachments option only available outside of business hours.
#end ## $thour.matched end这是要更改的代码块:
#if ($latestVersionsOfAttachments.size() > 0)
#set ($contextPath = "$req.contextPath/pages/viewpageattachments.action?pageId=$pageId&sortBy=$sortBy&")
#set ($sortPathPrefixHtml = "?pageId=$page.id&sortBy=")
#set ($showActions = "true")
#set ($old = "true")
#set ($attachmentHelper = $action)
#parse("/pages/includes/attachments-table.vm")
#if ($action.latestVersionsOfAttachments.size() > 1)
<a id="download-all-link" href="$req.contextPath/pages/downloadallattachments.action?pageId=$pageId" title="$action.getText('download.all.desc')">$action.getText('download.all')</a>
#end
#pagination($action.paginationSupport $contextPath)
#else
$action.getText('currently.no.attachments')
#end以下是更改,以便只在办公时间以外显示下载所有链接:
#if ($latestVersionsOfAttachments.size() > 0)
#set ($contextPath = "$req.contextPath/pages/viewpageattachments.action?pageId=$pageId&sortBy=$sortBy&")
#set ($sortPathPrefixHtml = "?pageId=$page.id&sortBy=")
#set ($showActions = "true")
#set ($old = "true")
#set ($attachmentHelper = $action)
#parse("/pages/includes/attachments-table.vm")
## Only display Download All link during business hours ##
#set ($tdate = $action.dateFormatter.getCurrentDateTime() ) ## Get todays date
#set ($thour = $tdate.replaceAll(".* ([0-9]+):..", "$1") ) ## Extract the current hour value from the datetime string
#if (!$thour.matches("8|9|10|11|12|13|14"))
#if ($action.latestVersionsOfAttachments.size() > 1)
<a id="download-all-link" href="$req.contextPath/pages/downloadallattachments.action?pageId=$pageId" title="$action.getText('download.all.desc')">$action.getText('download.all')</a>
#end
#else
Download all attachments option only available outside of business hours.
#end ## $thour.matched endhttps://stackoverflow.com/questions/36144336
复制相似问题