Code style and doc fix

This commit is contained in:
Piotr Filiciak 2016-05-23 15:17:00 +02:00
parent 9999e05660
commit 6577bbe887
3 changed files with 11 additions and 10 deletions

View File

@ -429,7 +429,8 @@ class View {
* @param int $from * @param int $from
* @param int $to * @param int $to
* @return bool|mixed * @return bool|mixed
* @throws \OCP\Files\InvalidPathException, \OCP\Files\UnseekableException * @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\UnseekableException
*/ */
public function readfilePart($path, $from, $to) { public function readfilePart($path, $from, $to) {
$this->assertPathLength($path); $this->assertPathLength($path);
@ -450,9 +451,8 @@ class View {
$size = ftell($handle) - $from; $size = ftell($handle) - $from;
return $size; return $size;
} }
else {
throw new \OCP\Files\UnseekableException('fseek error'); throw new \OCP\Files\UnseekableException('fseek error');
}
} }
return false; return false;
} }

View File

@ -51,16 +51,16 @@ class OC_Files {
const UPLOAD_MIN_LIMIT_BYTES = 1048576; // 1 MiB const UPLOAD_MIN_LIMIT_BYTES = 1048576; // 1 MiB
private static $MULTIPART_BOUNDARY = ''; private static $multipartBoundary = '';
/** /**
* @return string * @return string
*/ */
private static function getBoundary() { private static function getBoundary() {
if (empty(self::$MULTIPART_BOUNDARY)) { if (empty(self::$multipartBoundary)) {
self::$MULTIPART_BOUNDARY = md5(mt_rand()); self::$multipartBoundary = md5(mt_rand());
} }
return self::$MULTIPART_BOUNDARY; return self::$multipartBoundary;
} }
/** /**
@ -101,7 +101,7 @@ class OC_Files {
* @param string $files ; separated list of files to download * @param string $files ; separated list of files to download
* @param array $params ; 'head' boolean to only send header of the request ; 'range' http range header * @param array $params ; 'head' boolean to only send header of the request ; 'range' http range header
*/ */
public static function get($dir, $files, $params = array( 'head' => false )) { public static function get($dir, $files, $params = null) {
$view = \OC\Files\Filesystem::getView(); $view = \OC\Files\Filesystem::getView();
$getType = self::FILE; $getType = self::FILE;
@ -115,7 +115,7 @@ class OC_Files {
if (!is_array($files)) { if (!is_array($files)) {
$filename = $dir . '/' . $files; $filename = $dir . '/' . $files;
if (!$view->is_dir($filename)) { if (!$view->is_dir($filename)) {
self::getSingleFile($view, $dir, $files, $params); self::getSingleFile($view, $dir, $files, is_null($params) ? array() : $params);
return; return;
} }
} }

View File

@ -30,5 +30,6 @@ namespace OCP\Files;
/** /**
* Exception for seek problem * Exception for seek problem
* @since 9.1.0
*/ */
class UnseekableException extends \Exception {} class UnseekableException extends \Exception {}