Hide 如何在工作时间内禁用Confluence附件的下载

Hide 如何在工作时间内禁用Confluence附件的下载,hide,attachment,confluence,Hide,Attachment,Confluence,wiki有一种很好的存储附件的方法,可以将数百个文件上传到一个页面。每个页面就像一个文件夹,其中页面内容和附件位于文件夹中。可以通过转到工具>附件并选择要下载的文件来下载附件。为了简化操作,可以选择下载所有内容。这将压缩所有文件并将其发送给将其视为带有随机名称的.zip文件的用户 用户在工作时间下载的带有大量附件的页面存在问题,导致服务器负载过重。需要一种在工作时间禁用下载功能或禁止在工作时间创建大型zip文件的方法 编辑confluence/confluence/pages/viewattac

wiki有一种很好的存储附件的方法,可以将数百个文件上传到一个页面。每个页面就像一个文件夹,其中页面内容和附件位于文件夹中。可以通过转到工具>附件并选择要下载的文件来下载附件。为了简化操作,可以选择下载所有内容。这将压缩所有文件并将其发送给将其视为带有随机名称的.zip文件的用户


用户在工作时间下载的带有大量附件的页面存在问题,导致服务器负载过重。需要一种在工作时间禁用下载功能或禁止在工作时间创建大型zip文件的方法

编辑
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
##仅在工作时间显示下载所有链接##
#设置($tdate=$action.dateFormatter.getCurrentDateTime())##获取今天的日期
#set($thour=$tdate.replaceAll(“*([0-9]+):…”,“$1”)##从日期时间字符串中提取当前小时值
#如果(!$thour.匹配(“8 | 9 | 10 | 11 | 12 | 13 | 14”))
#if($action.latestVersionsOfAttachments.size()>1)
#结束
#否则
下载所有附件选项仅在营业时间以外可用。
#结束##$thour.匹配结束
这是要更改的代码块:

    #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=“)
#设置($showActions=“true”)
#设置($old=“true”)
#设置($attachmentHelper=$action)
#解析(“/pages/includes/attachments table.vm”)
#if($action.latestVersionsOfAttachments.size()>1)
#结束
#分页($action.paginationSupport$contextPath)
#否则
$action.getText('current.no.attachments')
#结束
以下是更改,以便“全部下载”链接仅在营业时间以外显示:

    #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 end
#if($latestVersionsOfAttachments.size()>0)
#set($contextPath=“$req.contextPath/pages/viewpageattachments.action?pageId=$pageId&sortBy=$sortBy&”)
#set($sortPathPrefixHtml=“?pageId=$page.id&sortBy=“)
#设置($showActions=“true”)
#设置($old=“true”)
#设置($attachmentHelper=$action)
#解析(“/pages/includes/attachments table.vm”)
##仅在工作时间显示下载所有链接##
#设置($tdate=$action.dateFormatter.getCurrentDateTime())##获取今天的日期
#set($thour=$tdate.replaceAll(“*([0-9]+):…”,“$1”)##从日期时间字符串中提取当前小时值
#如果(!$thour.匹配(“8 | 9 | 10 | 11 | 12 | 13 | 14”))
#if($action.latestVersionsOfAttachments.size()>1)
#结束
#否则
下载所有附件选项仅在营业时间以外可用。
#结束##$thour.匹配结束