diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2015-09-24 01:08:42 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-28 11:46:54 +0200 |
commit | 28df7be3192560b1b3616b98a5a1f057410ebab0 (patch) | |
tree | b30f039467421e952fa96228689786e0b72a3f7c /lib | |
parent | 74d879d039146259f77b67126dcee9f8aa8f8f75 (diff) | |
download | nextcloud-server-28df7be3192560b1b3616b98a5a1f057410ebab0.tar.gz nextcloud-server-28df7be3192560b1b3616b98a5a1f057410ebab0.zip |
Add namespace. Fix broken zip
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files.php | 3 | ||||
-rw-r--r-- | lib/private/streamer.php | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/private/files.php b/lib/private/files.php index 638d148adc4..21b3cd1d409 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -41,6 +41,7 @@ */ use OC\Lock\NoopLockingProvider; +use OC\Streamer; use OCP\Lock\ILockingProvider; /** @@ -113,7 +114,7 @@ class OC_Files { if ($getType === self::FILE) { $streamer = false; } else { - $streamer = new OC_Streamer(); + $streamer = new Streamer(); } OC_Util::obEnd(); diff --git a/lib/private/streamer.php b/lib/private/streamer.php index aec5fb922ee..b530961afd2 100644 --- a/lib/private/streamer.php +++ b/lib/private/streamer.php @@ -19,10 +19,12 @@ * */ -use \ZipStreamer\ZipStreamer; +namespace OC; + +use ZipStreamer\ZipStreamer; use DeepDiver1975\TarStreamer\TarStreamer; -class OC_Streamer { +class Streamer { // array of regexp. Matching user agents will get tar instead of zip private $preferTarFor = [ '/macintosh|mac os x/i' ]; @@ -36,7 +38,7 @@ class OC_Streamer { /** @var \OCP\IRequest */ $request = \OC::$server->getRequest(); - if ($request->isUserAgent($this->preferTar)) { + if ($request->isUserAgent($this->preferTarFor)) { $this->streamerInstance = new TarStreamer(); } else { $this->streamerInstance = new ZipStreamer(); @@ -75,7 +77,7 @@ class OC_Streamer { if(\OC\Files\Filesystem::is_file($file)) { $filesize = \OC\Files\Filesystem::filesize($file); $fh = \OC\Files\Filesystem::fopen($file, 'r'); - $this->streamerInstance->addFileFromStream($fh, $internalDir . $filename, $filesize); + $this->addFileFromStream($fh, $internalDir . $filename, $filesize); fclose($fh); }elseif(\OC\Files\Filesystem::is_dir($file)) { $this->addDirRecoursive($file, $internalDir); |