[[PageOutline(2-5, Contents, pullout)]] = Adds a downloads section to Trac == Description This plugin provides a downloads section which may contain releases or other files. It is administrated via the Web admin interface and there is an interface to the {{{trac-admin}}} tool that may help during automatic server maintenance. The Downloads section of Trac displays a table with information about the uploaded files such as description, component, version, size, architecture, type and optionally assigned tags which the download is related to. It also collects information about the number of downloads which can be displayed on a wiki page together with direct links to the specified download. See also: TracDownloaderPlugin == Bugs/Feature Requests Existing bugs and feature requests for !DownloadsPlugin are [report:9?COMPONENT=DownloadsPlugin here]. If you have any issues, create a [/newticket?component=DownloadsPlugin new ticket]. [[TicketQuery(component=DownloadsPlugin,group=type,format=progress)]] == Download Download the zipped source from [export:downloadsplugin here]. == Source You can check out DownloadsPlugin from [/svn/downloadsplugin here] using Subversion, or [source:downloadsplugin browse the source] with Trac. == Installation General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page. == Configuration After installing the plugin you can set up configuration variables in `trac.ini`. Their default values are: {{{#!ini [downloads] additional_tags = author,component,version,architecture,platform,\ type # If TagsPlugin is installed architecture_sort = name architecture_sort_direction = asc consoleadmin_user = anonymous download_sort = time download_sort_direction = desc ext = zip,gz,bz2,rar max_size = 268697600 path = ../downloads platform_sort = name platform_sort_direction = asc type_sort = name type_sort_direction = asc unique_filename = False visible_fields = id,file,description,size,time,count,author,tags,\ component,version,architecture,platform,type }}} Option values: * The `path` is the location where the uploaded downloads are stored. It has to be accessible for writing to web server. * Setting `ext` variable restricts allowed extensions of uploaded files. * If `unique_filename` is enabled, then the plugin checks if the file name of the download file is not already occupied by any other download file. * `visible_fields` variable controls appearance of downloads table columns in Downloads section. * `consoleadmin_user` option serves for permission checks when listing, adding or removing downloads using `trac-admin`. * `additional_tags` configures from which fields the download tags should be also generated. Enable the plugin using the following in trac.ini: {{{#!ini [components] tracdownloads.* = enabled }}} In 0.12 branch, the {{{DownloadsCore}}} component was split into the {{{DownloadsDownloads}}} component, which handles Downloads section of Trac, and the {{{DownloadsCore}}} component that serves file download requests and other core features. This means that you can disable the {{{DownloadsDownloads}}} component to hide Downloads section from users. {{{admin}}} module was renamed to {{{consoleadmin}}}. The next step is to upgrade your Trac environment: {{{#!sh trac-admin upgrade }}} '''Note:''' Some environments might not handle download of large files gracefully. Notably the fcgi wrapper may timeout. A possible work around, that also adds HTTP "Range:" header support, is telling Trac to use "X-Sendfile". This may require configuration of your HTTP server as well: {{{#!ini [trac] use_xsendfile = True }}} === Permissions This plugin defines the following permissions: 1. {{{DOWNLOADS_VIEW}}} for normal users. 1. {{{DOWNLOADS_ADD}}} and {{{DOWNLOADS_ADMIN}}} for people who upload and administer downloads. 1. {{{DOWNLOADS_ADD}}} permission allows a user to upload downloads without access to the WebAdmin interface. You can grant these permissions using these commands: {{{#!sh trac-admin permission add DOWNLOADS_VIEW trac-admin permission add DOWNLOADS_ADD # Branch 0.12 only. trac-admin permission add DOWNLOADS_ADMIN }}} === Macros There are a few wiki macros available: {{{ [download: ] or [download: ] }}} Displays link to download identified by ID {{{}}} or filename {{{}}} with text {{{}}}. {{{ [[DownloadsCount(1)]] [[DownloadsCount(1, 2, 3)]] [[DownloadsCount(foo.zip)]] [[DownloadsCount(1, foo.zip, bar.rar, 3)]] [[DownloadsCount()]] [[DownloadsCount(0)]] }}} Displays sum of number of downloads for downloads identified by comma separated list of IDs or filenames. If there is an empty list or any zero (such as in the last two examples), then the sum of all number of downloads is returned. Non-existing downloads silently count as zero. Works with branch 0.12 only. {{{ [[ListDownloads()]] }}} Displays same table that is displayed in Downloads section of the Trac on a wiki page. Works with branch 0.12 only. === Interface to `trac-admin` There is the ability to list, insert or delete downloads from server's console/script with following commands: {{{#!sh trac-admin download list trac-admin download add description= \ author= tags=" ..." component= version= \ architecture= platform= type= trac-admin download remove trac-admin download remove }}} All download attributes of {{{download add}}} command are optional, only the file must be specified. {{{console_admin}}} {{{trac.ini}}} option must be set to any user who has permission to perform the appropriate action. == Recent Changes [[ChangeLog(downloadsplugin, 3)]] == Author/Contributors '''Author:''' [wiki:Blackhex] [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:'''