Passed
Push — master ( d8d15c...f4adfd )
by
unknown
14:53 queued 13s
created
lib/public/AppFramework/Http/FileDisplayResponse.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$this->file = $file;
52 52
 		$this->setStatus($statusCode);
53 53
 		$this->setHeaders(array_merge($this->getHeaders(), $headers));
54
-		$this->addHeader('Content-Disposition', 'inline; filename="' . rawurldecode($file->getName()) . '"');
54
+		$this->addHeader('Content-Disposition', 'inline; filename="'.rawurldecode($file->getName()).'"');
55 55
 
56 56
 		$this->setETag($file->getEtag());
57 57
 		$lastModified = new \DateTime();
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function callback(IOutput $output) {
67 67
 		if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) {
68
-			$output->setHeader('Content-Length: ' . $this->file->getSize());
68
+			$output->setHeader('Content-Length: '.$this->file->getSize());
69 69
 			$output->setOutput($this->file->getContent());
70 70
 		}
71 71
 	}
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -32,40 +32,40 @@
 block discarded – undo
32 32
  */
33 33
 class FileDisplayResponse extends Response implements ICallbackResponse {
34 34
 
35
-	/** @var \OCP\Files\File|\OCP\Files\SimpleFS\ISimpleFile */
36
-	private $file;
35
+    /** @var \OCP\Files\File|\OCP\Files\SimpleFS\ISimpleFile */
36
+    private $file;
37 37
 
38
-	/**
39
-	 * FileDisplayResponse constructor.
40
-	 *
41
-	 * @param \OCP\Files\File|\OCP\Files\SimpleFS\ISimpleFile $file
42
-	 * @param int $statusCode
43
-	 * @param array $headers
44
-	 * @since 11.0.0
45
-	 */
46
-	public function __construct($file, $statusCode = Http::STATUS_OK,
47
-								$headers = []) {
48
-		parent::__construct();
38
+    /**
39
+     * FileDisplayResponse constructor.
40
+     *
41
+     * @param \OCP\Files\File|\OCP\Files\SimpleFS\ISimpleFile $file
42
+     * @param int $statusCode
43
+     * @param array $headers
44
+     * @since 11.0.0
45
+     */
46
+    public function __construct($file, $statusCode = Http::STATUS_OK,
47
+                                $headers = []) {
48
+        parent::__construct();
49 49
 
50
-		$this->file = $file;
51
-		$this->setStatus($statusCode);
52
-		$this->setHeaders(array_merge($this->getHeaders(), $headers));
53
-		$this->addHeader('Content-Disposition', 'inline; filename="' . rawurldecode($file->getName()) . '"');
50
+        $this->file = $file;
51
+        $this->setStatus($statusCode);
52
+        $this->setHeaders(array_merge($this->getHeaders(), $headers));
53
+        $this->addHeader('Content-Disposition', 'inline; filename="' . rawurldecode($file->getName()) . '"');
54 54
 
55
-		$this->setETag($file->getEtag());
56
-		$lastModified = new \DateTime();
57
-		$lastModified->setTimestamp($file->getMTime());
58
-		$this->setLastModified($lastModified);
59
-	}
55
+        $this->setETag($file->getEtag());
56
+        $lastModified = new \DateTime();
57
+        $lastModified->setTimestamp($file->getMTime());
58
+        $this->setLastModified($lastModified);
59
+    }
60 60
 
61
-	/**
62
-	 * @param IOutput $output
63
-	 * @since 11.0.0
64
-	 */
65
-	public function callback(IOutput $output) {
66
-		if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) {
67
-			$output->setHeader('Content-Length: ' . $this->file->getSize());
68
-			$output->setOutput($this->file->getContent());
69
-		}
70
-	}
61
+    /**
62
+     * @param IOutput $output
63
+     * @since 11.0.0
64
+     */
65
+    public function callback(IOutput $output) {
66
+        if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) {
67
+            $output->setHeader('Content-Length: ' . $this->file->getSize());
68
+            $output->setOutput($this->file->getContent());
69
+        }
70
+    }
71 71
 }
Please login to merge, or discard this patch.
lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,17 +35,17 @@
 block discarded – undo
35 35
 		}
36 36
 
37 37
 		$excludedFolders = [
38
-			rtrim($root . '/data', '/'),
39
-			rtrim($root . '/themes', '/'),
40
-			rtrim($root . '/config', '/'),
41
-			rtrim($root . '/apps', '/'),
42
-			rtrim($root . '/assets', '/'),
43
-			rtrim($root . '/lost+found', '/'),
38
+			rtrim($root.'/data', '/'),
39
+			rtrim($root.'/themes', '/'),
40
+			rtrim($root.'/config', '/'),
41
+			rtrim($root.'/apps', '/'),
42
+			rtrim($root.'/assets', '/'),
43
+			rtrim($root.'/lost+found', '/'),
44 44
 			// Ignore folders generated by updater since the updater is replaced
45 45
 			// after the integrity check is run.
46 46
 			// See https://github.com/owncloud/updater/issues/318#issuecomment-212497846
47
-			rtrim($root . '/updater', '/'),
48
-			rtrim($root . '/_oc_upgrade', '/'),
47
+			rtrim($root.'/updater', '/'),
48
+			rtrim($root.'/_oc_upgrade', '/'),
49 49
 		];
50 50
 		$customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
51 51
 		if ($customDataDir !== '') {
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,42 +28,42 @@
 block discarded – undo
28 28
 namespace OC\IntegrityCheck\Iterator;
29 29
 
30 30
 class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator {
31
-	private $excludedFolders;
31
+    private $excludedFolders;
32 32
 
33
-	public function __construct(\RecursiveIterator $iterator, $root = '') {
34
-		parent::__construct($iterator);
33
+    public function __construct(\RecursiveIterator $iterator, $root = '') {
34
+        parent::__construct($iterator);
35 35
 
36
-		$appFolders = \OC::$APPSROOTS;
37
-		foreach ($appFolders as $key => $appFolder) {
38
-			$appFolders[$key] = rtrim($appFolder['path'], '/');
39
-		}
36
+        $appFolders = \OC::$APPSROOTS;
37
+        foreach ($appFolders as $key => $appFolder) {
38
+            $appFolders[$key] = rtrim($appFolder['path'], '/');
39
+        }
40 40
 
41
-		$excludedFolders = [
42
-			rtrim($root . '/data', '/'),
43
-			rtrim($root . '/themes', '/'),
44
-			rtrim($root . '/config', '/'),
45
-			rtrim($root . '/apps', '/'),
46
-			rtrim($root . '/assets', '/'),
47
-			rtrim($root . '/lost+found', '/'),
48
-			// Ignore folders generated by updater since the updater is replaced
49
-			// after the integrity check is run.
50
-			// See https://github.com/owncloud/updater/issues/318#issuecomment-212497846
51
-			rtrim($root . '/updater', '/'),
52
-			rtrim($root . '/_oc_upgrade', '/'),
53
-		];
54
-		$customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
55
-		if ($customDataDir !== '') {
56
-			$excludedFolders[] = rtrim($customDataDir, '/');
57
-		}
41
+        $excludedFolders = [
42
+            rtrim($root . '/data', '/'),
43
+            rtrim($root . '/themes', '/'),
44
+            rtrim($root . '/config', '/'),
45
+            rtrim($root . '/apps', '/'),
46
+            rtrim($root . '/assets', '/'),
47
+            rtrim($root . '/lost+found', '/'),
48
+            // Ignore folders generated by updater since the updater is replaced
49
+            // after the integrity check is run.
50
+            // See https://github.com/owncloud/updater/issues/318#issuecomment-212497846
51
+            rtrim($root . '/updater', '/'),
52
+            rtrim($root . '/_oc_upgrade', '/'),
53
+        ];
54
+        $customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
55
+        if ($customDataDir !== '') {
56
+            $excludedFolders[] = rtrim($customDataDir, '/');
57
+        }
58 58
 
59
-		$this->excludedFolders = array_merge($excludedFolders, $appFolders);
60
-	}
59
+        $this->excludedFolders = array_merge($excludedFolders, $appFolders);
60
+    }
61 61
 
62
-	public function accept(): bool {
63
-		return !\in_array(
64
-			$this->current()->getPathName(),
65
-			$this->excludedFolders,
66
-			true
67
-		);
68
-	}
62
+    public function accept(): bool {
63
+        return !\in_array(
64
+            $this->current()->getPathName(),
65
+            $this->excludedFolders,
66
+            true
67
+        );
68
+    }
69 69
 }
Please login to merge, or discard this patch.
lib/private/App/AppStore/Version/VersionParser.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
 	 * @return bool
33 33
 	 */
34 34
 	private function isValidVersionString($versionString) {
35
-		return (bool)preg_match('/^[0-9.]+$/', $versionString);
35
+		return (bool) preg_match('/^[0-9.]+$/', $versionString);
36 36
 	}
37 37
 
38 38
 	/**
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -30,56 +30,56 @@
 block discarded – undo
30 30
  * @package OC\App\AppStore
31 31
  */
32 32
 class VersionParser {
33
-	/**
34
-	 * @param string $versionString
35
-	 * @return bool
36
-	 */
37
-	private function isValidVersionString($versionString) {
38
-		return (bool)preg_match('/^[0-9.]+$/', $versionString);
39
-	}
33
+    /**
34
+     * @param string $versionString
35
+     * @return bool
36
+     */
37
+    private function isValidVersionString($versionString) {
38
+        return (bool)preg_match('/^[0-9.]+$/', $versionString);
39
+    }
40 40
 
41
-	/**
42
-	 * Returns the version for a version string
43
-	 *
44
-	 * @param string $versionSpec
45
-	 * @return Version
46
-	 * @throws \Exception If the version cannot be parsed
47
-	 */
48
-	public function getVersion($versionSpec) {
49
-		// * indicates that the version is compatible with all versions
50
-		if ($versionSpec === '*') {
51
-			return new Version('', '');
52
-		}
41
+    /**
42
+     * Returns the version for a version string
43
+     *
44
+     * @param string $versionSpec
45
+     * @return Version
46
+     * @throws \Exception If the version cannot be parsed
47
+     */
48
+    public function getVersion($versionSpec) {
49
+        // * indicates that the version is compatible with all versions
50
+        if ($versionSpec === '*') {
51
+            return new Version('', '');
52
+        }
53 53
 
54
-		// Count the amount of =, if it is one then it's either maximum or minimum
55
-		// version. If it is two then it is maximum and minimum.
56
-		$versionElements = explode(' ', $versionSpec);
57
-		$firstVersion = isset($versionElements[0]) ? $versionElements[0] : '';
58
-		$firstVersionNumber = substr($firstVersion, 2);
59
-		$secondVersion = isset($versionElements[1]) ? $versionElements[1] : '';
60
-		$secondVersionNumber = substr($secondVersion, 2);
54
+        // Count the amount of =, if it is one then it's either maximum or minimum
55
+        // version. If it is two then it is maximum and minimum.
56
+        $versionElements = explode(' ', $versionSpec);
57
+        $firstVersion = isset($versionElements[0]) ? $versionElements[0] : '';
58
+        $firstVersionNumber = substr($firstVersion, 2);
59
+        $secondVersion = isset($versionElements[1]) ? $versionElements[1] : '';
60
+        $secondVersionNumber = substr($secondVersion, 2);
61 61
 
62
-		switch (count($versionElements)) {
63
-			case 1:
64
-				if (!$this->isValidVersionString($firstVersionNumber)) {
65
-					break;
66
-				}
67
-				if (strpos($firstVersion, '>') === 0) {
68
-					return new Version($firstVersionNumber, '');
69
-				}
70
-				return new Version('', $firstVersionNumber);
71
-			case 2:
72
-				if (!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
73
-					break;
74
-				}
75
-				return new Version($firstVersionNumber, $secondVersionNumber);
76
-		}
62
+        switch (count($versionElements)) {
63
+            case 1:
64
+                if (!$this->isValidVersionString($firstVersionNumber)) {
65
+                    break;
66
+                }
67
+                if (strpos($firstVersion, '>') === 0) {
68
+                    return new Version($firstVersionNumber, '');
69
+                }
70
+                return new Version('', $firstVersionNumber);
71
+            case 2:
72
+                if (!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
73
+                    break;
74
+                }
75
+                return new Version($firstVersionNumber, $secondVersionNumber);
76
+        }
77 77
 
78
-		throw new \Exception(
79
-			sprintf(
80
-				'Version cannot be parsed: %s',
81
-				$versionSpec
82
-			)
83
-		);
84
-	}
78
+        throw new \Exception(
79
+            sprintf(
80
+                'Version cannot be parsed: %s',
81
+                $versionSpec
82
+            )
83
+        );
84
+    }
85 85
 }
Please login to merge, or discard this patch.
lib/private/App/AppStore/Bundles/Bundle.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -24,36 +24,36 @@
 block discarded – undo
24 24
 use OCP\IL10N;
25 25
 
26 26
 abstract class Bundle {
27
-	/** @var IL10N */
28
-	protected $l10n;
27
+    /** @var IL10N */
28
+    protected $l10n;
29 29
 
30
-	/**
31
-	 * @param IL10N $l10n
32
-	 */
33
-	public function __construct(IL10N $l10n) {
34
-		$this->l10n = $l10n;
35
-	}
30
+    /**
31
+     * @param IL10N $l10n
32
+     */
33
+    public function __construct(IL10N $l10n) {
34
+        $this->l10n = $l10n;
35
+    }
36 36
 
37
-	/**
38
-	 * Get the identifier of the bundle
39
-	 *
40
-	 * @return string
41
-	 */
42
-	final public function getIdentifier() {
43
-		return substr(strrchr(get_class($this), '\\'), 1);
44
-	}
37
+    /**
38
+     * Get the identifier of the bundle
39
+     *
40
+     * @return string
41
+     */
42
+    final public function getIdentifier() {
43
+        return substr(strrchr(get_class($this), '\\'), 1);
44
+    }
45 45
 
46
-	/**
47
-	 * Get the name of the bundle
48
-	 *
49
-	 * @return string
50
-	 */
51
-	abstract public function getName();
46
+    /**
47
+     * Get the name of the bundle
48
+     *
49
+     * @return string
50
+     */
51
+    abstract public function getName();
52 52
 
53
-	/**
54
-	 * Get the list of app identifiers in the bundle
55
-	 *
56
-	 * @return array
57
-	 */
58
-	abstract public function getAppIdentifiers();
53
+    /**
54
+     * Get the list of app identifiers in the bundle
55
+     *
56
+     * @return array
57
+     */
58
+    abstract public function getAppIdentifiers();
59 59
 }
Please login to merge, or discard this patch.
lib/private/Share20/LegacyHooks.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
 		/** @var IShare[] $deletedShares */
67 67
 		$deletedShares = $e->getArgument('deletedShares');
68 68
 
69
-		$formattedDeletedShares = array_map(function ($share) {
69
+		$formattedDeletedShares = array_map(function($share) {
70 70
 			return $this->formatHookParams($share);
71 71
 		}, $deletedShares);
72 72
 
Please login to merge, or discard this patch.
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -34,145 +34,145 @@
 block discarded – undo
34 34
 
35 35
 class LegacyHooks {
36 36
 
37
-	/** @var EventDispatcherInterface */
38
-	private $eventDispatcher;
39
-
40
-	/**
41
-	 * LegacyHooks constructor.
42
-	 *
43
-	 * @param EventDispatcherInterface $eventDispatcher
44
-	 */
45
-	public function __construct(EventDispatcherInterface $eventDispatcher) {
46
-		$this->eventDispatcher = $eventDispatcher;
47
-
48
-		$this->eventDispatcher->addListener('OCP\Share::preUnshare', [$this, 'preUnshare']);
49
-		$this->eventDispatcher->addListener('OCP\Share::postUnshare', [$this, 'postUnshare']);
50
-		$this->eventDispatcher->addListener('OCP\Share::postUnshareFromSelf', [$this, 'postUnshareFromSelf']);
51
-		$this->eventDispatcher->addListener('OCP\Share::preShare', [$this, 'preShare']);
52
-		$this->eventDispatcher->addListener('OCP\Share::postShare', [$this, 'postShare']);
53
-	}
54
-
55
-	/**
56
-	 * @param GenericEvent $e
57
-	 */
58
-	public function preUnshare(GenericEvent $e) {
59
-		/** @var IShare $share */
60
-		$share = $e->getSubject();
61
-
62
-		$formatted = $this->formatHookParams($share);
63
-		\OC_Hook::emit(Share::class, 'pre_unshare', $formatted);
64
-	}
65
-
66
-	/**
67
-	 * @param GenericEvent $e
68
-	 */
69
-	public function postUnshare(GenericEvent $e) {
70
-		/** @var IShare $share */
71
-		$share = $e->getSubject();
72
-
73
-		$formatted = $this->formatHookParams($share);
74
-
75
-		/** @var IShare[] $deletedShares */
76
-		$deletedShares = $e->getArgument('deletedShares');
77
-
78
-		$formattedDeletedShares = array_map(function ($share) {
79
-			return $this->formatHookParams($share);
80
-		}, $deletedShares);
81
-
82
-		$formatted['deletedShares'] = $formattedDeletedShares;
83
-
84
-		\OC_Hook::emit(Share::class, 'post_unshare', $formatted);
85
-	}
86
-
87
-	/**
88
-	 * @param GenericEvent $e
89
-	 */
90
-	public function postUnshareFromSelf(GenericEvent $e) {
91
-		/** @var IShare $share */
92
-		$share = $e->getSubject();
93
-
94
-		$formatted = $this->formatHookParams($share);
95
-		$formatted['itemTarget'] = $formatted['fileTarget'];
96
-		$formatted['unsharedItems'] = [$formatted];
97
-
98
-		\OC_Hook::emit(Share::class, 'post_unshareFromSelf', $formatted);
99
-	}
100
-
101
-	private function formatHookParams(IShare $share) {
102
-		// Prepare hook
103
-		$shareType = $share->getShareType();
104
-		$sharedWith = '';
105
-		if ($shareType === IShare::TYPE_USER ||
106
-			$shareType === IShare::TYPE_GROUP ||
107
-			$shareType === IShare::TYPE_REMOTE) {
108
-			$sharedWith = $share->getSharedWith();
109
-		}
110
-
111
-		$hookParams = [
112
-			'id' => $share->getId(),
113
-			'itemType' => $share->getNodeType(),
114
-			'itemSource' => $share->getNodeId(),
115
-			'shareType' => $shareType,
116
-			'shareWith' => $sharedWith,
117
-			'itemparent' => method_exists($share, 'getParent') ? $share->getParent() : '',
118
-			'uidOwner' => $share->getSharedBy(),
119
-			'fileSource' => $share->getNodeId(),
120
-			'fileTarget' => $share->getTarget()
121
-		];
122
-		return $hookParams;
123
-	}
124
-
125
-	public function preShare(GenericEvent $e) {
126
-		/** @var IShare $share */
127
-		$share = $e->getSubject();
128
-
129
-		// Pre share hook
130
-		$run = true;
131
-		$error = '';
132
-		$preHookData = [
133
-			'itemType' => $share->getNode() instanceof File ? 'file' : 'folder',
134
-			'itemSource' => $share->getNode()->getId(),
135
-			'shareType' => $share->getShareType(),
136
-			'uidOwner' => $share->getSharedBy(),
137
-			'permissions' => $share->getPermissions(),
138
-			'fileSource' => $share->getNode()->getId(),
139
-			'expiration' => $share->getExpirationDate(),
140
-			'token' => $share->getToken(),
141
-			'itemTarget' => $share->getTarget(),
142
-			'shareWith' => $share->getSharedWith(),
143
-			'run' => &$run,
144
-			'error' => &$error,
145
-		];
146
-		\OC_Hook::emit(Share::class, 'pre_shared', $preHookData);
147
-
148
-		if ($run === false) {
149
-			$e->setArgument('error', $error);
150
-			$e->stopPropagation();
151
-		}
152
-
153
-		return $e;
154
-	}
155
-
156
-	public function postShare(GenericEvent $e) {
157
-		/** @var IShare $share */
158
-		$share = $e->getSubject();
159
-
160
-		$postHookData = [
161
-			'itemType' => $share->getNode() instanceof File ? 'file' : 'folder',
162
-			'itemSource' => $share->getNode()->getId(),
163
-			'shareType' => $share->getShareType(),
164
-			'uidOwner' => $share->getSharedBy(),
165
-			'permissions' => $share->getPermissions(),
166
-			'fileSource' => $share->getNode()->getId(),
167
-			'expiration' => $share->getExpirationDate(),
168
-			'token' => $share->getToken(),
169
-			'id' => $share->getId(),
170
-			'shareWith' => $share->getSharedWith(),
171
-			'itemTarget' => $share->getTarget(),
172
-			'fileTarget' => $share->getTarget(),
173
-			'path' => $share->getNode()->getPath(),
174
-		];
175
-
176
-		\OC_Hook::emit(Share::class, 'post_shared', $postHookData);
177
-	}
37
+    /** @var EventDispatcherInterface */
38
+    private $eventDispatcher;
39
+
40
+    /**
41
+     * LegacyHooks constructor.
42
+     *
43
+     * @param EventDispatcherInterface $eventDispatcher
44
+     */
45
+    public function __construct(EventDispatcherInterface $eventDispatcher) {
46
+        $this->eventDispatcher = $eventDispatcher;
47
+
48
+        $this->eventDispatcher->addListener('OCP\Share::preUnshare', [$this, 'preUnshare']);
49
+        $this->eventDispatcher->addListener('OCP\Share::postUnshare', [$this, 'postUnshare']);
50
+        $this->eventDispatcher->addListener('OCP\Share::postUnshareFromSelf', [$this, 'postUnshareFromSelf']);
51
+        $this->eventDispatcher->addListener('OCP\Share::preShare', [$this, 'preShare']);
52
+        $this->eventDispatcher->addListener('OCP\Share::postShare', [$this, 'postShare']);
53
+    }
54
+
55
+    /**
56
+     * @param GenericEvent $e
57
+     */
58
+    public function preUnshare(GenericEvent $e) {
59
+        /** @var IShare $share */
60
+        $share = $e->getSubject();
61
+
62
+        $formatted = $this->formatHookParams($share);
63
+        \OC_Hook::emit(Share::class, 'pre_unshare', $formatted);
64
+    }
65
+
66
+    /**
67
+     * @param GenericEvent $e
68
+     */
69
+    public function postUnshare(GenericEvent $e) {
70
+        /** @var IShare $share */
71
+        $share = $e->getSubject();
72
+
73
+        $formatted = $this->formatHookParams($share);
74
+
75
+        /** @var IShare[] $deletedShares */
76
+        $deletedShares = $e->getArgument('deletedShares');
77
+
78
+        $formattedDeletedShares = array_map(function ($share) {
79
+            return $this->formatHookParams($share);
80
+        }, $deletedShares);
81
+
82
+        $formatted['deletedShares'] = $formattedDeletedShares;
83
+
84
+        \OC_Hook::emit(Share::class, 'post_unshare', $formatted);
85
+    }
86
+
87
+    /**
88
+     * @param GenericEvent $e
89
+     */
90
+    public function postUnshareFromSelf(GenericEvent $e) {
91
+        /** @var IShare $share */
92
+        $share = $e->getSubject();
93
+
94
+        $formatted = $this->formatHookParams($share);
95
+        $formatted['itemTarget'] = $formatted['fileTarget'];
96
+        $formatted['unsharedItems'] = [$formatted];
97
+
98
+        \OC_Hook::emit(Share::class, 'post_unshareFromSelf', $formatted);
99
+    }
100
+
101
+    private function formatHookParams(IShare $share) {
102
+        // Prepare hook
103
+        $shareType = $share->getShareType();
104
+        $sharedWith = '';
105
+        if ($shareType === IShare::TYPE_USER ||
106
+            $shareType === IShare::TYPE_GROUP ||
107
+            $shareType === IShare::TYPE_REMOTE) {
108
+            $sharedWith = $share->getSharedWith();
109
+        }
110
+
111
+        $hookParams = [
112
+            'id' => $share->getId(),
113
+            'itemType' => $share->getNodeType(),
114
+            'itemSource' => $share->getNodeId(),
115
+            'shareType' => $shareType,
116
+            'shareWith' => $sharedWith,
117
+            'itemparent' => method_exists($share, 'getParent') ? $share->getParent() : '',
118
+            'uidOwner' => $share->getSharedBy(),
119
+            'fileSource' => $share->getNodeId(),
120
+            'fileTarget' => $share->getTarget()
121
+        ];
122
+        return $hookParams;
123
+    }
124
+
125
+    public function preShare(GenericEvent $e) {
126
+        /** @var IShare $share */
127
+        $share = $e->getSubject();
128
+
129
+        // Pre share hook
130
+        $run = true;
131
+        $error = '';
132
+        $preHookData = [
133
+            'itemType' => $share->getNode() instanceof File ? 'file' : 'folder',
134
+            'itemSource' => $share->getNode()->getId(),
135
+            'shareType' => $share->getShareType(),
136
+            'uidOwner' => $share->getSharedBy(),
137
+            'permissions' => $share->getPermissions(),
138
+            'fileSource' => $share->getNode()->getId(),
139
+            'expiration' => $share->getExpirationDate(),
140
+            'token' => $share->getToken(),
141
+            'itemTarget' => $share->getTarget(),
142
+            'shareWith' => $share->getSharedWith(),
143
+            'run' => &$run,
144
+            'error' => &$error,
145
+        ];
146
+        \OC_Hook::emit(Share::class, 'pre_shared', $preHookData);
147
+
148
+        if ($run === false) {
149
+            $e->setArgument('error', $error);
150
+            $e->stopPropagation();
151
+        }
152
+
153
+        return $e;
154
+    }
155
+
156
+    public function postShare(GenericEvent $e) {
157
+        /** @var IShare $share */
158
+        $share = $e->getSubject();
159
+
160
+        $postHookData = [
161
+            'itemType' => $share->getNode() instanceof File ? 'file' : 'folder',
162
+            'itemSource' => $share->getNode()->getId(),
163
+            'shareType' => $share->getShareType(),
164
+            'uidOwner' => $share->getSharedBy(),
165
+            'permissions' => $share->getPermissions(),
166
+            'fileSource' => $share->getNode()->getId(),
167
+            'expiration' => $share->getExpirationDate(),
168
+            'token' => $share->getToken(),
169
+            'id' => $share->getId(),
170
+            'shareWith' => $share->getSharedWith(),
171
+            'itemTarget' => $share->getTarget(),
172
+            'fileTarget' => $share->getTarget(),
173
+            'path' => $share->getNode()->getPath(),
174
+        ];
175
+
176
+        \OC_Hook::emit(Share::class, 'post_shared', $postHookData);
177
+    }
178 178
 }
Please login to merge, or discard this patch.
lib/private/Share20/Share.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function setId($id) {
88 88
 		if (is_int($id)) {
89
-			$id = (string)$id;
89
+			$id = (string) $id;
90 90
 		}
91 91
 
92 92
 		if (!is_string($id)) {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		if ($this->providerId === null || $this->id === null) {
116 116
 			throw new \UnexpectedValueException;
117 117
 		}
118
-		return $this->providerId . ':' . $this->id;
118
+		return $this->providerId.':'.$this->id;
119 119
 	}
120 120
 
121 121
 	/**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 			$nodes = $userFolder->getById($this->fileId);
165 165
 			if (empty($nodes)) {
166
-				throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
166
+				throw new NotFoundException('Node for share not found, fileid: '.$this->fileId);
167 167
 			}
168 168
 
169 169
 			$this->node = $nodes[0];
Please login to merge, or discard this patch.
Indentation   +579 added lines, -579 removed lines patch added patch discarded remove patch
@@ -42,583 +42,583 @@
 block discarded – undo
42 42
 
43 43
 class Share implements IShare {
44 44
 
45
-	/** @var string */
46
-	private $id;
47
-	/** @var string */
48
-	private $providerId;
49
-	/** @var Node */
50
-	private $node;
51
-	/** @var int */
52
-	private $fileId;
53
-	/** @var string */
54
-	private $nodeType;
55
-	/** @var int */
56
-	private $shareType;
57
-	/** @var string */
58
-	private $sharedWith;
59
-	/** @var string */
60
-	private $sharedWithDisplayName;
61
-	/** @var string */
62
-	private $sharedWithAvatar;
63
-	/** @var string */
64
-	private $sharedBy;
65
-	/** @var string */
66
-	private $shareOwner;
67
-	/** @var int */
68
-	private $permissions;
69
-	/** @var IAttributes */
70
-	private $attributes;
71
-	/** @var int */
72
-	private $status;
73
-	/** @var string */
74
-	private $note = '';
75
-	/** @var \DateTime */
76
-	private $expireDate;
77
-	/** @var string */
78
-	private $password;
79
-	private ?\DateTimeInterface $passwordExpirationTime = null;
80
-	/** @var bool */
81
-	private $sendPasswordByTalk = false;
82
-	/** @var string */
83
-	private $token;
84
-	/** @var int */
85
-	private $parent;
86
-	/** @var string */
87
-	private $target;
88
-	/** @var \DateTime */
89
-	private $shareTime;
90
-	/** @var bool */
91
-	private $mailSend;
92
-	/** @var string */
93
-	private $label = '';
94
-
95
-	/** @var IRootFolder */
96
-	private $rootFolder;
97
-
98
-	/** @var IUserManager */
99
-	private $userManager;
100
-
101
-	/** @var ICacheEntry|null */
102
-	private $nodeCacheEntry;
103
-
104
-	/** @var bool */
105
-	private $hideDownload = false;
106
-
107
-	public function __construct(IRootFolder $rootFolder, IUserManager $userManager) {
108
-		$this->rootFolder = $rootFolder;
109
-		$this->userManager = $userManager;
110
-	}
111
-
112
-	/**
113
-	 * @inheritdoc
114
-	 */
115
-	public function setId($id) {
116
-		if (is_int($id)) {
117
-			$id = (string)$id;
118
-		}
119
-
120
-		if (!is_string($id)) {
121
-			throw new \InvalidArgumentException('String expected.');
122
-		}
123
-
124
-		if ($this->id !== null) {
125
-			throw new IllegalIDChangeException('Not allowed to assign a new internal id to a share');
126
-		}
127
-
128
-		$this->id = trim($id);
129
-		return $this;
130
-	}
131
-
132
-	/**
133
-	 * @inheritdoc
134
-	 */
135
-	public function getId() {
136
-		return $this->id;
137
-	}
138
-
139
-	/**
140
-	 * @inheritdoc
141
-	 */
142
-	public function getFullId() {
143
-		if ($this->providerId === null || $this->id === null) {
144
-			throw new \UnexpectedValueException;
145
-		}
146
-		return $this->providerId . ':' . $this->id;
147
-	}
148
-
149
-	/**
150
-	 * @inheritdoc
151
-	 */
152
-	public function setProviderId($id) {
153
-		if (!is_string($id)) {
154
-			throw new \InvalidArgumentException('String expected.');
155
-		}
156
-
157
-		if ($this->providerId !== null) {
158
-			throw new IllegalIDChangeException('Not allowed to assign a new provider id to a share');
159
-		}
160
-
161
-		$this->providerId = trim($id);
162
-		return $this;
163
-	}
164
-
165
-	/**
166
-	 * @inheritdoc
167
-	 */
168
-	public function setNode(Node $node) {
169
-		$this->fileId = null;
170
-		$this->nodeType = null;
171
-		$this->node = $node;
172
-		return $this;
173
-	}
174
-
175
-	/**
176
-	 * @inheritdoc
177
-	 */
178
-	public function getNode() {
179
-		if ($this->node === null) {
180
-			if ($this->shareOwner === null || $this->fileId === null) {
181
-				throw new NotFoundException();
182
-			}
183
-
184
-			// for federated shares the owner can be a remote user, in this
185
-			// case we use the initiator
186
-			if ($this->userManager->userExists($this->shareOwner)) {
187
-				$userFolder = $this->rootFolder->getUserFolder($this->shareOwner);
188
-			} else {
189
-				$userFolder = $this->rootFolder->getUserFolder($this->sharedBy);
190
-			}
191
-
192
-			$nodes = $userFolder->getById($this->fileId);
193
-			if (empty($nodes)) {
194
-				throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
195
-			}
196
-
197
-			$this->node = $nodes[0];
198
-		}
199
-
200
-		return $this->node;
201
-	}
202
-
203
-	/**
204
-	 * @inheritdoc
205
-	 */
206
-	public function setNodeId($fileId) {
207
-		$this->node = null;
208
-		$this->fileId = $fileId;
209
-		return $this;
210
-	}
211
-
212
-	/**
213
-	 * @inheritdoc
214
-	 */
215
-	public function getNodeId() {
216
-		if ($this->fileId === null) {
217
-			$this->fileId = $this->getNode()->getId();
218
-		}
219
-
220
-		return $this->fileId;
221
-	}
222
-
223
-	/**
224
-	 * @inheritdoc
225
-	 */
226
-	public function setNodeType($type) {
227
-		if ($type !== 'file' && $type !== 'folder') {
228
-			throw new \InvalidArgumentException();
229
-		}
230
-
231
-		$this->nodeType = $type;
232
-		return $this;
233
-	}
234
-
235
-	/**
236
-	 * @inheritdoc
237
-	 */
238
-	public function getNodeType() {
239
-		if ($this->nodeType === null) {
240
-			if ($this->getNodeCacheEntry()) {
241
-				$info = $this->getNodeCacheEntry();
242
-				$this->nodeType = $info->getMimeType() === FileInfo::MIMETYPE_FOLDER ? 'folder' : 'file';
243
-			} else {
244
-				$node = $this->getNode();
245
-				$this->nodeType = $node instanceof File ? 'file' : 'folder';
246
-			}
247
-		}
248
-
249
-		return $this->nodeType;
250
-	}
251
-
252
-	/**
253
-	 * @inheritdoc
254
-	 */
255
-	public function setShareType($shareType) {
256
-		$this->shareType = $shareType;
257
-		return $this;
258
-	}
259
-
260
-	/**
261
-	 * @inheritdoc
262
-	 */
263
-	public function getShareType() {
264
-		return $this->shareType;
265
-	}
266
-
267
-	/**
268
-	 * @inheritdoc
269
-	 */
270
-	public function setSharedWith($sharedWith) {
271
-		if (!is_string($sharedWith)) {
272
-			throw new \InvalidArgumentException();
273
-		}
274
-		$this->sharedWith = $sharedWith;
275
-		return $this;
276
-	}
277
-
278
-	/**
279
-	 * @inheritdoc
280
-	 */
281
-	public function getSharedWith() {
282
-		return $this->sharedWith;
283
-	}
284
-
285
-	/**
286
-	 * @inheritdoc
287
-	 */
288
-	public function setSharedWithDisplayName($displayName) {
289
-		if (!is_string($displayName)) {
290
-			throw new \InvalidArgumentException();
291
-		}
292
-		$this->sharedWithDisplayName = $displayName;
293
-		return $this;
294
-	}
295
-
296
-	/**
297
-	 * @inheritdoc
298
-	 */
299
-	public function getSharedWithDisplayName() {
300
-		return $this->sharedWithDisplayName;
301
-	}
302
-
303
-	/**
304
-	 * @inheritdoc
305
-	 */
306
-	public function setSharedWithAvatar($src) {
307
-		if (!is_string($src)) {
308
-			throw new \InvalidArgumentException();
309
-		}
310
-		$this->sharedWithAvatar = $src;
311
-		return $this;
312
-	}
313
-
314
-	/**
315
-	 * @inheritdoc
316
-	 */
317
-	public function getSharedWithAvatar() {
318
-		return $this->sharedWithAvatar;
319
-	}
320
-
321
-	/**
322
-	 * @inheritdoc
323
-	 */
324
-	public function setPermissions($permissions) {
325
-		//TODO checks
326
-
327
-		$this->permissions = $permissions;
328
-		return $this;
329
-	}
330
-
331
-	/**
332
-	 * @inheritdoc
333
-	 */
334
-	public function getPermissions() {
335
-		return $this->permissions;
336
-	}
337
-
338
-	/**
339
-	 * @inheritdoc
340
-	 */
341
-	public function newAttributes(): IAttributes {
342
-		return new ShareAttributes();
343
-	}
344
-
345
-	/**
346
-	 * @inheritdoc
347
-	 */
348
-	public function setAttributes(?IAttributes $attributes) {
349
-		$this->attributes = $attributes;
350
-		return $this;
351
-	}
352
-
353
-	/**
354
-	 * @inheritdoc
355
-	 */
356
-	public function getAttributes(): ?IAttributes {
357
-		return $this->attributes;
358
-	}
359
-
360
-	/**
361
-	 * @inheritdoc
362
-	 */
363
-	public function setStatus(int $status): IShare {
364
-		$this->status = $status;
365
-		return $this;
366
-	}
367
-
368
-	/**
369
-	 * @inheritdoc
370
-	 */
371
-	public function getStatus(): int {
372
-		return $this->status;
373
-	}
374
-
375
-	/**
376
-	 * @inheritdoc
377
-	 */
378
-	public function setNote($note) {
379
-		$this->note = $note;
380
-		return $this;
381
-	}
382
-
383
-	/**
384
-	 * @inheritdoc
385
-	 */
386
-	public function getNote() {
387
-		if (is_string($this->note)) {
388
-			return $this->note;
389
-		}
390
-		return '';
391
-	}
392
-
393
-	/**
394
-	 * @inheritdoc
395
-	 */
396
-	public function setLabel($label) {
397
-		$this->label = $label;
398
-		return $this;
399
-	}
400
-
401
-	/**
402
-	 * @inheritdoc
403
-	 */
404
-	public function getLabel() {
405
-		return $this->label;
406
-	}
407
-
408
-	/**
409
-	 * @inheritdoc
410
-	 */
411
-	public function setExpirationDate($expireDate) {
412
-		//TODO checks
413
-
414
-		$this->expireDate = $expireDate;
415
-		return $this;
416
-	}
417
-
418
-	/**
419
-	 * @inheritdoc
420
-	 */
421
-	public function getExpirationDate() {
422
-		return $this->expireDate;
423
-	}
424
-
425
-	/**
426
-	 * @inheritdoc
427
-	 */
428
-	public function isExpired() {
429
-		return $this->getExpirationDate() !== null &&
430
-			$this->getExpirationDate() <= new \DateTime();
431
-	}
432
-
433
-	/**
434
-	 * @inheritdoc
435
-	 */
436
-	public function setSharedBy($sharedBy) {
437
-		if (!is_string($sharedBy)) {
438
-			throw new \InvalidArgumentException();
439
-		}
440
-		//TODO checks
441
-		$this->sharedBy = $sharedBy;
442
-
443
-		return $this;
444
-	}
445
-
446
-	/**
447
-	 * @inheritdoc
448
-	 */
449
-	public function getSharedBy() {
450
-		//TODO check if set
451
-		return $this->sharedBy;
452
-	}
453
-
454
-	/**
455
-	 * @inheritdoc
456
-	 */
457
-	public function setShareOwner($shareOwner) {
458
-		if (!is_string($shareOwner)) {
459
-			throw new \InvalidArgumentException();
460
-		}
461
-		//TODO checks
462
-
463
-		$this->shareOwner = $shareOwner;
464
-		return $this;
465
-	}
466
-
467
-	/**
468
-	 * @inheritdoc
469
-	 */
470
-	public function getShareOwner() {
471
-		//TODO check if set
472
-		return $this->shareOwner;
473
-	}
474
-
475
-	/**
476
-	 * @inheritdoc
477
-	 */
478
-	public function setPassword($password) {
479
-		$this->password = $password;
480
-		return $this;
481
-	}
482
-
483
-	/**
484
-	 * @inheritdoc
485
-	 */
486
-	public function getPassword() {
487
-		return $this->password;
488
-	}
489
-
490
-	/**
491
-	 * @inheritdoc
492
-	 */
493
-	public function setPasswordExpirationTime(?\DateTimeInterface $passwordExpirationTime = null): IShare {
494
-		$this->passwordExpirationTime = $passwordExpirationTime;
495
-		return $this;
496
-	}
497
-
498
-	/**
499
-	 * @inheritdoc
500
-	 */
501
-	public function getPasswordExpirationTime(): ?\DateTimeInterface {
502
-		return $this->passwordExpirationTime;
503
-	}
504
-
505
-	/**
506
-	 * @inheritdoc
507
-	 */
508
-	public function setSendPasswordByTalk(bool $sendPasswordByTalk) {
509
-		$this->sendPasswordByTalk = $sendPasswordByTalk;
510
-		return $this;
511
-	}
512
-
513
-	/**
514
-	 * @inheritdoc
515
-	 */
516
-	public function getSendPasswordByTalk(): bool {
517
-		return $this->sendPasswordByTalk;
518
-	}
519
-
520
-	/**
521
-	 * @inheritdoc
522
-	 */
523
-	public function setToken($token) {
524
-		$this->token = $token;
525
-		return $this;
526
-	}
527
-
528
-	/**
529
-	 * @inheritdoc
530
-	 */
531
-	public function getToken() {
532
-		return $this->token;
533
-	}
534
-
535
-	/**
536
-	 * Set the parent of this share
537
-	 *
538
-	 * @param int parent
539
-	 * @return IShare
540
-	 * @deprecated The new shares do not have parents. This is just here for legacy reasons.
541
-	 */
542
-	public function setParent($parent) {
543
-		$this->parent = $parent;
544
-		return $this;
545
-	}
546
-
547
-	/**
548
-	 * Get the parent of this share.
549
-	 *
550
-	 * @return int
551
-	 * @deprecated The new shares do not have parents. This is just here for legacy reasons.
552
-	 */
553
-	public function getParent() {
554
-		return $this->parent;
555
-	}
556
-
557
-	/**
558
-	 * @inheritdoc
559
-	 */
560
-	public function setTarget($target) {
561
-		$this->target = $target;
562
-		return $this;
563
-	}
564
-
565
-	/**
566
-	 * @inheritdoc
567
-	 */
568
-	public function getTarget() {
569
-		return $this->target;
570
-	}
571
-
572
-	/**
573
-	 * @inheritdoc
574
-	 */
575
-	public function setShareTime(\DateTime $shareTime) {
576
-		$this->shareTime = $shareTime;
577
-		return $this;
578
-	}
579
-
580
-	/**
581
-	 * @inheritdoc
582
-	 */
583
-	public function getShareTime() {
584
-		return $this->shareTime;
585
-	}
586
-
587
-	/**
588
-	 * @inheritdoc
589
-	 */
590
-	public function setMailSend($mailSend) {
591
-		$this->mailSend = $mailSend;
592
-		return $this;
593
-	}
594
-
595
-	/**
596
-	 * @inheritdoc
597
-	 */
598
-	public function getMailSend() {
599
-		return $this->mailSend;
600
-	}
601
-
602
-	/**
603
-	 * @inheritdoc
604
-	 */
605
-	public function setNodeCacheEntry(ICacheEntry $entry) {
606
-		$this->nodeCacheEntry = $entry;
607
-	}
608
-
609
-	/**
610
-	 * @inheritdoc
611
-	 */
612
-	public function getNodeCacheEntry() {
613
-		return $this->nodeCacheEntry;
614
-	}
615
-
616
-	public function setHideDownload(bool $hide): IShare {
617
-		$this->hideDownload = $hide;
618
-		return $this;
619
-	}
620
-
621
-	public function getHideDownload(): bool {
622
-		return $this->hideDownload;
623
-	}
45
+    /** @var string */
46
+    private $id;
47
+    /** @var string */
48
+    private $providerId;
49
+    /** @var Node */
50
+    private $node;
51
+    /** @var int */
52
+    private $fileId;
53
+    /** @var string */
54
+    private $nodeType;
55
+    /** @var int */
56
+    private $shareType;
57
+    /** @var string */
58
+    private $sharedWith;
59
+    /** @var string */
60
+    private $sharedWithDisplayName;
61
+    /** @var string */
62
+    private $sharedWithAvatar;
63
+    /** @var string */
64
+    private $sharedBy;
65
+    /** @var string */
66
+    private $shareOwner;
67
+    /** @var int */
68
+    private $permissions;
69
+    /** @var IAttributes */
70
+    private $attributes;
71
+    /** @var int */
72
+    private $status;
73
+    /** @var string */
74
+    private $note = '';
75
+    /** @var \DateTime */
76
+    private $expireDate;
77
+    /** @var string */
78
+    private $password;
79
+    private ?\DateTimeInterface $passwordExpirationTime = null;
80
+    /** @var bool */
81
+    private $sendPasswordByTalk = false;
82
+    /** @var string */
83
+    private $token;
84
+    /** @var int */
85
+    private $parent;
86
+    /** @var string */
87
+    private $target;
88
+    /** @var \DateTime */
89
+    private $shareTime;
90
+    /** @var bool */
91
+    private $mailSend;
92
+    /** @var string */
93
+    private $label = '';
94
+
95
+    /** @var IRootFolder */
96
+    private $rootFolder;
97
+
98
+    /** @var IUserManager */
99
+    private $userManager;
100
+
101
+    /** @var ICacheEntry|null */
102
+    private $nodeCacheEntry;
103
+
104
+    /** @var bool */
105
+    private $hideDownload = false;
106
+
107
+    public function __construct(IRootFolder $rootFolder, IUserManager $userManager) {
108
+        $this->rootFolder = $rootFolder;
109
+        $this->userManager = $userManager;
110
+    }
111
+
112
+    /**
113
+     * @inheritdoc
114
+     */
115
+    public function setId($id) {
116
+        if (is_int($id)) {
117
+            $id = (string)$id;
118
+        }
119
+
120
+        if (!is_string($id)) {
121
+            throw new \InvalidArgumentException('String expected.');
122
+        }
123
+
124
+        if ($this->id !== null) {
125
+            throw new IllegalIDChangeException('Not allowed to assign a new internal id to a share');
126
+        }
127
+
128
+        $this->id = trim($id);
129
+        return $this;
130
+    }
131
+
132
+    /**
133
+     * @inheritdoc
134
+     */
135
+    public function getId() {
136
+        return $this->id;
137
+    }
138
+
139
+    /**
140
+     * @inheritdoc
141
+     */
142
+    public function getFullId() {
143
+        if ($this->providerId === null || $this->id === null) {
144
+            throw new \UnexpectedValueException;
145
+        }
146
+        return $this->providerId . ':' . $this->id;
147
+    }
148
+
149
+    /**
150
+     * @inheritdoc
151
+     */
152
+    public function setProviderId($id) {
153
+        if (!is_string($id)) {
154
+            throw new \InvalidArgumentException('String expected.');
155
+        }
156
+
157
+        if ($this->providerId !== null) {
158
+            throw new IllegalIDChangeException('Not allowed to assign a new provider id to a share');
159
+        }
160
+
161
+        $this->providerId = trim($id);
162
+        return $this;
163
+    }
164
+
165
+    /**
166
+     * @inheritdoc
167
+     */
168
+    public function setNode(Node $node) {
169
+        $this->fileId = null;
170
+        $this->nodeType = null;
171
+        $this->node = $node;
172
+        return $this;
173
+    }
174
+
175
+    /**
176
+     * @inheritdoc
177
+     */
178
+    public function getNode() {
179
+        if ($this->node === null) {
180
+            if ($this->shareOwner === null || $this->fileId === null) {
181
+                throw new NotFoundException();
182
+            }
183
+
184
+            // for federated shares the owner can be a remote user, in this
185
+            // case we use the initiator
186
+            if ($this->userManager->userExists($this->shareOwner)) {
187
+                $userFolder = $this->rootFolder->getUserFolder($this->shareOwner);
188
+            } else {
189
+                $userFolder = $this->rootFolder->getUserFolder($this->sharedBy);
190
+            }
191
+
192
+            $nodes = $userFolder->getById($this->fileId);
193
+            if (empty($nodes)) {
194
+                throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
195
+            }
196
+
197
+            $this->node = $nodes[0];
198
+        }
199
+
200
+        return $this->node;
201
+    }
202
+
203
+    /**
204
+     * @inheritdoc
205
+     */
206
+    public function setNodeId($fileId) {
207
+        $this->node = null;
208
+        $this->fileId = $fileId;
209
+        return $this;
210
+    }
211
+
212
+    /**
213
+     * @inheritdoc
214
+     */
215
+    public function getNodeId() {
216
+        if ($this->fileId === null) {
217
+            $this->fileId = $this->getNode()->getId();
218
+        }
219
+
220
+        return $this->fileId;
221
+    }
222
+
223
+    /**
224
+     * @inheritdoc
225
+     */
226
+    public function setNodeType($type) {
227
+        if ($type !== 'file' && $type !== 'folder') {
228
+            throw new \InvalidArgumentException();
229
+        }
230
+
231
+        $this->nodeType = $type;
232
+        return $this;
233
+    }
234
+
235
+    /**
236
+     * @inheritdoc
237
+     */
238
+    public function getNodeType() {
239
+        if ($this->nodeType === null) {
240
+            if ($this->getNodeCacheEntry()) {
241
+                $info = $this->getNodeCacheEntry();
242
+                $this->nodeType = $info->getMimeType() === FileInfo::MIMETYPE_FOLDER ? 'folder' : 'file';
243
+            } else {
244
+                $node = $this->getNode();
245
+                $this->nodeType = $node instanceof File ? 'file' : 'folder';
246
+            }
247
+        }
248
+
249
+        return $this->nodeType;
250
+    }
251
+
252
+    /**
253
+     * @inheritdoc
254
+     */
255
+    public function setShareType($shareType) {
256
+        $this->shareType = $shareType;
257
+        return $this;
258
+    }
259
+
260
+    /**
261
+     * @inheritdoc
262
+     */
263
+    public function getShareType() {
264
+        return $this->shareType;
265
+    }
266
+
267
+    /**
268
+     * @inheritdoc
269
+     */
270
+    public function setSharedWith($sharedWith) {
271
+        if (!is_string($sharedWith)) {
272
+            throw new \InvalidArgumentException();
273
+        }
274
+        $this->sharedWith = $sharedWith;
275
+        return $this;
276
+    }
277
+
278
+    /**
279
+     * @inheritdoc
280
+     */
281
+    public function getSharedWith() {
282
+        return $this->sharedWith;
283
+    }
284
+
285
+    /**
286
+     * @inheritdoc
287
+     */
288
+    public function setSharedWithDisplayName($displayName) {
289
+        if (!is_string($displayName)) {
290
+            throw new \InvalidArgumentException();
291
+        }
292
+        $this->sharedWithDisplayName = $displayName;
293
+        return $this;
294
+    }
295
+
296
+    /**
297
+     * @inheritdoc
298
+     */
299
+    public function getSharedWithDisplayName() {
300
+        return $this->sharedWithDisplayName;
301
+    }
302
+
303
+    /**
304
+     * @inheritdoc
305
+     */
306
+    public function setSharedWithAvatar($src) {
307
+        if (!is_string($src)) {
308
+            throw new \InvalidArgumentException();
309
+        }
310
+        $this->sharedWithAvatar = $src;
311
+        return $this;
312
+    }
313
+
314
+    /**
315
+     * @inheritdoc
316
+     */
317
+    public function getSharedWithAvatar() {
318
+        return $this->sharedWithAvatar;
319
+    }
320
+
321
+    /**
322
+     * @inheritdoc
323
+     */
324
+    public function setPermissions($permissions) {
325
+        //TODO checks
326
+
327
+        $this->permissions = $permissions;
328
+        return $this;
329
+    }
330
+
331
+    /**
332
+     * @inheritdoc
333
+     */
334
+    public function getPermissions() {
335
+        return $this->permissions;
336
+    }
337
+
338
+    /**
339
+     * @inheritdoc
340
+     */
341
+    public function newAttributes(): IAttributes {
342
+        return new ShareAttributes();
343
+    }
344
+
345
+    /**
346
+     * @inheritdoc
347
+     */
348
+    public function setAttributes(?IAttributes $attributes) {
349
+        $this->attributes = $attributes;
350
+        return $this;
351
+    }
352
+
353
+    /**
354
+     * @inheritdoc
355
+     */
356
+    public function getAttributes(): ?IAttributes {
357
+        return $this->attributes;
358
+    }
359
+
360
+    /**
361
+     * @inheritdoc
362
+     */
363
+    public function setStatus(int $status): IShare {
364
+        $this->status = $status;
365
+        return $this;
366
+    }
367
+
368
+    /**
369
+     * @inheritdoc
370
+     */
371
+    public function getStatus(): int {
372
+        return $this->status;
373
+    }
374
+
375
+    /**
376
+     * @inheritdoc
377
+     */
378
+    public function setNote($note) {
379
+        $this->note = $note;
380
+        return $this;
381
+    }
382
+
383
+    /**
384
+     * @inheritdoc
385
+     */
386
+    public function getNote() {
387
+        if (is_string($this->note)) {
388
+            return $this->note;
389
+        }
390
+        return '';
391
+    }
392
+
393
+    /**
394
+     * @inheritdoc
395
+     */
396
+    public function setLabel($label) {
397
+        $this->label = $label;
398
+        return $this;
399
+    }
400
+
401
+    /**
402
+     * @inheritdoc
403
+     */
404
+    public function getLabel() {
405
+        return $this->label;
406
+    }
407
+
408
+    /**
409
+     * @inheritdoc
410
+     */
411
+    public function setExpirationDate($expireDate) {
412
+        //TODO checks
413
+
414
+        $this->expireDate = $expireDate;
415
+        return $this;
416
+    }
417
+
418
+    /**
419
+     * @inheritdoc
420
+     */
421
+    public function getExpirationDate() {
422
+        return $this->expireDate;
423
+    }
424
+
425
+    /**
426
+     * @inheritdoc
427
+     */
428
+    public function isExpired() {
429
+        return $this->getExpirationDate() !== null &&
430
+            $this->getExpirationDate() <= new \DateTime();
431
+    }
432
+
433
+    /**
434
+     * @inheritdoc
435
+     */
436
+    public function setSharedBy($sharedBy) {
437
+        if (!is_string($sharedBy)) {
438
+            throw new \InvalidArgumentException();
439
+        }
440
+        //TODO checks
441
+        $this->sharedBy = $sharedBy;
442
+
443
+        return $this;
444
+    }
445
+
446
+    /**
447
+     * @inheritdoc
448
+     */
449
+    public function getSharedBy() {
450
+        //TODO check if set
451
+        return $this->sharedBy;
452
+    }
453
+
454
+    /**
455
+     * @inheritdoc
456
+     */
457
+    public function setShareOwner($shareOwner) {
458
+        if (!is_string($shareOwner)) {
459
+            throw new \InvalidArgumentException();
460
+        }
461
+        //TODO checks
462
+
463
+        $this->shareOwner = $shareOwner;
464
+        return $this;
465
+    }
466
+
467
+    /**
468
+     * @inheritdoc
469
+     */
470
+    public function getShareOwner() {
471
+        //TODO check if set
472
+        return $this->shareOwner;
473
+    }
474
+
475
+    /**
476
+     * @inheritdoc
477
+     */
478
+    public function setPassword($password) {
479
+        $this->password = $password;
480
+        return $this;
481
+    }
482
+
483
+    /**
484
+     * @inheritdoc
485
+     */
486
+    public function getPassword() {
487
+        return $this->password;
488
+    }
489
+
490
+    /**
491
+     * @inheritdoc
492
+     */
493
+    public function setPasswordExpirationTime(?\DateTimeInterface $passwordExpirationTime = null): IShare {
494
+        $this->passwordExpirationTime = $passwordExpirationTime;
495
+        return $this;
496
+    }
497
+
498
+    /**
499
+     * @inheritdoc
500
+     */
501
+    public function getPasswordExpirationTime(): ?\DateTimeInterface {
502
+        return $this->passwordExpirationTime;
503
+    }
504
+
505
+    /**
506
+     * @inheritdoc
507
+     */
508
+    public function setSendPasswordByTalk(bool $sendPasswordByTalk) {
509
+        $this->sendPasswordByTalk = $sendPasswordByTalk;
510
+        return $this;
511
+    }
512
+
513
+    /**
514
+     * @inheritdoc
515
+     */
516
+    public function getSendPasswordByTalk(): bool {
517
+        return $this->sendPasswordByTalk;
518
+    }
519
+
520
+    /**
521
+     * @inheritdoc
522
+     */
523
+    public function setToken($token) {
524
+        $this->token = $token;
525
+        return $this;
526
+    }
527
+
528
+    /**
529
+     * @inheritdoc
530
+     */
531
+    public function getToken() {
532
+        return $this->token;
533
+    }
534
+
535
+    /**
536
+     * Set the parent of this share
537
+     *
538
+     * @param int parent
539
+     * @return IShare
540
+     * @deprecated The new shares do not have parents. This is just here for legacy reasons.
541
+     */
542
+    public function setParent($parent) {
543
+        $this->parent = $parent;
544
+        return $this;
545
+    }
546
+
547
+    /**
548
+     * Get the parent of this share.
549
+     *
550
+     * @return int
551
+     * @deprecated The new shares do not have parents. This is just here for legacy reasons.
552
+     */
553
+    public function getParent() {
554
+        return $this->parent;
555
+    }
556
+
557
+    /**
558
+     * @inheritdoc
559
+     */
560
+    public function setTarget($target) {
561
+        $this->target = $target;
562
+        return $this;
563
+    }
564
+
565
+    /**
566
+     * @inheritdoc
567
+     */
568
+    public function getTarget() {
569
+        return $this->target;
570
+    }
571
+
572
+    /**
573
+     * @inheritdoc
574
+     */
575
+    public function setShareTime(\DateTime $shareTime) {
576
+        $this->shareTime = $shareTime;
577
+        return $this;
578
+    }
579
+
580
+    /**
581
+     * @inheritdoc
582
+     */
583
+    public function getShareTime() {
584
+        return $this->shareTime;
585
+    }
586
+
587
+    /**
588
+     * @inheritdoc
589
+     */
590
+    public function setMailSend($mailSend) {
591
+        $this->mailSend = $mailSend;
592
+        return $this;
593
+    }
594
+
595
+    /**
596
+     * @inheritdoc
597
+     */
598
+    public function getMailSend() {
599
+        return $this->mailSend;
600
+    }
601
+
602
+    /**
603
+     * @inheritdoc
604
+     */
605
+    public function setNodeCacheEntry(ICacheEntry $entry) {
606
+        $this->nodeCacheEntry = $entry;
607
+    }
608
+
609
+    /**
610
+     * @inheritdoc
611
+     */
612
+    public function getNodeCacheEntry() {
613
+        return $this->nodeCacheEntry;
614
+    }
615
+
616
+    public function setHideDownload(bool $hide): IShare {
617
+        $this->hideDownload = $hide;
618
+        return $this;
619
+    }
620
+
621
+    public function getHideDownload(): bool {
622
+        return $this->hideDownload;
623
+    }
624 624
 }
Please login to merge, or discard this patch.
lib/private/CapabilitiesManager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 					$capabilities = array_replace_recursive($capabilities, $c->getCapabilities());
61 61
 				}
62 62
 			} else {
63
-				throw new \InvalidArgumentException('The given Capability (' . get_class($c) . ') does not implement the ICapability interface');
63
+				throw new \InvalidArgumentException('The given Capability ('.get_class($c).') does not implement the ICapability interface');
64 64
 			}
65 65
 		}
66 66
 
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -36,61 +36,61 @@
 block discarded – undo
36 36
 
37 37
 class CapabilitiesManager {
38 38
 
39
-	/** @var \Closure[] */
40
-	private $capabilities = [];
39
+    /** @var \Closure[] */
40
+    private $capabilities = [];
41 41
 
42
-	/** @var LoggerInterface */
43
-	private $logger;
42
+    /** @var LoggerInterface */
43
+    private $logger;
44 44
 
45
-	public function __construct(LoggerInterface $logger) {
46
-		$this->logger = $logger;
47
-	}
45
+    public function __construct(LoggerInterface $logger) {
46
+        $this->logger = $logger;
47
+    }
48 48
 
49
-	/**
50
-	 * Get an array of al the capabilities that are registered at this manager
51
-	 *
52
-	 * @param bool $public get public capabilities only
53
-	 * @throws \InvalidArgumentException
54
-	 * @return array
55
-	 */
56
-	public function getCapabilities(bool $public = false, bool $initialState = false) : array {
57
-		$capabilities = [];
58
-		foreach ($this->capabilities as $capability) {
59
-			try {
60
-				$c = $capability();
61
-			} catch (QueryException $e) {
62
-				$this->logger->error('CapabilitiesManager', [
63
-					'exception' => $e,
64
-				]);
65
-				continue;
66
-			}
49
+    /**
50
+     * Get an array of al the capabilities that are registered at this manager
51
+     *
52
+     * @param bool $public get public capabilities only
53
+     * @throws \InvalidArgumentException
54
+     * @return array
55
+     */
56
+    public function getCapabilities(bool $public = false, bool $initialState = false) : array {
57
+        $capabilities = [];
58
+        foreach ($this->capabilities as $capability) {
59
+            try {
60
+                $c = $capability();
61
+            } catch (QueryException $e) {
62
+                $this->logger->error('CapabilitiesManager', [
63
+                    'exception' => $e,
64
+                ]);
65
+                continue;
66
+            }
67 67
 
68
-			if ($c instanceof ICapability) {
69
-				if (!$public || $c instanceof IPublicCapability) {
70
-					if ($initialState && ($c instanceof IInitialStateExcludedCapability)) {
71
-						// Remove less important capabilities information that are expensive to query
72
-						// that we would otherwise inject to every page load
73
-						continue;
74
-					}
75
-					$capabilities = array_replace_recursive($capabilities, $c->getCapabilities());
76
-				}
77
-			} else {
78
-				throw new \InvalidArgumentException('The given Capability (' . get_class($c) . ') does not implement the ICapability interface');
79
-			}
80
-		}
68
+            if ($c instanceof ICapability) {
69
+                if (!$public || $c instanceof IPublicCapability) {
70
+                    if ($initialState && ($c instanceof IInitialStateExcludedCapability)) {
71
+                        // Remove less important capabilities information that are expensive to query
72
+                        // that we would otherwise inject to every page load
73
+                        continue;
74
+                    }
75
+                    $capabilities = array_replace_recursive($capabilities, $c->getCapabilities());
76
+                }
77
+            } else {
78
+                throw new \InvalidArgumentException('The given Capability (' . get_class($c) . ') does not implement the ICapability interface');
79
+            }
80
+        }
81 81
 
82
-		return $capabilities;
83
-	}
82
+        return $capabilities;
83
+    }
84 84
 
85
-	/**
86
-	 * In order to improve lazy loading a closure can be registered which will be called in case
87
-	 * capabilities are actually requested
88
-	 *
89
-	 * $callable has to return an instance of OCP\Capabilities\ICapability
90
-	 *
91
-	 * @param \Closure $callable
92
-	 */
93
-	public function registerCapability(\Closure $callable) {
94
-		$this->capabilities[] = $callable;
95
-	}
85
+    /**
86
+     * In order to improve lazy loading a closure can be registered which will be called in case
87
+     * capabilities are actually requested
88
+     *
89
+     * $callable has to return an instance of OCP\Capabilities\ICapability
90
+     *
91
+     * @param \Closure $callable
92
+     */
93
+    public function registerCapability(\Closure $callable) {
94
+        $this->capabilities[] = $callable;
95
+    }
96 96
 }
Please login to merge, or discard this patch.
lib/private/OCS/Result.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 	 * @return $this
136 136
 	 */
137 137
 	public function addHeader($name, $value) {
138
-		$name = trim($name);  // always remove leading and trailing whitespace
138
+		$name = trim($name); // always remove leading and trailing whitespace
139 139
 		// to be able to reliably check for security
140 140
 		// headers
141 141
 
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -33,127 +33,127 @@
 block discarded – undo
33 33
 
34 34
 class Result {
35 35
 
36
-	/** @var array  */
37
-	protected $data;
38
-
39
-	/** @var null|string */
40
-	protected $message;
41
-
42
-	/** @var int */
43
-	protected $statusCode;
44
-
45
-	/** @var integer */
46
-	protected $items;
47
-
48
-	/** @var integer */
49
-	protected $perPage;
50
-
51
-	/** @var array */
52
-	private $headers = [];
53
-
54
-	/**
55
-	 * create the OCS_Result object
56
-	 * @param mixed $data the data to return
57
-	 * @param int $code
58
-	 * @param null|string $message
59
-	 * @param array $headers
60
-	 */
61
-	public function __construct($data = null, $code = 100, $message = null, $headers = []) {
62
-		if ($data === null) {
63
-			$this->data = [];
64
-		} elseif (!is_array($data)) {
65
-			$this->data = [$this->data];
66
-		} else {
67
-			$this->data = $data;
68
-		}
69
-		$this->statusCode = $code;
70
-		$this->message = $message;
71
-		$this->headers = $headers;
72
-	}
73
-
74
-	/**
75
-	 * optionally set the total number of items available
76
-	 * @param int $items
77
-	 */
78
-	public function setTotalItems($items) {
79
-		$this->items = $items;
80
-	}
81
-
82
-	/**
83
-	 * optionally set the the number of items per page
84
-	 * @param int $items
85
-	 */
86
-	public function setItemsPerPage($items) {
87
-		$this->perPage = $items;
88
-	}
89
-
90
-	/**
91
-	 * get the status code
92
-	 * @return int
93
-	 */
94
-	public function getStatusCode() {
95
-		return $this->statusCode;
96
-	}
97
-
98
-	/**
99
-	 * get the meta data for the result
100
-	 * @return array
101
-	 */
102
-	public function getMeta() {
103
-		$meta = [];
104
-		$meta['status'] = $this->succeeded() ? 'ok' : 'failure';
105
-		$meta['statuscode'] = $this->statusCode;
106
-		$meta['message'] = $this->message;
107
-		if ($this->items !== null) {
108
-			$meta['totalitems'] = $this->items;
109
-		}
110
-		if ($this->perPage !== null) {
111
-			$meta['itemsperpage'] = $this->perPage;
112
-		}
113
-		return $meta;
114
-	}
115
-
116
-	/**
117
-	 * get the result data
118
-	 * @return array
119
-	 */
120
-	public function getData() {
121
-		return $this->data;
122
-	}
123
-
124
-	/**
125
-	 * return bool Whether the method succeeded
126
-	 * @return bool
127
-	 */
128
-	public function succeeded() {
129
-		return ($this->statusCode == 100);
130
-	}
131
-
132
-	/**
133
-	 * Adds a new header to the response
134
-	 * @param string $name The name of the HTTP header
135
-	 * @param string $value The value, null will delete it
136
-	 * @return $this
137
-	 */
138
-	public function addHeader($name, $value) {
139
-		$name = trim($name);  // always remove leading and trailing whitespace
140
-		// to be able to reliably check for security
141
-		// headers
142
-
143
-		if (is_null($value)) {
144
-			unset($this->headers[$name]);
145
-		} else {
146
-			$this->headers[$name] = $value;
147
-		}
148
-
149
-		return $this;
150
-	}
151
-
152
-	/**
153
-	 * Returns the set headers
154
-	 * @return array the headers
155
-	 */
156
-	public function getHeaders() {
157
-		return $this->headers;
158
-	}
36
+    /** @var array  */
37
+    protected $data;
38
+
39
+    /** @var null|string */
40
+    protected $message;
41
+
42
+    /** @var int */
43
+    protected $statusCode;
44
+
45
+    /** @var integer */
46
+    protected $items;
47
+
48
+    /** @var integer */
49
+    protected $perPage;
50
+
51
+    /** @var array */
52
+    private $headers = [];
53
+
54
+    /**
55
+     * create the OCS_Result object
56
+     * @param mixed $data the data to return
57
+     * @param int $code
58
+     * @param null|string $message
59
+     * @param array $headers
60
+     */
61
+    public function __construct($data = null, $code = 100, $message = null, $headers = []) {
62
+        if ($data === null) {
63
+            $this->data = [];
64
+        } elseif (!is_array($data)) {
65
+            $this->data = [$this->data];
66
+        } else {
67
+            $this->data = $data;
68
+        }
69
+        $this->statusCode = $code;
70
+        $this->message = $message;
71
+        $this->headers = $headers;
72
+    }
73
+
74
+    /**
75
+     * optionally set the total number of items available
76
+     * @param int $items
77
+     */
78
+    public function setTotalItems($items) {
79
+        $this->items = $items;
80
+    }
81
+
82
+    /**
83
+     * optionally set the the number of items per page
84
+     * @param int $items
85
+     */
86
+    public function setItemsPerPage($items) {
87
+        $this->perPage = $items;
88
+    }
89
+
90
+    /**
91
+     * get the status code
92
+     * @return int
93
+     */
94
+    public function getStatusCode() {
95
+        return $this->statusCode;
96
+    }
97
+
98
+    /**
99
+     * get the meta data for the result
100
+     * @return array
101
+     */
102
+    public function getMeta() {
103
+        $meta = [];
104
+        $meta['status'] = $this->succeeded() ? 'ok' : 'failure';
105
+        $meta['statuscode'] = $this->statusCode;
106
+        $meta['message'] = $this->message;
107
+        if ($this->items !== null) {
108
+            $meta['totalitems'] = $this->items;
109
+        }
110
+        if ($this->perPage !== null) {
111
+            $meta['itemsperpage'] = $this->perPage;
112
+        }
113
+        return $meta;
114
+    }
115
+
116
+    /**
117
+     * get the result data
118
+     * @return array
119
+     */
120
+    public function getData() {
121
+        return $this->data;
122
+    }
123
+
124
+    /**
125
+     * return bool Whether the method succeeded
126
+     * @return bool
127
+     */
128
+    public function succeeded() {
129
+        return ($this->statusCode == 100);
130
+    }
131
+
132
+    /**
133
+     * Adds a new header to the response
134
+     * @param string $name The name of the HTTP header
135
+     * @param string $value The value, null will delete it
136
+     * @return $this
137
+     */
138
+    public function addHeader($name, $value) {
139
+        $name = trim($name);  // always remove leading and trailing whitespace
140
+        // to be able to reliably check for security
141
+        // headers
142
+
143
+        if (is_null($value)) {
144
+            unset($this->headers[$name]);
145
+        } else {
146
+            $this->headers[$name] = $value;
147
+        }
148
+
149
+        return $this;
150
+    }
151
+
152
+    /**
153
+     * Returns the set headers
154
+     * @return array the headers
155
+     */
156
+    public function getHeaders() {
157
+        return $this->headers;
158
+    }
159 159
 }
Please login to merge, or discard this patch.
lib/private/Files/Storage/CommonTest.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -33,53 +33,53 @@
 block discarded – undo
33 33
 namespace OC\Files\Storage;
34 34
 
35 35
 class CommonTest extends \OC\Files\Storage\Common {
36
-	/**
37
-	 * underlying local storage used for missing functions
38
-	 * @var \OC\Files\Storage\Local
39
-	 */
40
-	private $storage;
36
+    /**
37
+     * underlying local storage used for missing functions
38
+     * @var \OC\Files\Storage\Local
39
+     */
40
+    private $storage;
41 41
 
42
-	public function __construct($params) {
43
-		$this->storage = new \OC\Files\Storage\Local($params);
44
-	}
42
+    public function __construct($params) {
43
+        $this->storage = new \OC\Files\Storage\Local($params);
44
+    }
45 45
 
46
-	public function getId() {
47
-		return 'test::'.$this->storage->getId();
48
-	}
49
-	public function mkdir($path) {
50
-		return $this->storage->mkdir($path);
51
-	}
52
-	public function rmdir($path) {
53
-		return $this->storage->rmdir($path);
54
-	}
55
-	public function opendir($path) {
56
-		return $this->storage->opendir($path);
57
-	}
58
-	public function stat($path) {
59
-		return $this->storage->stat($path);
60
-	}
61
-	public function filetype($path) {
62
-		return @$this->storage->filetype($path);
63
-	}
64
-	public function isReadable($path) {
65
-		return $this->storage->isReadable($path);
66
-	}
67
-	public function isUpdatable($path) {
68
-		return $this->storage->isUpdatable($path);
69
-	}
70
-	public function file_exists($path) {
71
-		return $this->storage->file_exists($path);
72
-	}
73
-	public function unlink($path) {
74
-		return $this->storage->unlink($path);
75
-	}
76
-	public function fopen($path, $mode) {
77
-		return $this->storage->fopen($path, $mode);
78
-	}
79
-	public function free_space($path) {
80
-		return $this->storage->free_space($path);
81
-	}
82
-	public function touch($path, $mtime = null) {
83
-		return $this->storage->touch($path, $mtime);
84
-	}
46
+    public function getId() {
47
+        return 'test::'.$this->storage->getId();
48
+    }
49
+    public function mkdir($path) {
50
+        return $this->storage->mkdir($path);
51
+    }
52
+    public function rmdir($path) {
53
+        return $this->storage->rmdir($path);
54
+    }
55
+    public function opendir($path) {
56
+        return $this->storage->opendir($path);
57
+    }
58
+    public function stat($path) {
59
+        return $this->storage->stat($path);
60
+    }
61
+    public function filetype($path) {
62
+        return @$this->storage->filetype($path);
63
+    }
64
+    public function isReadable($path) {
65
+        return $this->storage->isReadable($path);
66
+    }
67
+    public function isUpdatable($path) {
68
+        return $this->storage->isUpdatable($path);
69
+    }
70
+    public function file_exists($path) {
71
+        return $this->storage->file_exists($path);
72
+    }
73
+    public function unlink($path) {
74
+        return $this->storage->unlink($path);
75
+    }
76
+    public function fopen($path, $mode) {
77
+        return $this->storage->fopen($path, $mode);
78
+    }
79
+    public function free_space($path) {
80
+        return $this->storage->free_space($path);
81
+    }
82
+    public function touch($path, $mtime = null) {
83
+        return $this->storage->touch($path, $mtime);
84
+    }
85 85
 }
Please login to merge, or discard this patch.