Passed
Push — master ( c5c14d...18b673 )
by Morris
10:52 queued 10s
created
apps/files/lib/Activity/Settings/FileDeleted.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class FileDeleted implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'file_deleted';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'file_deleted';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('A file or folder has been <strong>deleted</strong>');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('A file or folder has been <strong>deleted</strong>');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 3;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 3;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
apps/files/lib/Activity/Settings/FileRestored.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class FileRestored implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'file_restored';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'file_restored';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('A file or folder has been <strong>restored</strong>');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('A file or folder has been <strong>restored</strong>');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 4;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 4;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
lib/public/AppFramework/Controller.php 1 patch
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -44,116 +44,116 @@
 block discarded – undo
44 44
  */
45 45
 abstract class Controller {
46 46
 
47
-	/**
48
-	 * app name
49
-	 * @var string
50
-	 * @since 7.0.0
51
-	 */
52
-	protected $appName;
53
-
54
-	/**
55
-	 * current request
56
-	 * @var \OCP\IRequest
57
-	 * @since 6.0.0
58
-	 */
59
-	protected $request;
60
-
61
-	/**
62
-	 * @var array
63
-	 * @since 7.0.0
64
-	 */
65
-	private $responders;
66
-
67
-	/**
68
-	 * constructor of the controller
69
-	 * @param string $appName the name of the app
70
-	 * @param IRequest $request an instance of the request
71
-	 * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0
72
-	 */
73
-	public function __construct($appName,
74
-	                            IRequest $request) {
75
-		$this->appName = $appName;
76
-		$this->request = $request;
77
-
78
-		// default responders
79
-		$this->responders = array(
80
-			'json' => function ($data) {
81
-				if ($data instanceof DataResponse) {
82
-					$response = new JSONResponse(
83
-						$data->getData(),
84
-						$data->getStatus()
85
-					);
86
-					$dataHeaders = $data->getHeaders();
87
-					$headers = $response->getHeaders();
88
-					// do not overwrite Content-Type if it already exists
89
-					if (isset($dataHeaders['Content-Type'])) {
90
-						unset($headers['Content-Type']);
91
-					}
92
-					$response->setHeaders(array_merge($dataHeaders, $headers));
93
-					return $response;
94
-				}
95
-				return new JSONResponse($data);
96
-			}
97
-		);
98
-	}
99
-
100
-
101
-	/**
102
-	 * Parses an HTTP accept header and returns the supported responder type
103
-	 * @param string $acceptHeader
104
-	 * @param string $default
105
-	 * @return string the responder type
106
-	 * @since 7.0.0
107
-	 * @since 9.1.0 Added default parameter
108
-	 */
109
-	public function getResponderByHTTPHeader($acceptHeader, $default='json') {
110
-		$headers = explode(',', $acceptHeader);
111
-
112
-		// return the first matching responder
113
-		foreach ($headers as $header) {
114
-			$header = strtolower(trim($header));
115
-
116
-			$responder = str_replace('application/', '', $header);
117
-
118
-			if (array_key_exists($responder, $this->responders)) {
119
-				return $responder;
120
-			}
121
-		}
122
-
123
-		// no matching header return default
124
-		return $default;
125
-	}
126
-
127
-
128
-	/**
129
-	 * Registers a formatter for a type
130
-	 * @param string $format
131
-	 * @param \Closure $responder
132
-	 * @since 7.0.0
133
-	 */
134
-	protected function registerResponder($format, \Closure $responder) {
135
-		$this->responders[$format] = $responder;
136
-	}
137
-
138
-
139
-	/**
140
-	 * Serializes and formats a response
141
-	 * @param mixed $response the value that was returned from a controller and
142
-	 * is not a Response instance
143
-	 * @param string $format the format for which a formatter has been registered
144
-	 * @throws \DomainException if format does not match a registered formatter
145
-	 * @return Response
146
-	 * @since 7.0.0
147
-	 */
148
-	public function buildResponse($response, $format='json') {
149
-		if(array_key_exists($format, $this->responders)) {
150
-
151
-			$responder = $this->responders[$format];
152
-
153
-			return $responder($response);
154
-
155
-		}
156
-		throw new \DomainException('No responder registered for format '.
157
-			$format . '!');
158
-	}
47
+    /**
48
+     * app name
49
+     * @var string
50
+     * @since 7.0.0
51
+     */
52
+    protected $appName;
53
+
54
+    /**
55
+     * current request
56
+     * @var \OCP\IRequest
57
+     * @since 6.0.0
58
+     */
59
+    protected $request;
60
+
61
+    /**
62
+     * @var array
63
+     * @since 7.0.0
64
+     */
65
+    private $responders;
66
+
67
+    /**
68
+     * constructor of the controller
69
+     * @param string $appName the name of the app
70
+     * @param IRequest $request an instance of the request
71
+     * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0
72
+     */
73
+    public function __construct($appName,
74
+                                IRequest $request) {
75
+        $this->appName = $appName;
76
+        $this->request = $request;
77
+
78
+        // default responders
79
+        $this->responders = array(
80
+            'json' => function ($data) {
81
+                if ($data instanceof DataResponse) {
82
+                    $response = new JSONResponse(
83
+                        $data->getData(),
84
+                        $data->getStatus()
85
+                    );
86
+                    $dataHeaders = $data->getHeaders();
87
+                    $headers = $response->getHeaders();
88
+                    // do not overwrite Content-Type if it already exists
89
+                    if (isset($dataHeaders['Content-Type'])) {
90
+                        unset($headers['Content-Type']);
91
+                    }
92
+                    $response->setHeaders(array_merge($dataHeaders, $headers));
93
+                    return $response;
94
+                }
95
+                return new JSONResponse($data);
96
+            }
97
+        );
98
+    }
99
+
100
+
101
+    /**
102
+     * Parses an HTTP accept header and returns the supported responder type
103
+     * @param string $acceptHeader
104
+     * @param string $default
105
+     * @return string the responder type
106
+     * @since 7.0.0
107
+     * @since 9.1.0 Added default parameter
108
+     */
109
+    public function getResponderByHTTPHeader($acceptHeader, $default='json') {
110
+        $headers = explode(',', $acceptHeader);
111
+
112
+        // return the first matching responder
113
+        foreach ($headers as $header) {
114
+            $header = strtolower(trim($header));
115
+
116
+            $responder = str_replace('application/', '', $header);
117
+
118
+            if (array_key_exists($responder, $this->responders)) {
119
+                return $responder;
120
+            }
121
+        }
122
+
123
+        // no matching header return default
124
+        return $default;
125
+    }
126
+
127
+
128
+    /**
129
+     * Registers a formatter for a type
130
+     * @param string $format
131
+     * @param \Closure $responder
132
+     * @since 7.0.0
133
+     */
134
+    protected function registerResponder($format, \Closure $responder) {
135
+        $this->responders[$format] = $responder;
136
+    }
137
+
138
+
139
+    /**
140
+     * Serializes and formats a response
141
+     * @param mixed $response the value that was returned from a controller and
142
+     * is not a Response instance
143
+     * @param string $format the format for which a formatter has been registered
144
+     * @throws \DomainException if format does not match a registered formatter
145
+     * @return Response
146
+     * @since 7.0.0
147
+     */
148
+    public function buildResponse($response, $format='json') {
149
+        if(array_key_exists($format, $this->responders)) {
150
+
151
+            $responder = $this->responders[$format];
152
+
153
+            return $responder($response);
154
+
155
+        }
156
+        throw new \DomainException('No responder registered for format '.
157
+            $format . '!');
158
+    }
159 159
 }
Please login to merge, or discard this patch.
apps/dav/appinfo/v1/publicwebdav.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 
39 39
 // Backends
40 40
 $authBackend = new OCA\DAV\Connector\PublicAuth(
41
-	\OC::$server->getRequest(),
42
-	\OC::$server->getShareManager(),
43
-	\OC::$server->getSession()
41
+    \OC::$server->getRequest(),
42
+    \OC::$server->getShareManager(),
43
+    \OC::$server->getSession()
44 44
 );
45 45
 $authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend);
46 46
 
47 47
 $serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory(
48
-	\OC::$server->getConfig(),
49
-	\OC::$server->getLogger(),
50
-	\OC::$server->getDatabaseConnection(),
51
-	\OC::$server->getUserSession(),
52
-	\OC::$server->getMountManager(),
53
-	\OC::$server->getTagManager(),
54
-	\OC::$server->getRequest(),
55
-	\OC::$server->getPreviewManager()
48
+    \OC::$server->getConfig(),
49
+    \OC::$server->getLogger(),
50
+    \OC::$server->getDatabaseConnection(),
51
+    \OC::$server->getUserSession(),
52
+    \OC::$server->getMountManager(),
53
+    \OC::$server->getTagManager(),
54
+    \OC::$server->getRequest(),
55
+    \OC::$server->getPreviewManager()
56 56
 );
57 57
 
58 58
 $requestUri = \OC::$server->getRequest()->getRequestUri();
@@ -61,43 +61,43 @@  discard block
 block discarded – undo
61 61
 $filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin();
62 62
 
63 63
 $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) {
64
-	$isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
65
-	$federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
66
-	$federatedShareProvider = $federatedSharingApp->getFederatedShareProvider();
67
-	if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {
68
-		// this is what is thrown when trying to access a non-existing share
69
-		throw new \Sabre\DAV\Exception\NotAuthenticated();
70
-	}
71
-
72
-	$share = $authBackend->getShare();
73
-	$owner = $share->getShareOwner();
74
-	$isReadable = $share->getPermissions() & \OCP\Constants::PERMISSION_READ;
75
-	$fileId = $share->getNodeId();
76
-
77
-	// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
78
-	$previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
79
-	\OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
80
-		return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE));
81
-	});
82
-
83
-	\OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
84
-
85
-	OC_Util::tearDownFS();
86
-	OC_Util::setupFS($owner);
87
-	$ownerView = new \OC\Files\View('/'. $owner . '/files');
88
-	$path = $ownerView->getPath($fileId);
89
-	$fileInfo = $ownerView->getFileInfo($path);
90
-	$linkCheckPlugin->setFileInfo($fileInfo);
91
-
92
-	// If not readble (files_drop) enable the filesdrop plugin
93
-	if (!$isReadable) {
94
-		$filesDropPlugin->enable();
95
-	}
96
-
97
-	$view = new \OC\Files\View($ownerView->getAbsolutePath($path));
98
-	$filesDropPlugin->setView($view);
99
-
100
-	return $view;
64
+    $isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
65
+    $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
66
+    $federatedShareProvider = $federatedSharingApp->getFederatedShareProvider();
67
+    if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {
68
+        // this is what is thrown when trying to access a non-existing share
69
+        throw new \Sabre\DAV\Exception\NotAuthenticated();
70
+    }
71
+
72
+    $share = $authBackend->getShare();
73
+    $owner = $share->getShareOwner();
74
+    $isReadable = $share->getPermissions() & \OCP\Constants::PERMISSION_READ;
75
+    $fileId = $share->getNodeId();
76
+
77
+    // FIXME: should not add storage wrappers outside of preSetup, need to find a better way
78
+    $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
79
+    \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
80
+        return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE));
81
+    });
82
+
83
+    \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
84
+
85
+    OC_Util::tearDownFS();
86
+    OC_Util::setupFS($owner);
87
+    $ownerView = new \OC\Files\View('/'. $owner . '/files');
88
+    $path = $ownerView->getPath($fileId);
89
+    $fileInfo = $ownerView->getFileInfo($path);
90
+    $linkCheckPlugin->setFileInfo($fileInfo);
91
+
92
+    // If not readble (files_drop) enable the filesdrop plugin
93
+    if (!$isReadable) {
94
+        $filesDropPlugin->enable();
95
+    }
96
+
97
+    $view = new \OC\Files\View($ownerView->getAbsolutePath($path));
98
+    $filesDropPlugin->setView($view);
99
+
100
+    return $view;
101 101
 });
102 102
 
103 103
 $server->addPlugin($linkCheckPlugin);
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/QuoteHelper.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -27,55 +27,55 @@
 block discarded – undo
27 27
 use OCP\DB\QueryBuilder\IQueryFunction;
28 28
 
29 29
 class QuoteHelper {
30
-	/**
31
-	 * @param array|string|ILiteral|IParameter|IQueryFunction $strings string, Literal or Parameter
32
-	 * @return array|string
33
-	 */
34
-	public function quoteColumnNames($strings) {
35
-		if (!is_array($strings)) {
36
-			return $this->quoteColumnName($strings);
37
-		}
30
+    /**
31
+     * @param array|string|ILiteral|IParameter|IQueryFunction $strings string, Literal or Parameter
32
+     * @return array|string
33
+     */
34
+    public function quoteColumnNames($strings) {
35
+        if (!is_array($strings)) {
36
+            return $this->quoteColumnName($strings);
37
+        }
38 38
 
39
-		$return = [];
40
-		foreach ($strings as $string) {
41
-			$return[] = $this->quoteColumnName($string);
42
-		}
39
+        $return = [];
40
+        foreach ($strings as $string) {
41
+            $return[] = $this->quoteColumnName($string);
42
+        }
43 43
 
44
-		return $return;
45
-	}
44
+        return $return;
45
+    }
46 46
 
47
-	/**
48
-	 * @param string|ILiteral|IParameter|IQueryFunction $string string, Literal or Parameter
49
-	 * @return string
50
-	 */
51
-	public function quoteColumnName($string) {
52
-		if ($string instanceof IParameter || $string instanceof ILiteral || $string instanceof IQueryFunction) {
53
-			return (string) $string;
54
-		}
47
+    /**
48
+     * @param string|ILiteral|IParameter|IQueryFunction $string string, Literal or Parameter
49
+     * @return string
50
+     */
51
+    public function quoteColumnName($string) {
52
+        if ($string instanceof IParameter || $string instanceof ILiteral || $string instanceof IQueryFunction) {
53
+            return (string) $string;
54
+        }
55 55
 
56
-		if ($string === null || $string === 'null' || $string === '*') {
57
-			return $string;
58
-		}
56
+        if ($string === null || $string === 'null' || $string === '*') {
57
+            return $string;
58
+        }
59 59
 
60
-		if (!is_string($string)) {
61
-			throw new \InvalidArgumentException('Only strings, Literals and Parameters are allowed');
62
-		}
60
+        if (!is_string($string)) {
61
+            throw new \InvalidArgumentException('Only strings, Literals and Parameters are allowed');
62
+        }
63 63
 
64
-		$string = str_replace(' AS ', ' as ', $string);
65
-		if (substr_count($string, ' as ')) {
66
-			return implode(' as ', array_map([$this, 'quoteColumnName'], explode(' as ', $string, 2)));
67
-		}
64
+        $string = str_replace(' AS ', ' as ', $string);
65
+        if (substr_count($string, ' as ')) {
66
+            return implode(' as ', array_map([$this, 'quoteColumnName'], explode(' as ', $string, 2)));
67
+        }
68 68
 
69
-		if (substr_count($string, '.')) {
70
-			list($alias, $columnName) = explode('.', $string, 2);
69
+        if (substr_count($string, '.')) {
70
+            list($alias, $columnName) = explode('.', $string, 2);
71 71
 
72
-			if ($columnName === '*') {
73
-				return '`' . $alias . '`.*';
74
-			}
72
+            if ($columnName === '*') {
73
+                return '`' . $alias . '`.*';
74
+            }
75 75
 
76
-			return '`' . $alias . '`.`' . $columnName . '`';
77
-		}
76
+            return '`' . $alias . '`.`' . $columnName . '`';
77
+        }
78 78
 
79
-		return '`' . $string . '`';
80
-	}
79
+        return '`' . $string . '`';
80
+    }
81 81
 }
Please login to merge, or discard this patch.
lib/private/Repair/OldGroupMembershipShares.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -31,89 +31,89 @@
 block discarded – undo
31 31
 
32 32
 class OldGroupMembershipShares implements IRepairStep {
33 33
 
34
-	/** @var \OCP\IDBConnection */
35
-	protected $connection;
36
-
37
-	/** @var \OCP\IGroupManager */
38
-	protected $groupManager;
39
-
40
-	/**
41
-	 * @var array [gid => [uid => (bool)]]
42
-	 */
43
-	protected $memberships;
44
-
45
-	/**
46
-	 * @param IDBConnection $connection
47
-	 * @param IGroupManager $groupManager
48
-	 */
49
-	public function __construct(IDBConnection $connection, IGroupManager $groupManager) {
50
-		$this->connection = $connection;
51
-		$this->groupManager = $groupManager;
52
-	}
53
-
54
-	/**
55
-	 * Returns the step's name
56
-	 *
57
-	 * @return string
58
-	 */
59
-	public function getName() {
60
-		return 'Remove shares of old group memberships';
61
-	}
62
-
63
-	/**
64
-	 * Run repair step.
65
-	 * Must throw exception on error.
66
-	 *
67
-	 * @throws \Exception in case of failure
68
-	 * @suppress SqlInjectionChecker
69
-	 */
70
-	public function run(IOutput $output) {
71
-		$deletedEntries = 0;
72
-
73
-		$query = $this->connection->getQueryBuilder();
74
-		$query->select('s1.id')->selectAlias('s1.share_with', 'user')->selectAlias('s2.share_with', 'group')
75
-			->from('share', 's1')
76
-			->where($query->expr()->isNotNull('s1.parent'))
77
-				// \OC\Share\Constant::$shareTypeGroupUserUnique === 2
78
-				->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2)))
79
-				->andWhere($query->expr()->isNotNull('s2.id'))
80
-				->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(Share::SHARE_TYPE_GROUP)))
81
-			->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'));
82
-
83
-		$deleteQuery = $this->connection->getQueryBuilder();
84
-		$deleteQuery->delete('share')
85
-			->where($query->expr()->eq('id', $deleteQuery->createParameter('share')));
86
-
87
-		$result = $query->execute();
88
-		while ($row = $result->fetch()) {
89
-			if (!$this->isMember($row['group'], $row['user'])) {
90
-				$deletedEntries += $deleteQuery->setParameter('share', (int) $row['id'])
91
-					->execute();
92
-			}
93
-		}
94
-		$result->closeCursor();
95
-
96
-		if ($deletedEntries) {
97
-			$output->info('Removed ' . $deletedEntries . ' shares where user is not a member of the group anymore');
98
-		}
99
-	}
100
-
101
-	/**
102
-	 * @param string $gid
103
-	 * @param string $uid
104
-	 * @return bool
105
-	 */
106
-	protected function isMember($gid, $uid) {
107
-		if (isset($this->memberships[$gid][$uid])) {
108
-			return $this->memberships[$gid][$uid];
109
-		}
110
-
111
-		$isMember = $this->groupManager->isInGroup($uid, $gid);
112
-		if (!isset($this->memberships[$gid])) {
113
-			$this->memberships[$gid] = [];
114
-		}
115
-		$this->memberships[$gid][$uid] = $isMember;
116
-
117
-		return $isMember;
118
-	}
34
+    /** @var \OCP\IDBConnection */
35
+    protected $connection;
36
+
37
+    /** @var \OCP\IGroupManager */
38
+    protected $groupManager;
39
+
40
+    /**
41
+     * @var array [gid => [uid => (bool)]]
42
+     */
43
+    protected $memberships;
44
+
45
+    /**
46
+     * @param IDBConnection $connection
47
+     * @param IGroupManager $groupManager
48
+     */
49
+    public function __construct(IDBConnection $connection, IGroupManager $groupManager) {
50
+        $this->connection = $connection;
51
+        $this->groupManager = $groupManager;
52
+    }
53
+
54
+    /**
55
+     * Returns the step's name
56
+     *
57
+     * @return string
58
+     */
59
+    public function getName() {
60
+        return 'Remove shares of old group memberships';
61
+    }
62
+
63
+    /**
64
+     * Run repair step.
65
+     * Must throw exception on error.
66
+     *
67
+     * @throws \Exception in case of failure
68
+     * @suppress SqlInjectionChecker
69
+     */
70
+    public function run(IOutput $output) {
71
+        $deletedEntries = 0;
72
+
73
+        $query = $this->connection->getQueryBuilder();
74
+        $query->select('s1.id')->selectAlias('s1.share_with', 'user')->selectAlias('s2.share_with', 'group')
75
+            ->from('share', 's1')
76
+            ->where($query->expr()->isNotNull('s1.parent'))
77
+                // \OC\Share\Constant::$shareTypeGroupUserUnique === 2
78
+                ->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2)))
79
+                ->andWhere($query->expr()->isNotNull('s2.id'))
80
+                ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(Share::SHARE_TYPE_GROUP)))
81
+            ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'));
82
+
83
+        $deleteQuery = $this->connection->getQueryBuilder();
84
+        $deleteQuery->delete('share')
85
+            ->where($query->expr()->eq('id', $deleteQuery->createParameter('share')));
86
+
87
+        $result = $query->execute();
88
+        while ($row = $result->fetch()) {
89
+            if (!$this->isMember($row['group'], $row['user'])) {
90
+                $deletedEntries += $deleteQuery->setParameter('share', (int) $row['id'])
91
+                    ->execute();
92
+            }
93
+        }
94
+        $result->closeCursor();
95
+
96
+        if ($deletedEntries) {
97
+            $output->info('Removed ' . $deletedEntries . ' shares where user is not a member of the group anymore');
98
+        }
99
+    }
100
+
101
+    /**
102
+     * @param string $gid
103
+     * @param string $uid
104
+     * @return bool
105
+     */
106
+    protected function isMember($gid, $uid) {
107
+        if (isset($this->memberships[$gid][$uid])) {
108
+            return $this->memberships[$gid][$uid];
109
+        }
110
+
111
+        $isMember = $this->groupManager->isInGroup($uid, $gid);
112
+        if (!isset($this->memberships[$gid])) {
113
+            $this->memberships[$gid] = [];
114
+        }
115
+        $this->memberships[$gid][$uid] = $isMember;
116
+
117
+        return $isMember;
118
+    }
119 119
 }
Please login to merge, or discard this patch.
lib/private/Repair/RepairInvalidShares.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -33,90 +33,90 @@
 block discarded – undo
33 33
  */
34 34
 class RepairInvalidShares implements IRepairStep {
35 35
 
36
-	const CHUNK_SIZE = 200;
37
-
38
-	/** @var \OCP\IConfig */
39
-	protected $config;
40
-
41
-	/** @var \OCP\IDBConnection */
42
-	protected $connection;
43
-
44
-	/**
45
-	 * @param \OCP\IConfig $config
46
-	 * @param \OCP\IDBConnection $connection
47
-	 */
48
-	public function __construct($config, $connection) {
49
-		$this->connection = $connection;
50
-		$this->config = $config;
51
-	}
52
-
53
-	public function getName() {
54
-		return 'Repair invalid shares';
55
-	}
56
-
57
-	/**
58
-	 * Adjust file share permissions
59
-	 * @suppress SqlInjectionChecker
60
-	 */
61
-	private function adjustFileSharePermissions(IOutput $out) {
62
-		$mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
63
-		$builder = $this->connection->getQueryBuilder();
64
-
65
-		$permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
66
-		$builder
67
-			->update('share')
68
-			->set('permissions', $permsFunc)
69
-			->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
70
-			->andWhere($builder->expr()->neq('permissions', $permsFunc));
71
-
72
-		$updatedEntries = $builder->execute();
73
-		if ($updatedEntries > 0) {
74
-			$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
75
-		}
76
-	}
77
-
78
-	/**
79
-	 * Remove shares where the parent share does not exist anymore
80
-	 */
81
-	private function removeSharesNonExistingParent(IOutput $out) {
82
-		$deletedEntries = 0;
83
-
84
-		$query = $this->connection->getQueryBuilder();
85
-		$query->select('s1.parent')
86
-			->from('share', 's1')
87
-			->where($query->expr()->isNotNull('s1.parent'))
88
-				->andWhere($query->expr()->isNull('s2.id'))
89
-			->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
90
-			->groupBy('s1.parent')
91
-			->setMaxResults(self::CHUNK_SIZE);
92
-
93
-		$deleteQuery = $this->connection->getQueryBuilder();
94
-		$deleteQuery->delete('share')
95
-			->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
96
-
97
-		$deletedInLastChunk = self::CHUNK_SIZE;
98
-		while ($deletedInLastChunk === self::CHUNK_SIZE) {
99
-			$deletedInLastChunk = 0;
100
-			$result = $query->execute();
101
-			while ($row = $result->fetch()) {
102
-				$deletedInLastChunk++;
103
-				$deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
104
-					->execute();
105
-			}
106
-			$result->closeCursor();
107
-		}
108
-
109
-		if ($deletedEntries) {
110
-			$out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
111
-		}
112
-	}
113
-
114
-	public function run(IOutput $out) {
115
-		$ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
116
-		if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
117
-			$this->adjustFileSharePermissions($out);
118
-		}
119
-
120
-		$this->removeSharesNonExistingParent($out);
121
-	}
36
+    const CHUNK_SIZE = 200;
37
+
38
+    /** @var \OCP\IConfig */
39
+    protected $config;
40
+
41
+    /** @var \OCP\IDBConnection */
42
+    protected $connection;
43
+
44
+    /**
45
+     * @param \OCP\IConfig $config
46
+     * @param \OCP\IDBConnection $connection
47
+     */
48
+    public function __construct($config, $connection) {
49
+        $this->connection = $connection;
50
+        $this->config = $config;
51
+    }
52
+
53
+    public function getName() {
54
+        return 'Repair invalid shares';
55
+    }
56
+
57
+    /**
58
+     * Adjust file share permissions
59
+     * @suppress SqlInjectionChecker
60
+     */
61
+    private function adjustFileSharePermissions(IOutput $out) {
62
+        $mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
63
+        $builder = $this->connection->getQueryBuilder();
64
+
65
+        $permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
66
+        $builder
67
+            ->update('share')
68
+            ->set('permissions', $permsFunc)
69
+            ->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
70
+            ->andWhere($builder->expr()->neq('permissions', $permsFunc));
71
+
72
+        $updatedEntries = $builder->execute();
73
+        if ($updatedEntries > 0) {
74
+            $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
75
+        }
76
+    }
77
+
78
+    /**
79
+     * Remove shares where the parent share does not exist anymore
80
+     */
81
+    private function removeSharesNonExistingParent(IOutput $out) {
82
+        $deletedEntries = 0;
83
+
84
+        $query = $this->connection->getQueryBuilder();
85
+        $query->select('s1.parent')
86
+            ->from('share', 's1')
87
+            ->where($query->expr()->isNotNull('s1.parent'))
88
+                ->andWhere($query->expr()->isNull('s2.id'))
89
+            ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
90
+            ->groupBy('s1.parent')
91
+            ->setMaxResults(self::CHUNK_SIZE);
92
+
93
+        $deleteQuery = $this->connection->getQueryBuilder();
94
+        $deleteQuery->delete('share')
95
+            ->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
96
+
97
+        $deletedInLastChunk = self::CHUNK_SIZE;
98
+        while ($deletedInLastChunk === self::CHUNK_SIZE) {
99
+            $deletedInLastChunk = 0;
100
+            $result = $query->execute();
101
+            while ($row = $result->fetch()) {
102
+                $deletedInLastChunk++;
103
+                $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
104
+                    ->execute();
105
+            }
106
+            $result->closeCursor();
107
+        }
108
+
109
+        if ($deletedEntries) {
110
+            $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
111
+        }
112
+    }
113
+
114
+    public function run(IOutput $out) {
115
+        $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
116
+        if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
117
+            $this->adjustFileSharePermissions($out);
118
+        }
119
+
120
+        $this->removeSharesNonExistingParent($out);
121
+    }
122 122
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Controller/RemoteController.php 1 patch
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -34,156 +34,156 @@
 block discarded – undo
34 34
 
35 35
 class RemoteController extends OCSController {
36 36
 
37
-	/** @var Manager */
38
-	private $externalManager;
39
-
40
-	/** @var ILogger */
41
-	private $logger;
42
-
43
-	/**
44
-	 * @NoAdminRequired
45
-	 *
46
-	 * Remote constructor.
47
-	 *
48
-	 * @param string $appName
49
-	 * @param IRequest $request
50
-	 * @param Manager $externalManager
51
-	 */
52
-	public function __construct($appName,
53
-								IRequest $request,
54
-								Manager $externalManager,
55
-								ILogger $logger) {
56
-		parent::__construct($appName, $request);
57
-
58
-		$this->externalManager = $externalManager;
59
-		$this->logger = $logger;
60
-	}
61
-
62
-	/**
63
-	 * @NoAdminRequired
64
-	 *
65
-	 * Get list of pending remote shares
66
-	 *
67
-	 * @return DataResponse
68
-	 */
69
-	public function getOpenShares() {
70
-		return new DataResponse($this->externalManager->getOpenShares());
71
-	}
72
-
73
-	/**
74
-	 * @NoAdminRequired
75
-	 *
76
-	 * Accept a remote share
77
-	 *
78
-	 * @param int $id
79
-	 * @return DataResponse
80
-	 * @throws OCSNotFoundException
81
-	 */
82
-	public function acceptShare($id) {
83
-		if ($this->externalManager->acceptShare($id)) {
84
-			return new DataResponse();
85
-		}
86
-
87
-		$this->logger->error('Could not accept federated share with id: ' . $id,
88
-			['app' => 'files_sharing']);
89
-
90
-		throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
91
-	}
92
-
93
-	/**
94
-	 * @NoAdminRequired
95
-	 *
96
-	 * Decline a remote share
97
-	 *
98
-	 * @param int $id
99
-	 * @return DataResponse
100
-	 * @throws OCSNotFoundException
101
-	 */
102
-	public function declineShare($id) {
103
-		if ($this->externalManager->declineShare($id)) {
104
-			return new DataResponse();
105
-		}
106
-
107
-		// Make sure the user has no notification for something that does not exist anymore.
108
-		$this->externalManager->processNotification($id);
109
-
110
-		throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
111
-	}
112
-
113
-	/**
114
-	 * @param array $share Share with info from the share_external table
115
-	 * @return array enriched share info with data from the filecache
116
-	 */
117
-	private static function extendShareInfo($share) {
118
-		$view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/');
119
-		$info = $view->getFileInfo($share['mountpoint']);
120
-
121
-		$share['mimetype'] = $info->getMimetype();
122
-		$share['mtime'] = $info->getMTime();
123
-		$share['permissions'] = $info->getPermissions();
124
-		$share['type'] = $info->getType();
125
-		$share['file_id'] = $info->getId();
126
-
127
-		return $share;
128
-	}
129
-
130
-	/**
131
-	 * @NoAdminRequired
132
-	 *
133
-	 * List accepted remote shares
134
-	 *
135
-	 * @return DataResponse
136
-	 */
137
-	public function getShares() {
138
-		$shares = $this->externalManager->getAcceptedShares();
139
-		$shares = array_map('self::extendShareInfo', $shares);
140
-
141
-		return new DataResponse($shares);
142
-	}
143
-
144
-	/**
145
-	 * @NoAdminRequired
146
-	 *
147
-	 * Get info of a remote share
148
-	 *
149
-	 * @param int $id
150
-	 * @return DataResponse
151
-	 * @throws OCSNotFoundException
152
-	 */
153
-	public function getShare($id) {
154
-		$shareInfo = $this->externalManager->getShare($id);
155
-
156
-		if ($shareInfo === false) {
157
-			throw new OCSNotFoundException('share does not exist');
158
-		} else {
159
-			$shareInfo = self::extendShareInfo($shareInfo);
160
-			return new DataResponse($shareInfo);
161
-		}
162
-	}
163
-
164
-	/**
165
-	 * @NoAdminRequired
166
-	 *
167
-	 * Unshare a remote share
168
-	 *
169
-	 * @param int $id
170
-	 * @return DataResponse
171
-	 * @throws OCSNotFoundException
172
-	 * @throws OCSForbiddenException
173
-	 */
174
-	public function unshare($id) {
175
-		$shareInfo = $this->externalManager->getShare($id);
176
-
177
-		if ($shareInfo === false) {
178
-			throw new OCSNotFoundException('Share does not exist');
179
-		}
180
-
181
-		$mountPoint = '/' . \OC_User::getUser() . '/files' . $shareInfo['mountpoint'];
182
-
183
-		if ($this->externalManager->removeShare($mountPoint) === true) {
184
-			return new DataResponse();
185
-		} else {
186
-			throw new OCSForbiddenException('Could not unshare');
187
-		}
188
-	}
37
+    /** @var Manager */
38
+    private $externalManager;
39
+
40
+    /** @var ILogger */
41
+    private $logger;
42
+
43
+    /**
44
+     * @NoAdminRequired
45
+     *
46
+     * Remote constructor.
47
+     *
48
+     * @param string $appName
49
+     * @param IRequest $request
50
+     * @param Manager $externalManager
51
+     */
52
+    public function __construct($appName,
53
+                                IRequest $request,
54
+                                Manager $externalManager,
55
+                                ILogger $logger) {
56
+        parent::__construct($appName, $request);
57
+
58
+        $this->externalManager = $externalManager;
59
+        $this->logger = $logger;
60
+    }
61
+
62
+    /**
63
+     * @NoAdminRequired
64
+     *
65
+     * Get list of pending remote shares
66
+     *
67
+     * @return DataResponse
68
+     */
69
+    public function getOpenShares() {
70
+        return new DataResponse($this->externalManager->getOpenShares());
71
+    }
72
+
73
+    /**
74
+     * @NoAdminRequired
75
+     *
76
+     * Accept a remote share
77
+     *
78
+     * @param int $id
79
+     * @return DataResponse
80
+     * @throws OCSNotFoundException
81
+     */
82
+    public function acceptShare($id) {
83
+        if ($this->externalManager->acceptShare($id)) {
84
+            return new DataResponse();
85
+        }
86
+
87
+        $this->logger->error('Could not accept federated share with id: ' . $id,
88
+            ['app' => 'files_sharing']);
89
+
90
+        throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
91
+    }
92
+
93
+    /**
94
+     * @NoAdminRequired
95
+     *
96
+     * Decline a remote share
97
+     *
98
+     * @param int $id
99
+     * @return DataResponse
100
+     * @throws OCSNotFoundException
101
+     */
102
+    public function declineShare($id) {
103
+        if ($this->externalManager->declineShare($id)) {
104
+            return new DataResponse();
105
+        }
106
+
107
+        // Make sure the user has no notification for something that does not exist anymore.
108
+        $this->externalManager->processNotification($id);
109
+
110
+        throw new OCSNotFoundException('wrong share ID, share doesn\'t exist.');
111
+    }
112
+
113
+    /**
114
+     * @param array $share Share with info from the share_external table
115
+     * @return array enriched share info with data from the filecache
116
+     */
117
+    private static function extendShareInfo($share) {
118
+        $view = new \OC\Files\View('/' . \OC_User::getUser() . '/files/');
119
+        $info = $view->getFileInfo($share['mountpoint']);
120
+
121
+        $share['mimetype'] = $info->getMimetype();
122
+        $share['mtime'] = $info->getMTime();
123
+        $share['permissions'] = $info->getPermissions();
124
+        $share['type'] = $info->getType();
125
+        $share['file_id'] = $info->getId();
126
+
127
+        return $share;
128
+    }
129
+
130
+    /**
131
+     * @NoAdminRequired
132
+     *
133
+     * List accepted remote shares
134
+     *
135
+     * @return DataResponse
136
+     */
137
+    public function getShares() {
138
+        $shares = $this->externalManager->getAcceptedShares();
139
+        $shares = array_map('self::extendShareInfo', $shares);
140
+
141
+        return new DataResponse($shares);
142
+    }
143
+
144
+    /**
145
+     * @NoAdminRequired
146
+     *
147
+     * Get info of a remote share
148
+     *
149
+     * @param int $id
150
+     * @return DataResponse
151
+     * @throws OCSNotFoundException
152
+     */
153
+    public function getShare($id) {
154
+        $shareInfo = $this->externalManager->getShare($id);
155
+
156
+        if ($shareInfo === false) {
157
+            throw new OCSNotFoundException('share does not exist');
158
+        } else {
159
+            $shareInfo = self::extendShareInfo($shareInfo);
160
+            return new DataResponse($shareInfo);
161
+        }
162
+    }
163
+
164
+    /**
165
+     * @NoAdminRequired
166
+     *
167
+     * Unshare a remote share
168
+     *
169
+     * @param int $id
170
+     * @return DataResponse
171
+     * @throws OCSNotFoundException
172
+     * @throws OCSForbiddenException
173
+     */
174
+    public function unshare($id) {
175
+        $shareInfo = $this->externalManager->getShare($id);
176
+
177
+        if ($shareInfo === false) {
178
+            throw new OCSNotFoundException('Share does not exist');
179
+        }
180
+
181
+        $mountPoint = '/' . \OC_User::getUser() . '/files' . $shareInfo['mountpoint'];
182
+
183
+        if ($this->externalManager->removeShare($mountPoint) === true) {
184
+            return new DataResponse();
185
+        } else {
186
+            throw new OCSForbiddenException('Could not unshare');
187
+        }
188
+    }
189 189
 }
Please login to merge, or discard this patch.
apps/testing/lib/AppInfo/Application.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@
 block discarded – undo
25 25
 use OCA\Testing\AlternativeHomeUserBackend;
26 26
 
27 27
 class Application extends App {
28
-	public function __construct (array $urlParams = array()) {
29
-		$appName = 'testing';
30
-		parent::__construct($appName, $urlParams);
28
+    public function __construct (array $urlParams = array()) {
29
+        $appName = 'testing';
30
+        parent::__construct($appName, $urlParams);
31 31
 
32
-		$c = $this->getContainer();
33
-		$config = $c->getServer()->getConfig();
34
-		if ($config->getAppValue($appName, 'enable_alt_user_backend', 'no') === 'yes') {
35
-			$userManager = $c->getServer()->getUserManager();
32
+        $c = $this->getContainer();
33
+        $config = $c->getServer()->getConfig();
34
+        if ($config->getAppValue($appName, 'enable_alt_user_backend', 'no') === 'yes') {
35
+            $userManager = $c->getServer()->getUserManager();
36 36
 
37
-			// replace all user backends with this one
38
-			$userManager->clearBackends();
39
-			$userManager->registerBackend($c->query(AlternativeHomeUserBackend::class));
40
-		}
41
-	}
37
+            // replace all user backends with this one
38
+            $userManager->clearBackends();
39
+            $userManager->registerBackend($c->query(AlternativeHomeUserBackend::class));
40
+        }
41
+    }
42 42
 }
Please login to merge, or discard this patch.