Passed
Push — master ( 0571fd...48a8f0 )
by Blizzz
19:19 queued 08:57
created
apps/admin_audit/composer/composer/autoload_static.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitAdminAudit
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\AdminAudit\\' => 15,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\AdminAudit\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\AdminAudit\\Actions\\Action' => __DIR__ . '/..' . '/../lib/Actions/Action.php',
25
-        'OCA\\AdminAudit\\Actions\\AppManagement' => __DIR__ . '/..' . '/../lib/Actions/AppManagement.php',
26
-        'OCA\\AdminAudit\\Actions\\Auth' => __DIR__ . '/..' . '/../lib/Actions/Auth.php',
27
-        'OCA\\AdminAudit\\Actions\\Console' => __DIR__ . '/..' . '/../lib/Actions/Console.php',
28
-        'OCA\\AdminAudit\\Actions\\Files' => __DIR__ . '/..' . '/../lib/Actions/Files.php',
29
-        'OCA\\AdminAudit\\Actions\\GroupManagement' => __DIR__ . '/..' . '/../lib/Actions/GroupManagement.php',
30
-        'OCA\\AdminAudit\\Actions\\Security' => __DIR__ . '/..' . '/../lib/Actions/Security.php',
31
-        'OCA\\AdminAudit\\Actions\\Sharing' => __DIR__ . '/..' . '/../lib/Actions/Sharing.php',
32
-        'OCA\\AdminAudit\\Actions\\Trashbin' => __DIR__ . '/..' . '/../lib/Actions/Trashbin.php',
33
-        'OCA\\AdminAudit\\Actions\\UserManagement' => __DIR__ . '/..' . '/../lib/Actions/UserManagement.php',
34
-        'OCA\\AdminAudit\\Actions\\Versions' => __DIR__ . '/..' . '/../lib/Actions/Versions.php',
35
-        'OCA\\AdminAudit\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
36
-        'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => __DIR__ . '/..' . '/../lib/BackgroundJobs/Rotate.php',
23
+    public static $classMap = array(
24
+        'OCA\\AdminAudit\\Actions\\Action' => __DIR__.'/..'.'/../lib/Actions/Action.php',
25
+        'OCA\\AdminAudit\\Actions\\AppManagement' => __DIR__.'/..'.'/../lib/Actions/AppManagement.php',
26
+        'OCA\\AdminAudit\\Actions\\Auth' => __DIR__.'/..'.'/../lib/Actions/Auth.php',
27
+        'OCA\\AdminAudit\\Actions\\Console' => __DIR__.'/..'.'/../lib/Actions/Console.php',
28
+        'OCA\\AdminAudit\\Actions\\Files' => __DIR__.'/..'.'/../lib/Actions/Files.php',
29
+        'OCA\\AdminAudit\\Actions\\GroupManagement' => __DIR__.'/..'.'/../lib/Actions/GroupManagement.php',
30
+        'OCA\\AdminAudit\\Actions\\Security' => __DIR__.'/..'.'/../lib/Actions/Security.php',
31
+        'OCA\\AdminAudit\\Actions\\Sharing' => __DIR__.'/..'.'/../lib/Actions/Sharing.php',
32
+        'OCA\\AdminAudit\\Actions\\Trashbin' => __DIR__.'/..'.'/../lib/Actions/Trashbin.php',
33
+        'OCA\\AdminAudit\\Actions\\UserManagement' => __DIR__.'/..'.'/../lib/Actions/UserManagement.php',
34
+        'OCA\\AdminAudit\\Actions\\Versions' => __DIR__.'/..'.'/../lib/Actions/Versions.php',
35
+        'OCA\\AdminAudit\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
36
+        'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => __DIR__.'/..'.'/../lib/BackgroundJobs/Rotate.php',
37 37
     );
38 38
 
39 39
     public static function getInitializer(ClassLoader $loader)
40 40
     {
41
-        return \Closure::bind(function () use ($loader) {
41
+        return \Closure::bind(function() use ($loader) {
42 42
             $loader->prefixLengthsPsr4 = ComposerStaticInitAdminAudit::$prefixLengthsPsr4;
43 43
             $loader->prefixDirsPsr4 = ComposerStaticInitAdminAudit::$prefixDirsPsr4;
44 44
             $loader->classMap = ComposerStaticInitAdminAudit::$classMap;
Please login to merge, or discard this patch.
apps/admin_audit/composer/composer/autoload_classmap.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\AdminAudit\\Actions\\Action' => $baseDir . '/../lib/Actions/Action.php',
10
-    'OCA\\AdminAudit\\Actions\\AppManagement' => $baseDir . '/../lib/Actions/AppManagement.php',
11
-    'OCA\\AdminAudit\\Actions\\Auth' => $baseDir . '/../lib/Actions/Auth.php',
12
-    'OCA\\AdminAudit\\Actions\\Console' => $baseDir . '/../lib/Actions/Console.php',
13
-    'OCA\\AdminAudit\\Actions\\Files' => $baseDir . '/../lib/Actions/Files.php',
14
-    'OCA\\AdminAudit\\Actions\\GroupManagement' => $baseDir . '/../lib/Actions/GroupManagement.php',
15
-    'OCA\\AdminAudit\\Actions\\Security' => $baseDir . '/../lib/Actions/Security.php',
16
-    'OCA\\AdminAudit\\Actions\\Sharing' => $baseDir . '/../lib/Actions/Sharing.php',
17
-    'OCA\\AdminAudit\\Actions\\Trashbin' => $baseDir . '/../lib/Actions/Trashbin.php',
18
-    'OCA\\AdminAudit\\Actions\\UserManagement' => $baseDir . '/../lib/Actions/UserManagement.php',
19
-    'OCA\\AdminAudit\\Actions\\Versions' => $baseDir . '/../lib/Actions/Versions.php',
20
-    'OCA\\AdminAudit\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
21
-    'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => $baseDir . '/../lib/BackgroundJobs/Rotate.php',
9
+    'OCA\\AdminAudit\\Actions\\Action' => $baseDir.'/../lib/Actions/Action.php',
10
+    'OCA\\AdminAudit\\Actions\\AppManagement' => $baseDir.'/../lib/Actions/AppManagement.php',
11
+    'OCA\\AdminAudit\\Actions\\Auth' => $baseDir.'/../lib/Actions/Auth.php',
12
+    'OCA\\AdminAudit\\Actions\\Console' => $baseDir.'/../lib/Actions/Console.php',
13
+    'OCA\\AdminAudit\\Actions\\Files' => $baseDir.'/../lib/Actions/Files.php',
14
+    'OCA\\AdminAudit\\Actions\\GroupManagement' => $baseDir.'/../lib/Actions/GroupManagement.php',
15
+    'OCA\\AdminAudit\\Actions\\Security' => $baseDir.'/../lib/Actions/Security.php',
16
+    'OCA\\AdminAudit\\Actions\\Sharing' => $baseDir.'/../lib/Actions/Sharing.php',
17
+    'OCA\\AdminAudit\\Actions\\Trashbin' => $baseDir.'/../lib/Actions/Trashbin.php',
18
+    'OCA\\AdminAudit\\Actions\\UserManagement' => $baseDir.'/../lib/Actions/UserManagement.php',
19
+    'OCA\\AdminAudit\\Actions\\Versions' => $baseDir.'/../lib/Actions/Versions.php',
20
+    'OCA\\AdminAudit\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
21
+    'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => $baseDir.'/../lib/BackgroundJobs/Rotate.php',
22 22
 );
Please login to merge, or discard this patch.
apps/dav/lib/Controller/DirectController.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -39,75 +39,75 @@
 block discarded – undo
39 39
 
40 40
 class DirectController extends OCSController {
41 41
 
42
-	/** @var IRootFolder */
43
-	private $rootFolder;
42
+    /** @var IRootFolder */
43
+    private $rootFolder;
44 44
 
45
-	/** @var string */
46
-	private $userId;
45
+    /** @var string */
46
+    private $userId;
47 47
 
48
-	/** @var DirectMapper */
49
-	private $mapper;
48
+    /** @var DirectMapper */
49
+    private $mapper;
50 50
 
51
-	/** @var ISecureRandom */
52
-	private $random;
51
+    /** @var ISecureRandom */
52
+    private $random;
53 53
 
54
-	/** @var ITimeFactory */
55
-	private $timeFactory;
54
+    /** @var ITimeFactory */
55
+    private $timeFactory;
56 56
 
57
-	/** @var IURLGenerator */
58
-	private $urlGenerator;
57
+    /** @var IURLGenerator */
58
+    private $urlGenerator;
59 59
 
60 60
 
61
-	public function __construct(string $appName,
62
-								IRequest $request,
63
-								IRootFolder $rootFolder,
64
-								string $userId,
65
-								DirectMapper $mapper,
66
-								ISecureRandom $random,
67
-								ITimeFactory $timeFactory,
68
-								IURLGenerator $urlGenerator) {
69
-		parent::__construct($appName, $request);
61
+    public function __construct(string $appName,
62
+                                IRequest $request,
63
+                                IRootFolder $rootFolder,
64
+                                string $userId,
65
+                                DirectMapper $mapper,
66
+                                ISecureRandom $random,
67
+                                ITimeFactory $timeFactory,
68
+                                IURLGenerator $urlGenerator) {
69
+        parent::__construct($appName, $request);
70 70
 
71
-		$this->rootFolder = $rootFolder;
72
-		$this->userId = $userId;
73
-		$this->mapper = $mapper;
74
-		$this->random = $random;
75
-		$this->timeFactory = $timeFactory;
76
-		$this->urlGenerator = $urlGenerator;
77
-	}
71
+        $this->rootFolder = $rootFolder;
72
+        $this->userId = $userId;
73
+        $this->mapper = $mapper;
74
+        $this->random = $random;
75
+        $this->timeFactory = $timeFactory;
76
+        $this->urlGenerator = $urlGenerator;
77
+    }
78 78
 
79
-	/**
80
-	 * @NoAdminRequired
81
-	 */
82
-	public function getUrl(int $fileId): DataResponse {
83
-		$userFolder = $this->rootFolder->getUserFolder($this->userId);
79
+    /**
80
+     * @NoAdminRequired
81
+     */
82
+    public function getUrl(int $fileId): DataResponse {
83
+        $userFolder = $this->rootFolder->getUserFolder($this->userId);
84 84
 
85
-		$files = $userFolder->getById($fileId);
85
+        $files = $userFolder->getById($fileId);
86 86
 
87
-		if ($files === []) {
88
-			throw new OCSNotFoundException();
89
-		}
87
+        if ($files === []) {
88
+            throw new OCSNotFoundException();
89
+        }
90 90
 
91
-		$file = array_shift($files);
92
-		if (!($file instanceof File)) {
93
-			throw new OCSBadRequestException('Direct download only works for files');
94
-		}
91
+        $file = array_shift($files);
92
+        if (!($file instanceof File)) {
93
+            throw new OCSBadRequestException('Direct download only works for files');
94
+        }
95 95
 
96
-		//TODO: at some point we should use the directdownlaod function of storages
97
-		$direct = new Direct();
98
-		$direct->setUserId($this->userId);
99
-		$direct->setFileId($fileId);
96
+        //TODO: at some point we should use the directdownlaod function of storages
97
+        $direct = new Direct();
98
+        $direct->setUserId($this->userId);
99
+        $direct->setFileId($fileId);
100 100
 
101
-		$token = $this->random->generate(60, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);
102
-		$direct->setToken($token);
103
-		$direct->setExpiration($this->timeFactory->getTime() + 60 * 60 * 8);
101
+        $token = $this->random->generate(60, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);
102
+        $direct->setToken($token);
103
+        $direct->setExpiration($this->timeFactory->getTime() + 60 * 60 * 8);
104 104
 
105
-		$this->mapper->insert($direct);
105
+        $this->mapper->insert($direct);
106 106
 
107
-		$url = $this->urlGenerator->getAbsoluteURL('remote.php/direct/'.$token);
107
+        $url = $this->urlGenerator->getAbsoluteURL('remote.php/direct/'.$token);
108 108
 
109
-		return new DataResponse([
110
-			'url' => $url,
111
-		]);
112
-	}
109
+        return new DataResponse([
110
+            'url' => $url,
111
+        ]);
112
+    }
113 113
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 		$direct->setUserId($this->userId);
99 99
 		$direct->setFileId($fileId);
100 100
 
101
-		$token = $this->random->generate(60, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);
101
+		$token = $this->random->generate(60, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS);
102 102
 		$direct->setToken($token);
103 103
 		$direct->setExpiration($this->timeFactory->getTime() + 60 * 60 * 8);
104 104
 
Please login to merge, or discard this patch.
apps/dav/lib/Direct/DirectHome.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -37,82 +37,82 @@
 block discarded – undo
37 37
 
38 38
 class DirectHome implements ICollection {
39 39
 
40
-	/** @var IRootFolder */
41
-	private $rootFolder;
42
-
43
-	/** @var DirectMapper */
44
-	private $mapper;
45
-
46
-	/** @var ITimeFactory */
47
-	private $timeFactory;
48
-
49
-	/** @var Throttler */
50
-	private $throttler;
51
-
52
-	/** @var IRequest */
53
-	private $request;
54
-
55
-	public function __construct(IRootFolder $rootFolder,
56
-								DirectMapper $mapper,
57
-								ITimeFactory $timeFactory,
58
-								Throttler $throttler,
59
-								IRequest $request) {
60
-		$this->rootFolder = $rootFolder;
61
-		$this->mapper = $mapper;
62
-		$this->timeFactory = $timeFactory;
63
-		$this->throttler = $throttler;
64
-		$this->request = $request;
65
-	}
66
-
67
-	public function createFile($name, $data = null) {
68
-		throw new Forbidden();
69
-	}
70
-
71
-	public function createDirectory($name) {
72
-		throw new Forbidden();
73
-	}
74
-
75
-	public function getChild($name): DirectFile {
76
-		try {
77
-			$direct = $this->mapper->getByToken($name);
78
-
79
-			// Expired
80
-			if ($direct->getExpiration() < $this->timeFactory->getTime()) {
81
-				throw new NotFound();
82
-			}
83
-
84
-			return new DirectFile($direct, $this->rootFolder);
85
-		} catch (DoesNotExistException $e) {
86
-			// Since the token space is so huge only throttle on non exsisting token
87
-			$this->throttler->registerAttempt('directlink', $this->request->getRemoteAddress());
88
-			$this->throttler->sleepDelay($this->request->getRemoteAddress(), 'directlink');
89
-
90
-			throw new NotFound();
91
-		}
92
-	}
93
-
94
-	public function getChildren() {
95
-		throw new MethodNotAllowed('Listing members of this collection is disabled');
96
-	}
97
-
98
-	public function childExists($name): bool {
99
-		return false;
100
-	}
101
-
102
-	public function delete() {
103
-		throw new Forbidden();
104
-	}
105
-
106
-	public function getName(): string {
107
-		return 'direct';
108
-	}
109
-
110
-	public function setName($name) {
111
-		throw new Forbidden();
112
-	}
113
-
114
-	public function getLastModified(): int {
115
-		return 0;
116
-	}
40
+    /** @var IRootFolder */
41
+    private $rootFolder;
42
+
43
+    /** @var DirectMapper */
44
+    private $mapper;
45
+
46
+    /** @var ITimeFactory */
47
+    private $timeFactory;
48
+
49
+    /** @var Throttler */
50
+    private $throttler;
51
+
52
+    /** @var IRequest */
53
+    private $request;
54
+
55
+    public function __construct(IRootFolder $rootFolder,
56
+                                DirectMapper $mapper,
57
+                                ITimeFactory $timeFactory,
58
+                                Throttler $throttler,
59
+                                IRequest $request) {
60
+        $this->rootFolder = $rootFolder;
61
+        $this->mapper = $mapper;
62
+        $this->timeFactory = $timeFactory;
63
+        $this->throttler = $throttler;
64
+        $this->request = $request;
65
+    }
66
+
67
+    public function createFile($name, $data = null) {
68
+        throw new Forbidden();
69
+    }
70
+
71
+    public function createDirectory($name) {
72
+        throw new Forbidden();
73
+    }
74
+
75
+    public function getChild($name): DirectFile {
76
+        try {
77
+            $direct = $this->mapper->getByToken($name);
78
+
79
+            // Expired
80
+            if ($direct->getExpiration() < $this->timeFactory->getTime()) {
81
+                throw new NotFound();
82
+            }
83
+
84
+            return new DirectFile($direct, $this->rootFolder);
85
+        } catch (DoesNotExistException $e) {
86
+            // Since the token space is so huge only throttle on non exsisting token
87
+            $this->throttler->registerAttempt('directlink', $this->request->getRemoteAddress());
88
+            $this->throttler->sleepDelay($this->request->getRemoteAddress(), 'directlink');
89
+
90
+            throw new NotFound();
91
+        }
92
+    }
93
+
94
+    public function getChildren() {
95
+        throw new MethodNotAllowed('Listing members of this collection is disabled');
96
+    }
97
+
98
+    public function childExists($name): bool {
99
+        return false;
100
+    }
101
+
102
+    public function delete() {
103
+        throw new Forbidden();
104
+    }
105
+
106
+    public function getName(): string {
107
+        return 'direct';
108
+    }
109
+
110
+    public function setName($name) {
111
+        throw new Forbidden();
112
+    }
113
+
114
+    public function getLastModified(): int {
115
+        return 0;
116
+    }
117 117
 
118 118
 }
Please login to merge, or discard this patch.
ocm-provider/index.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
 $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api');
30 30
 
31 31
 if ($isEnabled) {
32
-	$capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator());
33
-	header('Content-Type: application/json');
34
-	echo json_encode($capabilities->getCapabilities()['ocm']);
32
+    $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator());
33
+    header('Content-Type: application/json');
34
+    echo json_encode($capabilities->getCapabilities()['ocm']);
35 35
 } else {
36
-	header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501);
37
-	exit("501 Not Implemented");
36
+    header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501);
37
+    exit("501 Not Implemented");
38 38
 }
39 39
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
  */
21 21
 
22 22
 
23
-require_once __DIR__ . '/../lib/base.php';
23
+require_once __DIR__.'/../lib/base.php';
24 24
 
25 25
 header('Content-Type: application/json');
26 26
 
Please login to merge, or discard this patch.
apps/federatedfilesharing/composer/composer/autoload_static.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitFederatedFileSharing
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\FederatedFileSharing\\' => 25,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\FederatedFileSharing\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\FederatedFileSharing\\AddressHandler' => __DIR__ . '/..' . '/../lib/AddressHandler.php',
25
-        'OCA\\FederatedFileSharing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
26
-        'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RetryJob.php',
27
-        'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => __DIR__ . '/..' . '/../lib/Controller/MountPublicLinkController.php',
28
-        'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => __DIR__ . '/..' . '/../lib/Controller/RequestHandlerController.php',
29
-        'OCA\\FederatedFileSharing\\FederatedShareProvider' => __DIR__ . '/..' . '/../lib/FederatedShareProvider.php',
30
-        'OCA\\FederatedFileSharing\\Notifications' => __DIR__ . '/..' . '/../lib/Notifications.php',
31
-        'OCA\\FederatedFileSharing\\Notifier' => __DIR__ . '/..' . '/../lib/Notifier.php',
32
-        'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => __DIR__ . '/..' . '/../lib/ocm/CloudFederationProviderFiles.php',
33
-        'OCA\\FederatedFileSharing\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
34
-        'OCA\\FederatedFileSharing\\Settings\\Personal' => __DIR__ . '/..' . '/../lib/Settings/Personal.php',
35
-        'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => __DIR__ . '/..' . '/../lib/Settings/PersonalSection.php',
36
-        'OCA\\FederatedFileSharing\\TokenHandler' => __DIR__ . '/..' . '/../lib/TokenHandler.php',
23
+    public static $classMap = array(
24
+        'OCA\\FederatedFileSharing\\AddressHandler' => __DIR__.'/..'.'/../lib/AddressHandler.php',
25
+        'OCA\\FederatedFileSharing\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
26
+        'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RetryJob.php',
27
+        'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => __DIR__.'/..'.'/../lib/Controller/MountPublicLinkController.php',
28
+        'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => __DIR__.'/..'.'/../lib/Controller/RequestHandlerController.php',
29
+        'OCA\\FederatedFileSharing\\FederatedShareProvider' => __DIR__.'/..'.'/../lib/FederatedShareProvider.php',
30
+        'OCA\\FederatedFileSharing\\Notifications' => __DIR__.'/..'.'/../lib/Notifications.php',
31
+        'OCA\\FederatedFileSharing\\Notifier' => __DIR__.'/..'.'/../lib/Notifier.php',
32
+        'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => __DIR__.'/..'.'/../lib/ocm/CloudFederationProviderFiles.php',
33
+        'OCA\\FederatedFileSharing\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php',
34
+        'OCA\\FederatedFileSharing\\Settings\\Personal' => __DIR__.'/..'.'/../lib/Settings/Personal.php',
35
+        'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => __DIR__.'/..'.'/../lib/Settings/PersonalSection.php',
36
+        'OCA\\FederatedFileSharing\\TokenHandler' => __DIR__.'/..'.'/../lib/TokenHandler.php',
37 37
     );
38 38
 
39 39
     public static function getInitializer(ClassLoader $loader)
40 40
     {
41
-        return \Closure::bind(function () use ($loader) {
41
+        return \Closure::bind(function() use ($loader) {
42 42
             $loader->prefixLengthsPsr4 = ComposerStaticInitFederatedFileSharing::$prefixLengthsPsr4;
43 43
             $loader->prefixDirsPsr4 = ComposerStaticInitFederatedFileSharing::$prefixDirsPsr4;
44 44
             $loader->classMap = ComposerStaticInitFederatedFileSharing::$classMap;
Please login to merge, or discard this patch.
apps/federatedfilesharing/composer/composer/autoload_classmap.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\FederatedFileSharing\\AddressHandler' => $baseDir . '/../lib/AddressHandler.php',
10
-    'OCA\\FederatedFileSharing\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
11
-    'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => $baseDir . '/../lib/BackgroundJob/RetryJob.php',
12
-    'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => $baseDir . '/../lib/Controller/MountPublicLinkController.php',
13
-    'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => $baseDir . '/../lib/Controller/RequestHandlerController.php',
14
-    'OCA\\FederatedFileSharing\\FederatedShareProvider' => $baseDir . '/../lib/FederatedShareProvider.php',
15
-    'OCA\\FederatedFileSharing\\Notifications' => $baseDir . '/../lib/Notifications.php',
16
-    'OCA\\FederatedFileSharing\\Notifier' => $baseDir . '/../lib/Notifier.php',
17
-    'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => $baseDir . '/../lib/ocm/CloudFederationProviderFiles.php',
18
-    'OCA\\FederatedFileSharing\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
19
-    'OCA\\FederatedFileSharing\\Settings\\Personal' => $baseDir . '/../lib/Settings/Personal.php',
20
-    'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => $baseDir . '/../lib/Settings/PersonalSection.php',
21
-    'OCA\\FederatedFileSharing\\TokenHandler' => $baseDir . '/../lib/TokenHandler.php',
9
+    'OCA\\FederatedFileSharing\\AddressHandler' => $baseDir.'/../lib/AddressHandler.php',
10
+    'OCA\\FederatedFileSharing\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
11
+    'OCA\\FederatedFileSharing\\BackgroundJob\\RetryJob' => $baseDir.'/../lib/BackgroundJob/RetryJob.php',
12
+    'OCA\\FederatedFileSharing\\Controller\\MountPublicLinkController' => $baseDir.'/../lib/Controller/MountPublicLinkController.php',
13
+    'OCA\\FederatedFileSharing\\Controller\\RequestHandlerController' => $baseDir.'/../lib/Controller/RequestHandlerController.php',
14
+    'OCA\\FederatedFileSharing\\FederatedShareProvider' => $baseDir.'/../lib/FederatedShareProvider.php',
15
+    'OCA\\FederatedFileSharing\\Notifications' => $baseDir.'/../lib/Notifications.php',
16
+    'OCA\\FederatedFileSharing\\Notifier' => $baseDir.'/../lib/Notifier.php',
17
+    'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => $baseDir.'/../lib/ocm/CloudFederationProviderFiles.php',
18
+    'OCA\\FederatedFileSharing\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php',
19
+    'OCA\\FederatedFileSharing\\Settings\\Personal' => $baseDir.'/../lib/Settings/Personal.php',
20
+    'OCA\\FederatedFileSharing\\Settings\\PersonalSection' => $baseDir.'/../lib/Settings/PersonalSection.php',
21
+    'OCA\\FederatedFileSharing\\TokenHandler' => $baseDir.'/../lib/TokenHandler.php',
22 22
 );
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct($providerId) {
34 34
 		$l = \OC::$server->getL10N('federation');
35
-		$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
35
+		$message = 'Cloud Federation Provider with ID: "'.$providerId.'" does not exist.';
36 36
 		$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
37 37
 		parent::__construct($message, $hint);
38 38
 	}
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@
 block discarded – undo
32 32
  */
33 33
 class ProviderDoesNotExistsException extends HintException {
34 34
 
35
-	/**
36
-	 * ProviderDoesNotExistsException constructor.
37
-	 *
38
-	 * @since 14.0.0
39
-	 *
40
-	 * @param string $providerId cloud federation provider ID
41
-	 */
42
-	public function __construct($providerId) {
43
-		$l = \OC::$server->getL10N('federation');
44
-		$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
45
-		$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
46
-		parent::__construct($message, $hint);
47
-	}
35
+    /**
36
+     * ProviderDoesNotExistsException constructor.
37
+     *
38
+     * @since 14.0.0
39
+     *
40
+     * @param string $providerId cloud federation provider ID
41
+     */
42
+    public function __construct($providerId) {
43
+        $l = \OC::$server->getL10N('federation');
44
+        $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
45
+        $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
46
+        parent::__construct($message, $hint);
47
+    }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/Directory.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				// exit if we can't create a new file and we don't updatable existing file
127 127
 				$chunkInfo = \OC_FileChunking::decodeName($name);
128 128
 				if (!$this->fileView->isCreatable($this->path) &&
129
-					!$this->fileView->isUpdatable($this->path . '/' . $chunkInfo['name'])
129
+					!$this->fileView->isUpdatable($this->path.'/'.$chunkInfo['name'])
130 130
 				) {
131 131
 					throw new \Sabre\DAV\Exception\Forbidden();
132 132
 				}
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 
141 141
 			$this->fileView->verifyPath($this->path, $name);
142 142
 
143
-			$path = $this->fileView->getAbsolutePath($this->path) . '/' . $name;
143
+			$path = $this->fileView->getAbsolutePath($this->path).'/'.$name;
144 144
 			// in case the file already exists/overwriting
145
-			$info = $this->fileView->getFileInfo($this->path . '/' . $name);
145
+			$info = $this->fileView->getFileInfo($this->path.'/'.$name);
146 146
 			if (!$info) {
147 147
 				// use a dummy FileInfo which is acceptable here since it will be refreshed after the put is complete
148 148
 				$info = new \OC\Files\FileInfo($path, null, null, [], null);
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 
152 152
 			// only allow 1 process to upload a file at once but still allow reading the file while writing the part file
153 153
 			$node->acquireLock(ILockingProvider::LOCK_SHARED);
154
-			$this->fileView->lockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
154
+			$this->fileView->lockFile($path.'.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
155 155
 
156 156
 			$result = $node->put($data);
157 157
 
158
-			$this->fileView->unlockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
158
+			$this->fileView->unlockFile($path.'.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
159 159
 			$node->releaseLock(ILockingProvider::LOCK_SHARED);
160 160
 			return $result;
161 161
 		} catch (\OCP\Files\StorageNotAvailableException $e) {
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 			}
186 186
 
187 187
 			$this->fileView->verifyPath($this->path, $name);
188
-			$newPath = $this->path . '/' . $name;
188
+			$newPath = $this->path.'/'.$name;
189 189
 			if (!$this->fileView->mkdir($newPath)) {
190
-				throw new \Sabre\DAV\Exception\Forbidden('Could not create directory ' . $newPath);
190
+				throw new \Sabre\DAV\Exception\Forbidden('Could not create directory '.$newPath);
191 191
 			}
192 192
 		} catch (\OCP\Files\StorageNotAvailableException $e) {
193 193
 			throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			throw new NotFound();
217 217
 		}
218 218
 
219
-		$path = $this->path . '/' . $name;
219
+		$path = $this->path.'/'.$name;
220 220
 		if (is_null($info)) {
221 221
 			try {
222 222
 				$this->fileView->verifyPath($this->path, $name);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		}
232 232
 
233 233
 		if (!$info) {
234
-			throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
234
+			throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located');
235 235
 		}
236 236
 
237 237
 		if ($info['mimetype'] === 'httpd/unix-directory') {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		// (required old code) instead of "updateFile".
291 291
 		//
292 292
 		// TODO: resolve chunk file name here and implement "updateFile"
293
-		$path = $this->path . '/' . $name;
293
+		$path = $this->path.'/'.$name;
294 294
 		return $this->fileView->file_exists($path);
295 295
 
296 296
 	}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			throw new ServiceUnavailable('filesystem not setup');
386 386
 		}
387 387
 
388
-		$destinationPath = $this->getPath() . '/' . $targetName;
388
+		$destinationPath = $this->getPath().'/'.$targetName;
389 389
 
390 390
 
391 391
 		$targetNodeExists = $this->childExists($targetName);
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 		// at getNodeForPath we also check the path for isForbiddenFileOrDir
394 394
 		// with that we have covered both source and destination
395 395
 		if ($sourceNode instanceof Directory && $targetNodeExists) {
396
-			throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists');
396
+			throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory '.$sourceNode->getName().', target exists');
397 397
 		}
398 398
 
399 399
 		list($sourceDir,) = \Sabre\Uri\split($sourceNode->getPath());
Please login to merge, or discard this patch.
Indentation   +395 added lines, -395 removed lines patch added patch discarded remove patch
@@ -52,399 +52,399 @@
 block discarded – undo
52 52
 
53 53
 class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget {
54 54
 
55
-	/**
56
-	 * Cached directory content
57
-	 *
58
-	 * @var \OCP\Files\FileInfo[]
59
-	 */
60
-	private $dirContent;
61
-
62
-	/**
63
-	 * Cached quota info
64
-	 *
65
-	 * @var array
66
-	 */
67
-	private $quotaInfo;
68
-
69
-	/**
70
-	 * @var ObjectTree|null
71
-	 */
72
-	private $tree;
73
-
74
-	/**
75
-	 * Sets up the node, expects a full path name
76
-	 *
77
-	 * @param \OC\Files\View $view
78
-	 * @param \OCP\Files\FileInfo $info
79
-	 * @param ObjectTree|null $tree
80
-	 * @param \OCP\Share\IManager $shareManager
81
-	 */
82
-	public function __construct(View $view, FileInfo $info, $tree = null, $shareManager = null) {
83
-		parent::__construct($view, $info, $shareManager);
84
-		$this->tree = $tree;
85
-	}
86
-
87
-	/**
88
-	 * Creates a new file in the directory
89
-	 *
90
-	 * Data will either be supplied as a stream resource, or in certain cases
91
-	 * as a string. Keep in mind that you may have to support either.
92
-	 *
93
-	 * After successful creation of the file, you may choose to return the ETag
94
-	 * of the new file here.
95
-	 *
96
-	 * The returned ETag must be surrounded by double-quotes (The quotes should
97
-	 * be part of the actual string).
98
-	 *
99
-	 * If you cannot accurately determine the ETag, you should not return it.
100
-	 * If you don't store the file exactly as-is (you're transforming it
101
-	 * somehow) you should also not return an ETag.
102
-	 *
103
-	 * This means that if a subsequent GET to this new file does not exactly
104
-	 * return the same contents of what was submitted here, you are strongly
105
-	 * recommended to omit the ETag.
106
-	 *
107
-	 * @param string $name Name of the file
108
-	 * @param resource|string $data Initial payload
109
-	 * @return null|string
110
-	 * @throws Exception\EntityTooLarge
111
-	 * @throws Exception\UnsupportedMediaType
112
-	 * @throws FileLocked
113
-	 * @throws InvalidPath
114
-	 * @throws \Sabre\DAV\Exception
115
-	 * @throws \Sabre\DAV\Exception\BadRequest
116
-	 * @throws \Sabre\DAV\Exception\Forbidden
117
-	 * @throws \Sabre\DAV\Exception\ServiceUnavailable
118
-	 */
119
-	public function createFile($name, $data = null) {
120
-		try {
121
-			// for chunked upload also updating a existing file is a "createFile"
122
-			// because we create all the chunks before re-assemble them to the existing file.
123
-			if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
124
-
125
-				// exit if we can't create a new file and we don't updatable existing file
126
-				$chunkInfo = \OC_FileChunking::decodeName($name);
127
-				if (!$this->fileView->isCreatable($this->path) &&
128
-					!$this->fileView->isUpdatable($this->path . '/' . $chunkInfo['name'])
129
-				) {
130
-					throw new \Sabre\DAV\Exception\Forbidden();
131
-				}
132
-			} else {
133
-				// For non-chunked upload it is enough to check if we can create a new file
134
-				if (!$this->fileView->isCreatable($this->path)) {
135
-					throw new \Sabre\DAV\Exception\Forbidden();
136
-				}
137
-			}
138
-
139
-			$this->fileView->verifyPath($this->path, $name);
140
-
141
-			$path = $this->fileView->getAbsolutePath($this->path) . '/' . $name;
142
-			// in case the file already exists/overwriting
143
-			$info = $this->fileView->getFileInfo($this->path . '/' . $name);
144
-			if (!$info) {
145
-				// use a dummy FileInfo which is acceptable here since it will be refreshed after the put is complete
146
-				$info = new \OC\Files\FileInfo($path, null, null, [], null);
147
-			}
148
-			$node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info);
149
-
150
-			// only allow 1 process to upload a file at once but still allow reading the file while writing the part file
151
-			$node->acquireLock(ILockingProvider::LOCK_SHARED);
152
-			$this->fileView->lockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
153
-
154
-			$result = $node->put($data);
155
-
156
-			$this->fileView->unlockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
157
-			$node->releaseLock(ILockingProvider::LOCK_SHARED);
158
-			return $result;
159
-		} catch (\OCP\Files\StorageNotAvailableException $e) {
160
-			throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage(), $e->getCode(), $e);
161
-		} catch (InvalidPathException $ex) {
162
-			throw new InvalidPath($ex->getMessage(), false, $ex);
163
-		} catch (ForbiddenException $ex) {
164
-			throw new Forbidden($ex->getMessage(), $ex->getRetry(), $ex);
165
-		} catch (LockedException $e) {
166
-			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
167
-		}
168
-	}
169
-
170
-	/**
171
-	 * Creates a new subdirectory
172
-	 *
173
-	 * @param string $name
174
-	 * @throws FileLocked
175
-	 * @throws InvalidPath
176
-	 * @throws \Sabre\DAV\Exception\Forbidden
177
-	 * @throws \Sabre\DAV\Exception\ServiceUnavailable
178
-	 */
179
-	public function createDirectory($name) {
180
-		try {
181
-			if (!$this->info->isCreatable()) {
182
-				throw new \Sabre\DAV\Exception\Forbidden();
183
-			}
184
-
185
-			$this->fileView->verifyPath($this->path, $name);
186
-			$newPath = $this->path . '/' . $name;
187
-			if (!$this->fileView->mkdir($newPath)) {
188
-				throw new \Sabre\DAV\Exception\Forbidden('Could not create directory ' . $newPath);
189
-			}
190
-		} catch (\OCP\Files\StorageNotAvailableException $e) {
191
-			throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
192
-		} catch (InvalidPathException $ex) {
193
-			throw new InvalidPath($ex->getMessage());
194
-		} catch (ForbiddenException $ex) {
195
-			throw new Forbidden($ex->getMessage(), $ex->getRetry());
196
-		} catch (LockedException $e) {
197
-			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
198
-		}
199
-	}
200
-
201
-	/**
202
-	 * Returns a specific child node, referenced by its name
203
-	 *
204
-	 * @param string $name
205
-	 * @param \OCP\Files\FileInfo $info
206
-	 * @return \Sabre\DAV\INode
207
-	 * @throws InvalidPath
208
-	 * @throws \Sabre\DAV\Exception\NotFound
209
-	 * @throws \Sabre\DAV\Exception\ServiceUnavailable
210
-	 */
211
-	public function getChild($name, $info = null) {
212
-		if (!$this->info->isReadable()) {
213
-			// avoid detecting files through this way
214
-			throw new NotFound();
215
-		}
216
-
217
-		$path = $this->path . '/' . $name;
218
-		if (is_null($info)) {
219
-			try {
220
-				$this->fileView->verifyPath($this->path, $name);
221
-				$info = $this->fileView->getFileInfo($path);
222
-			} catch (\OCP\Files\StorageNotAvailableException $e) {
223
-				throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
224
-			} catch (InvalidPathException $ex) {
225
-				throw new InvalidPath($ex->getMessage());
226
-			} catch (ForbiddenException $e) {
227
-				throw new \Sabre\DAV\Exception\Forbidden();
228
-			}
229
-		}
230
-
231
-		if (!$info) {
232
-			throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
233
-		}
234
-
235
-		if ($info['mimetype'] === 'httpd/unix-directory') {
236
-			$node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager);
237
-		} else {
238
-			$node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info, $this->shareManager);
239
-		}
240
-		if ($this->tree) {
241
-			$this->tree->cacheNode($node);
242
-		}
243
-		return $node;
244
-	}
245
-
246
-	/**
247
-	 * Returns an array with all the child nodes
248
-	 *
249
-	 * @return \Sabre\DAV\INode[]
250
-	 * @throws \Sabre\DAV\Exception\Locked
251
-	 * @throws \OCA\DAV\Connector\Sabre\Exception\Forbidden
252
-	 */
253
-	public function getChildren() {
254
-		if (!is_null($this->dirContent)) {
255
-			return $this->dirContent;
256
-		}
257
-		try {
258
-			if (!$this->info->isReadable()) {
259
-				// return 403 instead of 404 because a 404 would make
260
-				// the caller believe that the collection itself does not exist
261
-				throw new Forbidden('No read permissions');
262
-			}
263
-			$folderContent = $this->fileView->getDirectoryContent($this->path);
264
-		} catch (LockedException $e) {
265
-			throw new Locked();
266
-		}
267
-
268
-		$nodes = [];
269
-		foreach ($folderContent as $info) {
270
-			$node = $this->getChild($info->getName(), $info);
271
-			$nodes[] = $node;
272
-		}
273
-		$this->dirContent = $nodes;
274
-		return $this->dirContent;
275
-	}
276
-
277
-	/**
278
-	 * Checks if a child exists.
279
-	 *
280
-	 * @param string $name
281
-	 * @return bool
282
-	 */
283
-	public function childExists($name) {
284
-		// note: here we do NOT resolve the chunk file name to the real file name
285
-		// to make sure we return false when checking for file existence with a chunk
286
-		// file name.
287
-		// This is to make sure that "createFile" is still triggered
288
-		// (required old code) instead of "updateFile".
289
-		//
290
-		// TODO: resolve chunk file name here and implement "updateFile"
291
-		$path = $this->path . '/' . $name;
292
-		return $this->fileView->file_exists($path);
293
-	}
294
-
295
-	/**
296
-	 * Deletes all files in this directory, and then itself
297
-	 *
298
-	 * @return void
299
-	 * @throws FileLocked
300
-	 * @throws \Sabre\DAV\Exception\Forbidden
301
-	 */
302
-	public function delete() {
303
-		if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) {
304
-			throw new \Sabre\DAV\Exception\Forbidden();
305
-		}
306
-
307
-		try {
308
-			if (!$this->fileView->rmdir($this->path)) {
309
-				// assume it wasn't possible to remove due to permission issue
310
-				throw new \Sabre\DAV\Exception\Forbidden();
311
-			}
312
-		} catch (ForbiddenException $ex) {
313
-			throw new Forbidden($ex->getMessage(), $ex->getRetry());
314
-		} catch (LockedException $e) {
315
-			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
316
-		}
317
-	}
318
-
319
-	/**
320
-	 * Returns available diskspace information
321
-	 *
322
-	 * @return array
323
-	 */
324
-	public function getQuotaInfo() {
325
-		if ($this->quotaInfo) {
326
-			return $this->quotaInfo;
327
-		}
328
-		try {
329
-			$storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $this->info);
330
-			if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
331
-				$free = \OCP\Files\FileInfo::SPACE_UNLIMITED;
332
-			} else {
333
-				$free = $storageInfo['free'];
334
-			}
335
-			$this->quotaInfo = [
336
-				$storageInfo['used'],
337
-				$free
338
-			];
339
-			return $this->quotaInfo;
340
-		} catch (\OCP\Files\StorageNotAvailableException $e) {
341
-			return [0, 0];
342
-		}
343
-	}
344
-
345
-	/**
346
-	 * Moves a node into this collection.
347
-	 *
348
-	 * It is up to the implementors to:
349
-	 *   1. Create the new resource.
350
-	 *   2. Remove the old resource.
351
-	 *   3. Transfer any properties or other data.
352
-	 *
353
-	 * Generally you should make very sure that your collection can easily move
354
-	 * the move.
355
-	 *
356
-	 * If you don't, just return false, which will trigger sabre/dav to handle
357
-	 * the move itself. If you return true from this function, the assumption
358
-	 * is that the move was successful.
359
-	 *
360
-	 * @param string $targetName New local file/collection name.
361
-	 * @param string $fullSourcePath Full path to source node
362
-	 * @param INode $sourceNode Source node itself
363
-	 * @return bool
364
-	 * @throws BadRequest
365
-	 * @throws ServiceUnavailable
366
-	 * @throws Forbidden
367
-	 * @throws FileLocked
368
-	 * @throws \Sabre\DAV\Exception\Forbidden
369
-	 */
370
-	public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
371
-		if (!$sourceNode instanceof Node) {
372
-			// it's a file of another kind, like FutureFile
373
-			if ($sourceNode instanceof IFile) {
374
-				// fallback to default copy+delete handling
375
-				return false;
376
-			}
377
-			throw new BadRequest('Incompatible node types');
378
-		}
379
-
380
-		if (!$this->fileView) {
381
-			throw new ServiceUnavailable('filesystem not setup');
382
-		}
383
-
384
-		$destinationPath = $this->getPath() . '/' . $targetName;
385
-
386
-
387
-		$targetNodeExists = $this->childExists($targetName);
388
-
389
-		// at getNodeForPath we also check the path for isForbiddenFileOrDir
390
-		// with that we have covered both source and destination
391
-		if ($sourceNode instanceof Directory && $targetNodeExists) {
392
-			throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists');
393
-		}
394
-
395
-		list($sourceDir,) = \Sabre\Uri\split($sourceNode->getPath());
396
-		$destinationDir = $this->getPath();
397
-
398
-		$sourcePath = $sourceNode->getPath();
399
-
400
-		$isMovableMount = false;
401
-		$sourceMount = \OC::$server->getMountManager()->find($this->fileView->getAbsolutePath($sourcePath));
402
-		$internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
403
-		if ($sourceMount instanceof MoveableMount && $internalPath === '') {
404
-			$isMovableMount = true;
405
-		}
406
-
407
-		try {
408
-			$sameFolder = ($sourceDir === $destinationDir);
409
-			// if we're overwriting or same folder
410
-			if ($targetNodeExists || $sameFolder) {
411
-				// note that renaming a share mount point is always allowed
412
-				if (!$this->fileView->isUpdatable($destinationDir) && !$isMovableMount) {
413
-					throw new \Sabre\DAV\Exception\Forbidden();
414
-				}
415
-			} else {
416
-				if (!$this->fileView->isCreatable($destinationDir)) {
417
-					throw new \Sabre\DAV\Exception\Forbidden();
418
-				}
419
-			}
420
-
421
-			if (!$sameFolder) {
422
-				// moving to a different folder, source will be gone, like a deletion
423
-				// note that moving a share mount point is always allowed
424
-				if (!$this->fileView->isDeletable($sourcePath) && !$isMovableMount) {
425
-					throw new \Sabre\DAV\Exception\Forbidden();
426
-				}
427
-			}
428
-
429
-			$fileName = basename($destinationPath);
430
-			try {
431
-				$this->fileView->verifyPath($destinationDir, $fileName);
432
-			} catch (InvalidPathException $ex) {
433
-				throw new InvalidPath($ex->getMessage());
434
-			}
435
-
436
-			$renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
437
-			if (!$renameOkay) {
438
-				throw new \Sabre\DAV\Exception\Forbidden('');
439
-			}
440
-		} catch (StorageNotAvailableException $e) {
441
-			throw new ServiceUnavailable($e->getMessage());
442
-		} catch (ForbiddenException $ex) {
443
-			throw new Forbidden($ex->getMessage(), $ex->getRetry());
444
-		} catch (LockedException $e) {
445
-			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
446
-		}
447
-
448
-		return true;
449
-	}
55
+    /**
56
+     * Cached directory content
57
+     *
58
+     * @var \OCP\Files\FileInfo[]
59
+     */
60
+    private $dirContent;
61
+
62
+    /**
63
+     * Cached quota info
64
+     *
65
+     * @var array
66
+     */
67
+    private $quotaInfo;
68
+
69
+    /**
70
+     * @var ObjectTree|null
71
+     */
72
+    private $tree;
73
+
74
+    /**
75
+     * Sets up the node, expects a full path name
76
+     *
77
+     * @param \OC\Files\View $view
78
+     * @param \OCP\Files\FileInfo $info
79
+     * @param ObjectTree|null $tree
80
+     * @param \OCP\Share\IManager $shareManager
81
+     */
82
+    public function __construct(View $view, FileInfo $info, $tree = null, $shareManager = null) {
83
+        parent::__construct($view, $info, $shareManager);
84
+        $this->tree = $tree;
85
+    }
86
+
87
+    /**
88
+     * Creates a new file in the directory
89
+     *
90
+     * Data will either be supplied as a stream resource, or in certain cases
91
+     * as a string. Keep in mind that you may have to support either.
92
+     *
93
+     * After successful creation of the file, you may choose to return the ETag
94
+     * of the new file here.
95
+     *
96
+     * The returned ETag must be surrounded by double-quotes (The quotes should
97
+     * be part of the actual string).
98
+     *
99
+     * If you cannot accurately determine the ETag, you should not return it.
100
+     * If you don't store the file exactly as-is (you're transforming it
101
+     * somehow) you should also not return an ETag.
102
+     *
103
+     * This means that if a subsequent GET to this new file does not exactly
104
+     * return the same contents of what was submitted here, you are strongly
105
+     * recommended to omit the ETag.
106
+     *
107
+     * @param string $name Name of the file
108
+     * @param resource|string $data Initial payload
109
+     * @return null|string
110
+     * @throws Exception\EntityTooLarge
111
+     * @throws Exception\UnsupportedMediaType
112
+     * @throws FileLocked
113
+     * @throws InvalidPath
114
+     * @throws \Sabre\DAV\Exception
115
+     * @throws \Sabre\DAV\Exception\BadRequest
116
+     * @throws \Sabre\DAV\Exception\Forbidden
117
+     * @throws \Sabre\DAV\Exception\ServiceUnavailable
118
+     */
119
+    public function createFile($name, $data = null) {
120
+        try {
121
+            // for chunked upload also updating a existing file is a "createFile"
122
+            // because we create all the chunks before re-assemble them to the existing file.
123
+            if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
124
+
125
+                // exit if we can't create a new file and we don't updatable existing file
126
+                $chunkInfo = \OC_FileChunking::decodeName($name);
127
+                if (!$this->fileView->isCreatable($this->path) &&
128
+                    !$this->fileView->isUpdatable($this->path . '/' . $chunkInfo['name'])
129
+                ) {
130
+                    throw new \Sabre\DAV\Exception\Forbidden();
131
+                }
132
+            } else {
133
+                // For non-chunked upload it is enough to check if we can create a new file
134
+                if (!$this->fileView->isCreatable($this->path)) {
135
+                    throw new \Sabre\DAV\Exception\Forbidden();
136
+                }
137
+            }
138
+
139
+            $this->fileView->verifyPath($this->path, $name);
140
+
141
+            $path = $this->fileView->getAbsolutePath($this->path) . '/' . $name;
142
+            // in case the file already exists/overwriting
143
+            $info = $this->fileView->getFileInfo($this->path . '/' . $name);
144
+            if (!$info) {
145
+                // use a dummy FileInfo which is acceptable here since it will be refreshed after the put is complete
146
+                $info = new \OC\Files\FileInfo($path, null, null, [], null);
147
+            }
148
+            $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info);
149
+
150
+            // only allow 1 process to upload a file at once but still allow reading the file while writing the part file
151
+            $node->acquireLock(ILockingProvider::LOCK_SHARED);
152
+            $this->fileView->lockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
153
+
154
+            $result = $node->put($data);
155
+
156
+            $this->fileView->unlockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
157
+            $node->releaseLock(ILockingProvider::LOCK_SHARED);
158
+            return $result;
159
+        } catch (\OCP\Files\StorageNotAvailableException $e) {
160
+            throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage(), $e->getCode(), $e);
161
+        } catch (InvalidPathException $ex) {
162
+            throw new InvalidPath($ex->getMessage(), false, $ex);
163
+        } catch (ForbiddenException $ex) {
164
+            throw new Forbidden($ex->getMessage(), $ex->getRetry(), $ex);
165
+        } catch (LockedException $e) {
166
+            throw new FileLocked($e->getMessage(), $e->getCode(), $e);
167
+        }
168
+    }
169
+
170
+    /**
171
+     * Creates a new subdirectory
172
+     *
173
+     * @param string $name
174
+     * @throws FileLocked
175
+     * @throws InvalidPath
176
+     * @throws \Sabre\DAV\Exception\Forbidden
177
+     * @throws \Sabre\DAV\Exception\ServiceUnavailable
178
+     */
179
+    public function createDirectory($name) {
180
+        try {
181
+            if (!$this->info->isCreatable()) {
182
+                throw new \Sabre\DAV\Exception\Forbidden();
183
+            }
184
+
185
+            $this->fileView->verifyPath($this->path, $name);
186
+            $newPath = $this->path . '/' . $name;
187
+            if (!$this->fileView->mkdir($newPath)) {
188
+                throw new \Sabre\DAV\Exception\Forbidden('Could not create directory ' . $newPath);
189
+            }
190
+        } catch (\OCP\Files\StorageNotAvailableException $e) {
191
+            throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
192
+        } catch (InvalidPathException $ex) {
193
+            throw new InvalidPath($ex->getMessage());
194
+        } catch (ForbiddenException $ex) {
195
+            throw new Forbidden($ex->getMessage(), $ex->getRetry());
196
+        } catch (LockedException $e) {
197
+            throw new FileLocked($e->getMessage(), $e->getCode(), $e);
198
+        }
199
+    }
200
+
201
+    /**
202
+     * Returns a specific child node, referenced by its name
203
+     *
204
+     * @param string $name
205
+     * @param \OCP\Files\FileInfo $info
206
+     * @return \Sabre\DAV\INode
207
+     * @throws InvalidPath
208
+     * @throws \Sabre\DAV\Exception\NotFound
209
+     * @throws \Sabre\DAV\Exception\ServiceUnavailable
210
+     */
211
+    public function getChild($name, $info = null) {
212
+        if (!$this->info->isReadable()) {
213
+            // avoid detecting files through this way
214
+            throw new NotFound();
215
+        }
216
+
217
+        $path = $this->path . '/' . $name;
218
+        if (is_null($info)) {
219
+            try {
220
+                $this->fileView->verifyPath($this->path, $name);
221
+                $info = $this->fileView->getFileInfo($path);
222
+            } catch (\OCP\Files\StorageNotAvailableException $e) {
223
+                throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
224
+            } catch (InvalidPathException $ex) {
225
+                throw new InvalidPath($ex->getMessage());
226
+            } catch (ForbiddenException $e) {
227
+                throw new \Sabre\DAV\Exception\Forbidden();
228
+            }
229
+        }
230
+
231
+        if (!$info) {
232
+            throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
233
+        }
234
+
235
+        if ($info['mimetype'] === 'httpd/unix-directory') {
236
+            $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager);
237
+        } else {
238
+            $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info, $this->shareManager);
239
+        }
240
+        if ($this->tree) {
241
+            $this->tree->cacheNode($node);
242
+        }
243
+        return $node;
244
+    }
245
+
246
+    /**
247
+     * Returns an array with all the child nodes
248
+     *
249
+     * @return \Sabre\DAV\INode[]
250
+     * @throws \Sabre\DAV\Exception\Locked
251
+     * @throws \OCA\DAV\Connector\Sabre\Exception\Forbidden
252
+     */
253
+    public function getChildren() {
254
+        if (!is_null($this->dirContent)) {
255
+            return $this->dirContent;
256
+        }
257
+        try {
258
+            if (!$this->info->isReadable()) {
259
+                // return 403 instead of 404 because a 404 would make
260
+                // the caller believe that the collection itself does not exist
261
+                throw new Forbidden('No read permissions');
262
+            }
263
+            $folderContent = $this->fileView->getDirectoryContent($this->path);
264
+        } catch (LockedException $e) {
265
+            throw new Locked();
266
+        }
267
+
268
+        $nodes = [];
269
+        foreach ($folderContent as $info) {
270
+            $node = $this->getChild($info->getName(), $info);
271
+            $nodes[] = $node;
272
+        }
273
+        $this->dirContent = $nodes;
274
+        return $this->dirContent;
275
+    }
276
+
277
+    /**
278
+     * Checks if a child exists.
279
+     *
280
+     * @param string $name
281
+     * @return bool
282
+     */
283
+    public function childExists($name) {
284
+        // note: here we do NOT resolve the chunk file name to the real file name
285
+        // to make sure we return false when checking for file existence with a chunk
286
+        // file name.
287
+        // This is to make sure that "createFile" is still triggered
288
+        // (required old code) instead of "updateFile".
289
+        //
290
+        // TODO: resolve chunk file name here and implement "updateFile"
291
+        $path = $this->path . '/' . $name;
292
+        return $this->fileView->file_exists($path);
293
+    }
294
+
295
+    /**
296
+     * Deletes all files in this directory, and then itself
297
+     *
298
+     * @return void
299
+     * @throws FileLocked
300
+     * @throws \Sabre\DAV\Exception\Forbidden
301
+     */
302
+    public function delete() {
303
+        if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) {
304
+            throw new \Sabre\DAV\Exception\Forbidden();
305
+        }
306
+
307
+        try {
308
+            if (!$this->fileView->rmdir($this->path)) {
309
+                // assume it wasn't possible to remove due to permission issue
310
+                throw new \Sabre\DAV\Exception\Forbidden();
311
+            }
312
+        } catch (ForbiddenException $ex) {
313
+            throw new Forbidden($ex->getMessage(), $ex->getRetry());
314
+        } catch (LockedException $e) {
315
+            throw new FileLocked($e->getMessage(), $e->getCode(), $e);
316
+        }
317
+    }
318
+
319
+    /**
320
+     * Returns available diskspace information
321
+     *
322
+     * @return array
323
+     */
324
+    public function getQuotaInfo() {
325
+        if ($this->quotaInfo) {
326
+            return $this->quotaInfo;
327
+        }
328
+        try {
329
+            $storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $this->info);
330
+            if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
331
+                $free = \OCP\Files\FileInfo::SPACE_UNLIMITED;
332
+            } else {
333
+                $free = $storageInfo['free'];
334
+            }
335
+            $this->quotaInfo = [
336
+                $storageInfo['used'],
337
+                $free
338
+            ];
339
+            return $this->quotaInfo;
340
+        } catch (\OCP\Files\StorageNotAvailableException $e) {
341
+            return [0, 0];
342
+        }
343
+    }
344
+
345
+    /**
346
+     * Moves a node into this collection.
347
+     *
348
+     * It is up to the implementors to:
349
+     *   1. Create the new resource.
350
+     *   2. Remove the old resource.
351
+     *   3. Transfer any properties or other data.
352
+     *
353
+     * Generally you should make very sure that your collection can easily move
354
+     * the move.
355
+     *
356
+     * If you don't, just return false, which will trigger sabre/dav to handle
357
+     * the move itself. If you return true from this function, the assumption
358
+     * is that the move was successful.
359
+     *
360
+     * @param string $targetName New local file/collection name.
361
+     * @param string $fullSourcePath Full path to source node
362
+     * @param INode $sourceNode Source node itself
363
+     * @return bool
364
+     * @throws BadRequest
365
+     * @throws ServiceUnavailable
366
+     * @throws Forbidden
367
+     * @throws FileLocked
368
+     * @throws \Sabre\DAV\Exception\Forbidden
369
+     */
370
+    public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
371
+        if (!$sourceNode instanceof Node) {
372
+            // it's a file of another kind, like FutureFile
373
+            if ($sourceNode instanceof IFile) {
374
+                // fallback to default copy+delete handling
375
+                return false;
376
+            }
377
+            throw new BadRequest('Incompatible node types');
378
+        }
379
+
380
+        if (!$this->fileView) {
381
+            throw new ServiceUnavailable('filesystem not setup');
382
+        }
383
+
384
+        $destinationPath = $this->getPath() . '/' . $targetName;
385
+
386
+
387
+        $targetNodeExists = $this->childExists($targetName);
388
+
389
+        // at getNodeForPath we also check the path for isForbiddenFileOrDir
390
+        // with that we have covered both source and destination
391
+        if ($sourceNode instanceof Directory && $targetNodeExists) {
392
+            throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists');
393
+        }
394
+
395
+        list($sourceDir,) = \Sabre\Uri\split($sourceNode->getPath());
396
+        $destinationDir = $this->getPath();
397
+
398
+        $sourcePath = $sourceNode->getPath();
399
+
400
+        $isMovableMount = false;
401
+        $sourceMount = \OC::$server->getMountManager()->find($this->fileView->getAbsolutePath($sourcePath));
402
+        $internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
403
+        if ($sourceMount instanceof MoveableMount && $internalPath === '') {
404
+            $isMovableMount = true;
405
+        }
406
+
407
+        try {
408
+            $sameFolder = ($sourceDir === $destinationDir);
409
+            // if we're overwriting or same folder
410
+            if ($targetNodeExists || $sameFolder) {
411
+                // note that renaming a share mount point is always allowed
412
+                if (!$this->fileView->isUpdatable($destinationDir) && !$isMovableMount) {
413
+                    throw new \Sabre\DAV\Exception\Forbidden();
414
+                }
415
+            } else {
416
+                if (!$this->fileView->isCreatable($destinationDir)) {
417
+                    throw new \Sabre\DAV\Exception\Forbidden();
418
+                }
419
+            }
420
+
421
+            if (!$sameFolder) {
422
+                // moving to a different folder, source will be gone, like a deletion
423
+                // note that moving a share mount point is always allowed
424
+                if (!$this->fileView->isDeletable($sourcePath) && !$isMovableMount) {
425
+                    throw new \Sabre\DAV\Exception\Forbidden();
426
+                }
427
+            }
428
+
429
+            $fileName = basename($destinationPath);
430
+            try {
431
+                $this->fileView->verifyPath($destinationDir, $fileName);
432
+            } catch (InvalidPathException $ex) {
433
+                throw new InvalidPath($ex->getMessage());
434
+            }
435
+
436
+            $renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
437
+            if (!$renameOkay) {
438
+                throw new \Sabre\DAV\Exception\Forbidden('');
439
+            }
440
+        } catch (StorageNotAvailableException $e) {
441
+            throw new ServiceUnavailable($e->getMessage());
442
+        } catch (ForbiddenException $ex) {
443
+            throw new Forbidden($ex->getMessage(), $ex->getRetry());
444
+        } catch (LockedException $e) {
445
+            throw new FileLocked($e->getMessage(), $e->getCode(), $e);
446
+        }
447
+
448
+        return true;
449
+    }
450 450
 }
Please login to merge, or discard this patch.