diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-09-23 07:47:40 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-09-23 18:07:47 +0200 |
commit | 635b0717931df907ee8015a42ad0ed1fcdf967c4 (patch) | |
tree | d301376b6dfc5326a7c2190c99194475ff7bc016 /application/libraries/Ddownload/Ddownload.php | |
parent | 551c359d8e50608093ba0f7179bd311d89e90da2 (diff) |
Implement rangeDownload() as driver and provide sendfile implementations for Nginx and Lighttpd
* The rangeDownload() function has been moved to libraries/Ddownload/drivers/Ddownload_php.php
* The nginx and lighttpd drivers can be set via $config['download_driver']
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Diffstat (limited to 'application/libraries/Ddownload/Ddownload.php')
-rw-r--r-- | application/libraries/Ddownload/Ddownload.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/application/libraries/Ddownload/Ddownload.php b/application/libraries/Ddownload/Ddownload.php new file mode 100644 index 000000000..808dfe776 --- /dev/null +++ b/application/libraries/Ddownload/Ddownload.php @@ -0,0 +1,34 @@ +<?php +/* + * Copyright 2013 Pierre Schmitz <pierre@archlinux.de> + * + * Licensed under AGPLv3 + * (see COPYING for full license text) + * + */ + +abstract class Ddownload_Driver extends CI_Driver { + + abstract public function serveFile($file, $filename, $type); +} + +class Ddownload extends CI_Driver_Library { + + protected $_adapter = null; + + protected $valid_drivers = array( + 'ddownload_php', 'ddownload_nginx', 'ddownload_lighttpd' + ); + + function __construct() + { + $CI =& get_instance(); + + $this->_adapter = $CI->config->item('download_driver'); + } + + public function serveFile($file, $filename, $type) + { + $this->{$this->_adapter}->serveFile($file, $filename, $type); + } +} |