Commit 8e28bf01 authored by Joas Schilling's avatar Joas Schilling
Browse files

Move constants from GET_TYPE to OC\Files so they can be autoloaded

parent a2457b5f
......@@ -24,17 +24,14 @@
// TODO: get rid of this using proper composer packages
require_once 'mcnetic/phpzipstreamer/ZipStreamer.php';
class GET_TYPE {
const FILE = 1;
const ZIP_FILES = 2;
const ZIP_DIR = 3;
}
/**
* Class for file server access
*
*/
class OC_Files {
const FILE = 1;
const ZIP_FILES = 2;
const ZIP_DIR = 3;
/**
* @param string $filename
......@@ -76,7 +73,7 @@ class OC_Files {
}
if (is_array($files)) {
$get_type = GET_TYPE::ZIP_FILES;
$get_type = self::ZIP_FILES;
$basename = basename($dir);
if ($basename) {
$name = $basename . '.zip';
......@@ -88,7 +85,7 @@ class OC_Files {
} else {
$filename = $dir . '/' . $files;
if (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) {
$get_type = GET_TYPE::ZIP_DIR;
$get_type = self::ZIP_DIR;
// downloading root ?
if ($files === '') {
$name = 'download.zip';
......@@ -97,12 +94,12 @@ class OC_Files {
}
} else {
$get_type = GET_TYPE::FILE;
$get_type = self::FILE;
$name = $files;
}
}
if ($get_type === GET_TYPE::FILE) {
if ($get_type === self::FILE) {
$zip = false;
if ($xsendfile && OC_App::isEnabled('files_encryption')) {
$xsendfile = false;
......@@ -127,7 +124,7 @@ class OC_Files {
if ($zip) {
$executionTime = intval(ini_get('max_execution_time'));
set_time_limit(0);
if ($get_type === GET_TYPE::ZIP_FILES) {
if ($get_type === self::ZIP_FILES) {
foreach ($files as $file) {
$file = $dir . '/' . $file;
if (\OC\Files\Filesystem::is_file($file)) {
......@@ -138,7 +135,7 @@ class OC_Files {
self::zipAddDir($file, $zip);
}
}
} elseif ($get_type === GET_TYPE::ZIP_DIR) {
} elseif ($get_type === self::ZIP_DIR) {
$file = $dir . '/' . $files;
self::zipAddDir($file, $zip);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment