/[drupal]/contributions/modules/bitcache/API.txt
ViewVC logotype

Contents of /contributions/modules/bitcache/API.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Mon Feb 2 07:06:15 2009 UTC (9 months, 3 weeks ago) by arto
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-BETA2, DRUPAL-6--1-0-BETA1, HEAD
Changes since 1.3: +0 -0 lines
File MIME type: text/plain
Merged latest changes from http://github.com/bendiken/drupal-bitcache (37c8223).

Changelog:
- #365077: Prevent timeouts when manually importing a bitstream from a URL.
- Fixed the recommended installation path in README.txt.
- Added a note about the Bitcache command-line tools to INSTALL.txt.
- Implemented a new setting for configuring the path to the Bitcache command-line tools.
- Renamed the previous 'synchronization' setting to 'cron script'.
- Implemented the new API functions bitcache_sync(), bitcache_exec(), bitcache_yaml(), and bitcache_tmpname().
1 // $Id$
2
3 Please note that extended (and possibly more recent) developer and API
4 documentation is available in the Drupal Handbook at:
5
6 http://drupal.org/node/227210
7
8 HOOKS
9 -----
10 The Bitcache module exposes the following Drupal hook that third-party
11 extension modules can implement to provide extended functionality:
12
13 hook_bitcache()
14 ~~~~~~~~~~~~~~~
15
16 Allows modules to take action when bitstreams are created or deleted, to
17 determine fine-grained bitstream download access rights for individual
18 users, and to define additional HTTP headers for bitstream downloads.
19
20 This is essentially an extended analog of the hook_file_download() core
21 hook.
22
23 /**
24 * Implementation of hook_bitcache().
25 */
26 function mymodule_bitcache($op, $id, $stream = NULL) {
27 switch ($op) {
28 case 'insert':
29 // A new bitstream was uploaded
30 break;
31
32 case 'delete':
33 // An existing bitstream was deleted
34 break;
35
36 case 'access':
37 // Should the current user be allowed to access the given bitstream?
38 return node_access('view', node_load($_GET['nid']));
39
40 case 'download':
41 // Determine additional HTTP headers for the bitstream download
42 $node = node_load($_GET['nid']);
43 return array(
44 'Content-Disposition' => 'attachment; filename='. $node->title,
45 'Last-Modified' => gmdate('D, d M Y H:i:s', $node->changed) .' GMT',
46 );
47 }
48 }

  ViewVC Help
Powered by ViewVC 1.1.2