Completed
Push — master ( d2cc48...0dcb6b )
by Morris
37:29 queued 19:35
created
lib/public/Files/SimpleFS/ISimpleRoot.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -34,35 +34,35 @@
 block discarded – undo
34 34
  * @since 11.0.0
35 35
  */
36 36
 interface ISimpleRoot {
37
-	/**
38
-	 * Get the folder with name $name
39
-	 *
40
-	 * @param string $name
41
-	 * @return ISimpleFolder
42
-	 * @throws NotFoundException
43
-	 * @throws \RuntimeException
44
-	 * @since 11.0.0
45
-	 */
46
-	public function getFolder(string $name): ISimpleFolder;
37
+    /**
38
+     * Get the folder with name $name
39
+     *
40
+     * @param string $name
41
+     * @return ISimpleFolder
42
+     * @throws NotFoundException
43
+     * @throws \RuntimeException
44
+     * @since 11.0.0
45
+     */
46
+    public function getFolder(string $name): ISimpleFolder;
47 47
 
48
-	/**
49
-	 * Get all the Folders
50
-	 *
51
-	 * @return ISimpleFolder[]
52
-	 * @throws NotFoundException
53
-	 * @throws \RuntimeException
54
-	 * @since 11.0.0
55
-	 */
56
-	public function getDirectoryListing(): array;
48
+    /**
49
+     * Get all the Folders
50
+     *
51
+     * @return ISimpleFolder[]
52
+     * @throws NotFoundException
53
+     * @throws \RuntimeException
54
+     * @since 11.0.0
55
+     */
56
+    public function getDirectoryListing(): array;
57 57
 
58
-	/**
59
-	 * Create a new folder named $name
60
-	 *
61
-	 * @param string $name
62
-	 * @return ISimpleFolder
63
-	 * @throws NotPermittedException
64
-	 * @throws \RuntimeException
65
-	 * @since 11.0.0
66
-	 */
67
-	public function newFolder(string $name): ISimpleFolder;
58
+    /**
59
+     * Create a new folder named $name
60
+     *
61
+     * @param string $name
62
+     * @return ISimpleFolder
63
+     * @throws NotPermittedException
64
+     * @throws \RuntimeException
65
+     * @since 11.0.0
66
+     */
67
+    public function newFolder(string $name): ISimpleFolder;
68 68
 }
Please login to merge, or discard this patch.
lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
30 30
 
31 31
 class AddPreviewBackgroundCleanupJob implements IRepairStep {
32 32
 
33
-	/** @var IJobList */
34
-	private $jobList;
33
+    /** @var IJobList */
34
+    private $jobList;
35 35
 
36
-	public function __construct(IJobList $jobList) {
37
-		$this->jobList = $jobList;
38
-	}
36
+    public function __construct(IJobList $jobList) {
37
+        $this->jobList = $jobList;
38
+    }
39 39
 
40
-	public function getName(): string {
41
-		return 'Add preview background cleanup job';
42
-	}
40
+    public function getName(): string {
41
+        return 'Add preview background cleanup job';
42
+    }
43 43
 
44
-	public function run(IOutput $output) {
45
-		$this->jobList->add(BackgroundCleanupJob::class);
46
-	}
44
+    public function run(IOutput $output) {
45
+        $this->jobList->add(BackgroundCleanupJob::class);
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
lib/private/Files/AppData/AppData.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -36,102 +36,102 @@
 block discarded – undo
36 36
 
37 37
 class AppData implements IAppData {
38 38
 
39
-	/** @var IRootFolder */
40
-	private $rootFolder;
41
-
42
-	/** @var SystemConfig */
43
-	private $config;
44
-
45
-	/** @var string */
46
-	private $appId;
47
-
48
-	/** @var Folder */
49
-	private $folder;
50
-
51
-	/**
52
-	 * AppData constructor.
53
-	 *
54
-	 * @param IRootFolder $rootFolder
55
-	 * @param SystemConfig $systemConfig
56
-	 * @param string $appId
57
-	 */
58
-	public function __construct(IRootFolder $rootFolder,
59
-								SystemConfig $systemConfig,
60
-								string $appId) {
61
-
62
-		$this->rootFolder = $rootFolder;
63
-		$this->config = $systemConfig;
64
-		$this->appId = $appId;
65
-	}
66
-
67
-	/**
68
-	 * @return Folder
69
-	 * @throws \RuntimeException
70
-	 */
71
-	private function getAppDataFolder(): Folder {
72
-		if ($this->folder === null) {
73
-			$instanceId = $this->config->getValue('instanceid', null);
74
-			if ($instanceId === null) {
75
-				throw new \RuntimeException('no instance id!');
76
-			}
77
-
78
-			$name = 'appdata_' . $instanceId;
79
-
80
-			try {
81
-				$appDataFolder = $this->rootFolder->get($name);
82
-			} catch (NotFoundException $e) {
83
-				try {
84
-					$appDataFolder = $this->rootFolder->newFolder($name);
85
-				} catch (NotPermittedException $e) {
86
-					throw new \RuntimeException('Could not get appdata folder');
87
-				}
88
-			}
89
-
90
-			try {
91
-				$appDataFolder = $appDataFolder->get($this->appId);
92
-			} catch (NotFoundException $e) {
93
-				try {
94
-					$appDataFolder = $appDataFolder->newFolder($this->appId);
95
-				} catch (NotPermittedException $e) {
96
-					throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
97
-				}
98
-			}
99
-
100
-			$this->folder = $appDataFolder;
101
-		}
102
-
103
-		return $this->folder;
104
-	}
105
-
106
-	public function getFolder(string $name): ISimpleFolder {
107
-		$node = $this->getAppDataFolder()->get($name);
108
-
109
-		/** @var Folder $node */
110
-		return new SimpleFolder($node);
111
-	}
112
-
113
-	public function newFolder(string $name): ISimpleFolder {
114
-		$folder = $this->getAppDataFolder()->newFolder($name);
115
-
116
-		return new SimpleFolder($folder);
117
-	}
118
-
119
-	public function getDirectoryListing(): array {
120
-		$listing = $this->getAppDataFolder()->getDirectoryListing();
121
-
122
-		$fileListing = array_map(function(Node $folder) {
123
-			if ($folder instanceof Folder) {
124
-				return new SimpleFolder($folder);
125
-			}
126
-			return null;
127
-		}, $listing);
128
-
129
-		$fileListing = array_filter($fileListing);
130
-
131
-		return array_values($fileListing);
132
-	}
133
-
134
-	public function getId(): int {
135
-		return $this->getAppDataFolder()->getId();
136
-	}
39
+    /** @var IRootFolder */
40
+    private $rootFolder;
41
+
42
+    /** @var SystemConfig */
43
+    private $config;
44
+
45
+    /** @var string */
46
+    private $appId;
47
+
48
+    /** @var Folder */
49
+    private $folder;
50
+
51
+    /**
52
+     * AppData constructor.
53
+     *
54
+     * @param IRootFolder $rootFolder
55
+     * @param SystemConfig $systemConfig
56
+     * @param string $appId
57
+     */
58
+    public function __construct(IRootFolder $rootFolder,
59
+                                SystemConfig $systemConfig,
60
+                                string $appId) {
61
+
62
+        $this->rootFolder = $rootFolder;
63
+        $this->config = $systemConfig;
64
+        $this->appId = $appId;
65
+    }
66
+
67
+    /**
68
+     * @return Folder
69
+     * @throws \RuntimeException
70
+     */
71
+    private function getAppDataFolder(): Folder {
72
+        if ($this->folder === null) {
73
+            $instanceId = $this->config->getValue('instanceid', null);
74
+            if ($instanceId === null) {
75
+                throw new \RuntimeException('no instance id!');
76
+            }
77
+
78
+            $name = 'appdata_' . $instanceId;
79
+
80
+            try {
81
+                $appDataFolder = $this->rootFolder->get($name);
82
+            } catch (NotFoundException $e) {
83
+                try {
84
+                    $appDataFolder = $this->rootFolder->newFolder($name);
85
+                } catch (NotPermittedException $e) {
86
+                    throw new \RuntimeException('Could not get appdata folder');
87
+                }
88
+            }
89
+
90
+            try {
91
+                $appDataFolder = $appDataFolder->get($this->appId);
92
+            } catch (NotFoundException $e) {
93
+                try {
94
+                    $appDataFolder = $appDataFolder->newFolder($this->appId);
95
+                } catch (NotPermittedException $e) {
96
+                    throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
97
+                }
98
+            }
99
+
100
+            $this->folder = $appDataFolder;
101
+        }
102
+
103
+        return $this->folder;
104
+    }
105
+
106
+    public function getFolder(string $name): ISimpleFolder {
107
+        $node = $this->getAppDataFolder()->get($name);
108
+
109
+        /** @var Folder $node */
110
+        return new SimpleFolder($node);
111
+    }
112
+
113
+    public function newFolder(string $name): ISimpleFolder {
114
+        $folder = $this->getAppDataFolder()->newFolder($name);
115
+
116
+        return new SimpleFolder($folder);
117
+    }
118
+
119
+    public function getDirectoryListing(): array {
120
+        $listing = $this->getAppDataFolder()->getDirectoryListing();
121
+
122
+        $fileListing = array_map(function(Node $folder) {
123
+            if ($folder instanceof Folder) {
124
+                return new SimpleFolder($folder);
125
+            }
126
+            return null;
127
+        }, $listing);
128
+
129
+        $fileListing = array_filter($fileListing);
130
+
131
+        return array_values($fileListing);
132
+    }
133
+
134
+    public function getId(): int {
135
+        return $this->getAppDataFolder()->getId();
136
+    }
137 137
 }
Please login to merge, or discard this patch.
lib/private/Files/AppData/Factory.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,24 +28,24 @@
 block discarded – undo
28 28
 
29 29
 class Factory {
30 30
 
31
-	/** @var IRootFolder */
32
-	private $rootFolder;
31
+    /** @var IRootFolder */
32
+    private $rootFolder;
33 33
 
34
-	/** @var SystemConfig */
35
-	private $config;
34
+    /** @var SystemConfig */
35
+    private $config;
36 36
 
37
-	public function __construct(IRootFolder $rootFolder,
38
-								SystemConfig $systemConfig) {
37
+    public function __construct(IRootFolder $rootFolder,
38
+                                SystemConfig $systemConfig) {
39 39
 
40
-		$this->rootFolder = $rootFolder;
41
-		$this->config = $systemConfig;
42
-	}
40
+        $this->rootFolder = $rootFolder;
41
+        $this->config = $systemConfig;
42
+    }
43 43
 
44
-	/**
45
-	 * @param string $appId
46
-	 * @return AppData
47
-	 */
48
-	public function get(string $appId): AppData {
49
-		return new AppData($this->rootFolder, $this->config, $appId);
50
-	}
44
+    /**
45
+     * @param string $appId
46
+     * @return AppData
47
+     */
48
+    public function get(string $appId): AppData {
49
+        return new AppData($this->rootFolder, $this->config, $appId);
50
+    }
51 51
 }
Please login to merge, or discard this patch.
lib/private/Setup.php 1 patch
Indentation   +494 added lines, -494 removed lines patch added patch discarded remove patch
@@ -54,498 +54,498 @@
 block discarded – undo
54 54
 use OCP\Security\ISecureRandom;
55 55
 
56 56
 class Setup {
57
-	/** @var SystemConfig */
58
-	protected $config;
59
-	/** @var IniGetWrapper */
60
-	protected $iniWrapper;
61
-	/** @var IL10N */
62
-	protected $l10n;
63
-	/** @var Defaults */
64
-	protected $defaults;
65
-	/** @var ILogger */
66
-	protected $logger;
67
-	/** @var ISecureRandom */
68
-	protected $random;
69
-	/** @var Installer */
70
-	protected $installer;
71
-
72
-	/**
73
-	 * @param SystemConfig $config
74
-	 * @param IniGetWrapper $iniWrapper
75
-	 * @param IL10N $l10n
76
-	 * @param Defaults $defaults
77
-	 * @param ILogger $logger
78
-	 * @param ISecureRandom $random
79
-	 * @param Installer $installer
80
-	 */
81
-	public function __construct(SystemConfig $config,
82
-						 IniGetWrapper $iniWrapper,
83
-						 IL10N $l10n,
84
-						 Defaults $defaults,
85
-						 ILogger $logger,
86
-						 ISecureRandom $random,
87
-						 Installer $installer
88
-		) {
89
-		$this->config = $config;
90
-		$this->iniWrapper = $iniWrapper;
91
-		$this->l10n = $l10n;
92
-		$this->defaults = $defaults;
93
-		$this->logger = $logger;
94
-		$this->random = $random;
95
-		$this->installer = $installer;
96
-	}
97
-
98
-	static protected $dbSetupClasses = [
99
-		'mysql' => \OC\Setup\MySQL::class,
100
-		'pgsql' => \OC\Setup\PostgreSQL::class,
101
-		'oci'   => \OC\Setup\OCI::class,
102
-		'sqlite' => \OC\Setup\Sqlite::class,
103
-		'sqlite3' => \OC\Setup\Sqlite::class,
104
-	];
105
-
106
-	/**
107
-	 * Wrapper around the "class_exists" PHP function to be able to mock it
108
-	 * @param string $name
109
-	 * @return bool
110
-	 */
111
-	protected function class_exists($name) {
112
-		return class_exists($name);
113
-	}
114
-
115
-	/**
116
-	 * Wrapper around the "is_callable" PHP function to be able to mock it
117
-	 * @param string $name
118
-	 * @return bool
119
-	 */
120
-	protected function is_callable($name) {
121
-		return is_callable($name);
122
-	}
123
-
124
-	/**
125
-	 * Wrapper around \PDO::getAvailableDrivers
126
-	 *
127
-	 * @return array
128
-	 */
129
-	protected function getAvailableDbDriversForPdo() {
130
-		return \PDO::getAvailableDrivers();
131
-	}
132
-
133
-	/**
134
-	 * Get the available and supported databases of this instance
135
-	 *
136
-	 * @param bool $allowAllDatabases
137
-	 * @return array
138
-	 * @throws Exception
139
-	 */
140
-	public function getSupportedDatabases($allowAllDatabases = false) {
141
-		$availableDatabases = [
142
-			'sqlite' =>  [
143
-				'type' => 'pdo',
144
-				'call' => 'sqlite',
145
-				'name' => 'SQLite',
146
-			],
147
-			'mysql' => [
148
-				'type' => 'pdo',
149
-				'call' => 'mysql',
150
-				'name' => 'MySQL/MariaDB',
151
-			],
152
-			'pgsql' => [
153
-				'type' => 'pdo',
154
-				'call' => 'pgsql',
155
-				'name' => 'PostgreSQL',
156
-			],
157
-			'oci' => [
158
-				'type' => 'function',
159
-				'call' => 'oci_connect',
160
-				'name' => 'Oracle',
161
-			],
162
-		];
163
-		if ($allowAllDatabases) {
164
-			$configuredDatabases = array_keys($availableDatabases);
165
-		} else {
166
-			$configuredDatabases = $this->config->getValue('supportedDatabases',
167
-				['sqlite', 'mysql', 'pgsql']);
168
-		}
169
-		if(!is_array($configuredDatabases)) {
170
-			throw new Exception('Supported databases are not properly configured.');
171
-		}
172
-
173
-		$supportedDatabases = array();
174
-
175
-		foreach($configuredDatabases as $database) {
176
-			if(array_key_exists($database, $availableDatabases)) {
177
-				$working = false;
178
-				$type = $availableDatabases[$database]['type'];
179
-				$call = $availableDatabases[$database]['call'];
180
-
181
-				if ($type === 'function') {
182
-					$working = $this->is_callable($call);
183
-				} elseif($type === 'pdo') {
184
-					$working = in_array($call, $this->getAvailableDbDriversForPdo(), true);
185
-				}
186
-				if($working) {
187
-					$supportedDatabases[$database] = $availableDatabases[$database]['name'];
188
-				}
189
-			}
190
-		}
191
-
192
-		return $supportedDatabases;
193
-	}
194
-
195
-	/**
196
-	 * Gathers system information like database type and does
197
-	 * a few system checks.
198
-	 *
199
-	 * @return array of system info, including an "errors" value
200
-	 * in case of errors/warnings
201
-	 */
202
-	public function getSystemInfo($allowAllDatabases = false) {
203
-		$databases = $this->getSupportedDatabases($allowAllDatabases);
204
-
205
-		$dataDir = $this->config->getValue('datadirectory', \OC::$SERVERROOT.'/data');
206
-
207
-		$errors = [];
208
-
209
-		// Create data directory to test whether the .htaccess works
210
-		// Notice that this is not necessarily the same data directory as the one
211
-		// that will effectively be used.
212
-		if(!file_exists($dataDir)) {
213
-			@mkdir($dataDir);
214
-		}
215
-		$htAccessWorking = true;
216
-		if (is_dir($dataDir) && is_writable($dataDir)) {
217
-			// Protect data directory here, so we can test if the protection is working
218
-			self::protectDataDirectory();
219
-
220
-			try {
221
-				$util = new \OC_Util();
222
-				$htAccessWorking = $util->isHtaccessWorking(\OC::$server->getConfig());
223
-			} catch (\OC\HintException $e) {
224
-				$errors[] = [
225
-					'error' => $e->getMessage(),
226
-					'hint' => $e->getHint(),
227
-				];
228
-				$htAccessWorking = false;
229
-			}
230
-		}
231
-
232
-		if (\OC_Util::runningOnMac()) {
233
-			$errors[] = [
234
-				'error' => $this->l10n->t(
235
-					'Mac OS X is not supported and %s will not work properly on this platform. ' .
236
-					'Use it at your own risk! ',
237
-					[$this->defaults->getName()]
238
-				),
239
-				'hint' => $this->l10n->t('For the best results, please consider using a GNU/Linux server instead.'),
240
-			];
241
-		}
242
-
243
-		if($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) {
244
-			$errors[] = [
245
-				'error' => $this->l10n->t(
246
-					'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' .
247
-					'This will lead to problems with files over 4 GB and is highly discouraged.',
248
-					[$this->defaults->getName()]
249
-				),
250
-				'hint' => $this->l10n->t('Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP.'),
251
-			];
252
-		}
253
-
254
-		return array(
255
-			'hasSQLite' => isset($databases['sqlite']),
256
-			'hasMySQL' => isset($databases['mysql']),
257
-			'hasPostgreSQL' => isset($databases['pgsql']),
258
-			'hasOracle' => isset($databases['oci']),
259
-			'databases' => $databases,
260
-			'directory' => $dataDir,
261
-			'htaccessWorking' => $htAccessWorking,
262
-			'errors' => $errors,
263
-		);
264
-	}
265
-
266
-	/**
267
-	 * @param $options
268
-	 * @return array
269
-	 */
270
-	public function install($options) {
271
-		$l = $this->l10n;
272
-
273
-		$error = array();
274
-		$dbType = $options['dbtype'];
275
-
276
-		if(empty($options['adminlogin'])) {
277
-			$error[] = $l->t('Set an admin username.');
278
-		}
279
-		if(empty($options['adminpass'])) {
280
-			$error[] = $l->t('Set an admin password.');
281
-		}
282
-		if(empty($options['directory'])) {
283
-			$options['directory'] = \OC::$SERVERROOT."/data";
284
-		}
285
-
286
-		if (!isset(self::$dbSetupClasses[$dbType])) {
287
-			$dbType = 'sqlite';
288
-		}
289
-
290
-		$username = htmlspecialchars_decode($options['adminlogin']);
291
-		$password = htmlspecialchars_decode($options['adminpass']);
292
-		$dataDir = htmlspecialchars_decode($options['directory']);
293
-
294
-		$class = self::$dbSetupClasses[$dbType];
295
-		/** @var \OC\Setup\AbstractDatabase $dbSetup */
296
-		$dbSetup = new $class($l, $this->config, $this->logger, $this->random);
297
-		$error = array_merge($error, $dbSetup->validate($options));
298
-
299
-		// validate the data directory
300
-		if ((!is_dir($dataDir) && !mkdir($dataDir)) || !is_writable($dataDir)) {
301
-			$error[] = $l->t("Can't create or write into the data directory %s", array($dataDir));
302
-		}
303
-
304
-		if (!empty($error)) {
305
-			return $error;
306
-		}
307
-
308
-		$request = \OC::$server->getRequest();
309
-
310
-		//no errors, good
311
-		if(isset($options['trusted_domains'])
312
-		    && is_array($options['trusted_domains'])) {
313
-			$trustedDomains = $options['trusted_domains'];
314
-		} else {
315
-			$trustedDomains = [$request->getInsecureServerHost()];
316
-		}
317
-
318
-		//use sqlite3 when available, otherwise sqlite2 will be used.
319
-		if ($dbType === 'sqlite' && class_exists('SQLite3')) {
320
-			$dbType = 'sqlite3';
321
-		}
322
-
323
-		//generate a random salt that is used to salt the local user passwords
324
-		$salt = $this->random->generate(30);
325
-		// generate a secret
326
-		$secret = $this->random->generate(48);
327
-
328
-		//write the config file
329
-		$newConfigValues = [
330
-			'passwordsalt'		=> $salt,
331
-			'secret'			=> $secret,
332
-			'trusted_domains'	=> $trustedDomains,
333
-			'datadirectory'		=> $dataDir,
334
-			'dbtype'			=> $dbType,
335
-			'version'			=> implode('.', \OCP\Util::getVersion()),
336
-		];
337
-
338
-		if ($this->config->getValue('overwrite.cli.url', null) === null) {
339
-			$newConfigValues['overwrite.cli.url'] = $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT;
340
-		}
341
-
342
-		$this->config->setValues($newConfigValues);
343
-
344
-		try {
345
-			$dbSetup->initialize($options);
346
-			$dbSetup->setupDatabase($username);
347
-			// apply necessary migrations
348
-			$dbSetup->runMigrations();
349
-		} catch (\OC\DatabaseSetupException $e) {
350
-			$error[] = [
351
-				'error' => $e->getMessage(),
352
-				'hint' => $e->getHint(),
353
-			];
354
-			return $error;
355
-		} catch (Exception $e) {
356
-			$error[] = [
357
-				'error' => 'Error while trying to create admin user: ' . $e->getMessage(),
358
-				'hint' => '',
359
-			];
360
-			return $error;
361
-		}
362
-
363
-		//create the user and group
364
-		$user =  null;
365
-		try {
366
-			$user = \OC::$server->getUserManager()->createUser($username, $password);
367
-			if (!$user) {
368
-				$error[] = "User <$username> could not be created.";
369
-			}
370
-		} catch(Exception $exception) {
371
-			$error[] = $exception->getMessage();
372
-		}
373
-
374
-		if (empty($error)) {
375
-			$config = \OC::$server->getConfig();
376
-			$config->setAppValue('core', 'installedat', microtime(true));
377
-			$config->setAppValue('core', 'lastupdatedat', microtime(true));
378
-			$config->setAppValue('core', 'vendor', $this->getVendor());
379
-
380
-			$group =\OC::$server->getGroupManager()->createGroup('admin');
381
-			$group->addUser($user);
382
-
383
-			// Install shipped apps and specified app bundles
384
-			Installer::installShippedApps();
385
-			$bundleFetcher = new BundleFetcher(\OC::$server->getL10N('lib'));
386
-			$defaultInstallationBundles = $bundleFetcher->getDefaultInstallationBundle();
387
-			foreach($defaultInstallationBundles as $bundle) {
388
-				try {
389
-					$this->installer->installAppBundle($bundle);
390
-				} catch (Exception $e) {}
391
-			}
392
-
393
-			// create empty file in data dir, so we can later find
394
-			// out that this is indeed an ownCloud data directory
395
-			file_put_contents($config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', '');
396
-
397
-			// Update .htaccess files
398
-			self::updateHtaccess();
399
-			self::protectDataDirectory();
400
-
401
-			self::installBackgroundJobs();
402
-
403
-			//and we are done
404
-			$config->setSystemValue('installed', true);
405
-
406
-			// Create a session token for the newly created user
407
-			// The token provider requires a working db, so it's not injected on setup
408
-			/* @var $userSession User\Session */
409
-			$userSession = \OC::$server->getUserSession();
410
-			$defaultTokenProvider = \OC::$server->query(DefaultTokenProvider::class);
411
-			$userSession->setTokenProvider($defaultTokenProvider);
412
-			$userSession->login($username, $password);
413
-			$userSession->createSessionToken($request, $userSession->getUser()->getUID(), $username, $password);
414
-		}
415
-
416
-		return $error;
417
-	}
418
-
419
-	public static function installBackgroundJobs() {
420
-		$jobList = \OC::$server->getJobList();
421
-		$jobList->add(DefaultTokenCleanupJob::class);
422
-		$jobList->add(Rotate::class);
423
-		$jobList->add(BackgroundCleanupJob::class);
424
-	}
425
-
426
-	/**
427
-	 * @return string Absolute path to htaccess
428
-	 */
429
-	private function pathToHtaccess() {
430
-		return \OC::$SERVERROOT.'/.htaccess';
431
-	}
432
-
433
-	/**
434
-	 * Append the correct ErrorDocument path for Apache hosts
435
-	 * @return bool True when success, False otherwise
436
-	 */
437
-	public static function updateHtaccess() {
438
-		$config = \OC::$server->getSystemConfig();
439
-
440
-		// For CLI read the value from overwrite.cli.url
441
-		if(\OC::$CLI) {
442
-			$webRoot = $config->getValue('overwrite.cli.url', '');
443
-			if($webRoot === '') {
444
-				return false;
445
-			}
446
-			$webRoot = parse_url($webRoot, PHP_URL_PATH);
447
-			if ($webRoot === null) {
448
-				return false;
449
-			}
450
-			$webRoot = rtrim($webRoot, '/');
451
-		} else {
452
-			$webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';
453
-		}
454
-
455
-		$setupHelper = new \OC\Setup(
456
-			$config,
457
-			\OC::$server->getIniWrapper(),
458
-			\OC::$server->getL10N('lib'),
459
-			\OC::$server->query(Defaults::class),
460
-			\OC::$server->getLogger(),
461
-			\OC::$server->getSecureRandom(),
462
-			\OC::$server->query(Installer::class)
463
-		);
464
-
465
-		$htaccessContent = file_get_contents($setupHelper->pathToHtaccess());
466
-		$content = "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####\n";
467
-		$htaccessContent = explode($content, $htaccessContent, 2)[0];
468
-
469
-		//custom 403 error page
470
-		$content.= "\nErrorDocument 403 ".$webRoot."/";
471
-
472
-		//custom 404 error page
473
-		$content.= "\nErrorDocument 404 ".$webRoot."/";
474
-
475
-		// Add rewrite rules if the RewriteBase is configured
476
-		$rewriteBase = $config->getValue('htaccess.RewriteBase', '');
477
-		if($rewriteBase !== '') {
478
-			$content .= "\n<IfModule mod_rewrite.c>";
479
-			$content .= "\n  Options -MultiViews";
480
-			$content .= "\n  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]";
481
-			$content .= "\n  RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]";
482
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !\\.(css|js|svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$";
483
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$";
484
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !core/img/manifest.json$";
485
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/remote.php";
486
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/public.php";
487
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/cron.php";
488
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php";
489
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/status.php";
490
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php";
491
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php";
492
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/robots.txt";
493
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/updater/";
494
-			$content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs-provider/";
495
-			$content .= "\n  RewriteCond %{REQUEST_URI} !^/\\.well-known/(acme-challenge|pki-validation)/.*";
496
-			$content .= "\n  RewriteRule . index.php [PT,E=PATH_INFO:$1]";
497
-			$content .= "\n  RewriteBase " . $rewriteBase;
498
-			$content .= "\n  <IfModule mod_env.c>";
499
-			$content .= "\n    SetEnv front_controller_active true";
500
-			$content .= "\n    <IfModule mod_dir.c>";
501
-			$content .= "\n      DirectorySlash off";
502
-			$content .= "\n    </IfModule>";
503
-			$content .= "\n  </IfModule>";
504
-			$content .= "\n</IfModule>";
505
-		}
506
-
507
-		if ($content !== '') {
508
-			//suppress errors in case we don't have permissions for it
509
-			return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n");
510
-		}
511
-
512
-		return false;
513
-	}
514
-
515
-	public static function protectDataDirectory() {
516
-		//Require all denied
517
-		$now =  date('Y-m-d H:i:s');
518
-		$content = "# Generated by Nextcloud on $now\n";
519
-		$content.= "# line below if for Apache 2.4\n";
520
-		$content.= "<ifModule mod_authz_core.c>\n";
521
-		$content.= "Require all denied\n";
522
-		$content.= "</ifModule>\n\n";
523
-		$content.= "# line below if for Apache 2.2\n";
524
-		$content.= "<ifModule !mod_authz_core.c>\n";
525
-		$content.= "deny from all\n";
526
-		$content.= "Satisfy All\n";
527
-		$content.= "</ifModule>\n\n";
528
-		$content.= "# section for Apache 2.2 and 2.4\n";
529
-		$content.= "<ifModule mod_autoindex.c>\n";
530
-		$content.= "IndexIgnore *\n";
531
-		$content.= "</ifModule>\n";
532
-
533
-		$baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
534
-		file_put_contents($baseDir . '/.htaccess', $content);
535
-		file_put_contents($baseDir . '/index.html', '');
536
-	}
537
-
538
-	/**
539
-	 * Return vendor from which this version was published
540
-	 *
541
-	 * @return string Get the vendor
542
-	 *
543
-	 * Copy of \OC\Updater::getVendor()
544
-	 */
545
-	private function getVendor() {
546
-		// this should really be a JSON file
547
-		require \OC::$SERVERROOT . '/version.php';
548
-		/** @var string $vendor */
549
-		return (string) $vendor;
550
-	}
57
+    /** @var SystemConfig */
58
+    protected $config;
59
+    /** @var IniGetWrapper */
60
+    protected $iniWrapper;
61
+    /** @var IL10N */
62
+    protected $l10n;
63
+    /** @var Defaults */
64
+    protected $defaults;
65
+    /** @var ILogger */
66
+    protected $logger;
67
+    /** @var ISecureRandom */
68
+    protected $random;
69
+    /** @var Installer */
70
+    protected $installer;
71
+
72
+    /**
73
+     * @param SystemConfig $config
74
+     * @param IniGetWrapper $iniWrapper
75
+     * @param IL10N $l10n
76
+     * @param Defaults $defaults
77
+     * @param ILogger $logger
78
+     * @param ISecureRandom $random
79
+     * @param Installer $installer
80
+     */
81
+    public function __construct(SystemConfig $config,
82
+                            IniGetWrapper $iniWrapper,
83
+                            IL10N $l10n,
84
+                            Defaults $defaults,
85
+                            ILogger $logger,
86
+                            ISecureRandom $random,
87
+                            Installer $installer
88
+        ) {
89
+        $this->config = $config;
90
+        $this->iniWrapper = $iniWrapper;
91
+        $this->l10n = $l10n;
92
+        $this->defaults = $defaults;
93
+        $this->logger = $logger;
94
+        $this->random = $random;
95
+        $this->installer = $installer;
96
+    }
97
+
98
+    static protected $dbSetupClasses = [
99
+        'mysql' => \OC\Setup\MySQL::class,
100
+        'pgsql' => \OC\Setup\PostgreSQL::class,
101
+        'oci'   => \OC\Setup\OCI::class,
102
+        'sqlite' => \OC\Setup\Sqlite::class,
103
+        'sqlite3' => \OC\Setup\Sqlite::class,
104
+    ];
105
+
106
+    /**
107
+     * Wrapper around the "class_exists" PHP function to be able to mock it
108
+     * @param string $name
109
+     * @return bool
110
+     */
111
+    protected function class_exists($name) {
112
+        return class_exists($name);
113
+    }
114
+
115
+    /**
116
+     * Wrapper around the "is_callable" PHP function to be able to mock it
117
+     * @param string $name
118
+     * @return bool
119
+     */
120
+    protected function is_callable($name) {
121
+        return is_callable($name);
122
+    }
123
+
124
+    /**
125
+     * Wrapper around \PDO::getAvailableDrivers
126
+     *
127
+     * @return array
128
+     */
129
+    protected function getAvailableDbDriversForPdo() {
130
+        return \PDO::getAvailableDrivers();
131
+    }
132
+
133
+    /**
134
+     * Get the available and supported databases of this instance
135
+     *
136
+     * @param bool $allowAllDatabases
137
+     * @return array
138
+     * @throws Exception
139
+     */
140
+    public function getSupportedDatabases($allowAllDatabases = false) {
141
+        $availableDatabases = [
142
+            'sqlite' =>  [
143
+                'type' => 'pdo',
144
+                'call' => 'sqlite',
145
+                'name' => 'SQLite',
146
+            ],
147
+            'mysql' => [
148
+                'type' => 'pdo',
149
+                'call' => 'mysql',
150
+                'name' => 'MySQL/MariaDB',
151
+            ],
152
+            'pgsql' => [
153
+                'type' => 'pdo',
154
+                'call' => 'pgsql',
155
+                'name' => 'PostgreSQL',
156
+            ],
157
+            'oci' => [
158
+                'type' => 'function',
159
+                'call' => 'oci_connect',
160
+                'name' => 'Oracle',
161
+            ],
162
+        ];
163
+        if ($allowAllDatabases) {
164
+            $configuredDatabases = array_keys($availableDatabases);
165
+        } else {
166
+            $configuredDatabases = $this->config->getValue('supportedDatabases',
167
+                ['sqlite', 'mysql', 'pgsql']);
168
+        }
169
+        if(!is_array($configuredDatabases)) {
170
+            throw new Exception('Supported databases are not properly configured.');
171
+        }
172
+
173
+        $supportedDatabases = array();
174
+
175
+        foreach($configuredDatabases as $database) {
176
+            if(array_key_exists($database, $availableDatabases)) {
177
+                $working = false;
178
+                $type = $availableDatabases[$database]['type'];
179
+                $call = $availableDatabases[$database]['call'];
180
+
181
+                if ($type === 'function') {
182
+                    $working = $this->is_callable($call);
183
+                } elseif($type === 'pdo') {
184
+                    $working = in_array($call, $this->getAvailableDbDriversForPdo(), true);
185
+                }
186
+                if($working) {
187
+                    $supportedDatabases[$database] = $availableDatabases[$database]['name'];
188
+                }
189
+            }
190
+        }
191
+
192
+        return $supportedDatabases;
193
+    }
194
+
195
+    /**
196
+     * Gathers system information like database type and does
197
+     * a few system checks.
198
+     *
199
+     * @return array of system info, including an "errors" value
200
+     * in case of errors/warnings
201
+     */
202
+    public function getSystemInfo($allowAllDatabases = false) {
203
+        $databases = $this->getSupportedDatabases($allowAllDatabases);
204
+
205
+        $dataDir = $this->config->getValue('datadirectory', \OC::$SERVERROOT.'/data');
206
+
207
+        $errors = [];
208
+
209
+        // Create data directory to test whether the .htaccess works
210
+        // Notice that this is not necessarily the same data directory as the one
211
+        // that will effectively be used.
212
+        if(!file_exists($dataDir)) {
213
+            @mkdir($dataDir);
214
+        }
215
+        $htAccessWorking = true;
216
+        if (is_dir($dataDir) && is_writable($dataDir)) {
217
+            // Protect data directory here, so we can test if the protection is working
218
+            self::protectDataDirectory();
219
+
220
+            try {
221
+                $util = new \OC_Util();
222
+                $htAccessWorking = $util->isHtaccessWorking(\OC::$server->getConfig());
223
+            } catch (\OC\HintException $e) {
224
+                $errors[] = [
225
+                    'error' => $e->getMessage(),
226
+                    'hint' => $e->getHint(),
227
+                ];
228
+                $htAccessWorking = false;
229
+            }
230
+        }
231
+
232
+        if (\OC_Util::runningOnMac()) {
233
+            $errors[] = [
234
+                'error' => $this->l10n->t(
235
+                    'Mac OS X is not supported and %s will not work properly on this platform. ' .
236
+                    'Use it at your own risk! ',
237
+                    [$this->defaults->getName()]
238
+                ),
239
+                'hint' => $this->l10n->t('For the best results, please consider using a GNU/Linux server instead.'),
240
+            ];
241
+        }
242
+
243
+        if($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) {
244
+            $errors[] = [
245
+                'error' => $this->l10n->t(
246
+                    'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' .
247
+                    'This will lead to problems with files over 4 GB and is highly discouraged.',
248
+                    [$this->defaults->getName()]
249
+                ),
250
+                'hint' => $this->l10n->t('Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP.'),
251
+            ];
252
+        }
253
+
254
+        return array(
255
+            'hasSQLite' => isset($databases['sqlite']),
256
+            'hasMySQL' => isset($databases['mysql']),
257
+            'hasPostgreSQL' => isset($databases['pgsql']),
258
+            'hasOracle' => isset($databases['oci']),
259
+            'databases' => $databases,
260
+            'directory' => $dataDir,
261
+            'htaccessWorking' => $htAccessWorking,
262
+            'errors' => $errors,
263
+        );
264
+    }
265
+
266
+    /**
267
+     * @param $options
268
+     * @return array
269
+     */
270
+    public function install($options) {
271
+        $l = $this->l10n;
272
+
273
+        $error = array();
274
+        $dbType = $options['dbtype'];
275
+
276
+        if(empty($options['adminlogin'])) {
277
+            $error[] = $l->t('Set an admin username.');
278
+        }
279
+        if(empty($options['adminpass'])) {
280
+            $error[] = $l->t('Set an admin password.');
281
+        }
282
+        if(empty($options['directory'])) {
283
+            $options['directory'] = \OC::$SERVERROOT."/data";
284
+        }
285
+
286
+        if (!isset(self::$dbSetupClasses[$dbType])) {
287
+            $dbType = 'sqlite';
288
+        }
289
+
290
+        $username = htmlspecialchars_decode($options['adminlogin']);
291
+        $password = htmlspecialchars_decode($options['adminpass']);
292
+        $dataDir = htmlspecialchars_decode($options['directory']);
293
+
294
+        $class = self::$dbSetupClasses[$dbType];
295
+        /** @var \OC\Setup\AbstractDatabase $dbSetup */
296
+        $dbSetup = new $class($l, $this->config, $this->logger, $this->random);
297
+        $error = array_merge($error, $dbSetup->validate($options));
298
+
299
+        // validate the data directory
300
+        if ((!is_dir($dataDir) && !mkdir($dataDir)) || !is_writable($dataDir)) {
301
+            $error[] = $l->t("Can't create or write into the data directory %s", array($dataDir));
302
+        }
303
+
304
+        if (!empty($error)) {
305
+            return $error;
306
+        }
307
+
308
+        $request = \OC::$server->getRequest();
309
+
310
+        //no errors, good
311
+        if(isset($options['trusted_domains'])
312
+            && is_array($options['trusted_domains'])) {
313
+            $trustedDomains = $options['trusted_domains'];
314
+        } else {
315
+            $trustedDomains = [$request->getInsecureServerHost()];
316
+        }
317
+
318
+        //use sqlite3 when available, otherwise sqlite2 will be used.
319
+        if ($dbType === 'sqlite' && class_exists('SQLite3')) {
320
+            $dbType = 'sqlite3';
321
+        }
322
+
323
+        //generate a random salt that is used to salt the local user passwords
324
+        $salt = $this->random->generate(30);
325
+        // generate a secret
326
+        $secret = $this->random->generate(48);
327
+
328
+        //write the config file
329
+        $newConfigValues = [
330
+            'passwordsalt'		=> $salt,
331
+            'secret'			=> $secret,
332
+            'trusted_domains'	=> $trustedDomains,
333
+            'datadirectory'		=> $dataDir,
334
+            'dbtype'			=> $dbType,
335
+            'version'			=> implode('.', \OCP\Util::getVersion()),
336
+        ];
337
+
338
+        if ($this->config->getValue('overwrite.cli.url', null) === null) {
339
+            $newConfigValues['overwrite.cli.url'] = $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT;
340
+        }
341
+
342
+        $this->config->setValues($newConfigValues);
343
+
344
+        try {
345
+            $dbSetup->initialize($options);
346
+            $dbSetup->setupDatabase($username);
347
+            // apply necessary migrations
348
+            $dbSetup->runMigrations();
349
+        } catch (\OC\DatabaseSetupException $e) {
350
+            $error[] = [
351
+                'error' => $e->getMessage(),
352
+                'hint' => $e->getHint(),
353
+            ];
354
+            return $error;
355
+        } catch (Exception $e) {
356
+            $error[] = [
357
+                'error' => 'Error while trying to create admin user: ' . $e->getMessage(),
358
+                'hint' => '',
359
+            ];
360
+            return $error;
361
+        }
362
+
363
+        //create the user and group
364
+        $user =  null;
365
+        try {
366
+            $user = \OC::$server->getUserManager()->createUser($username, $password);
367
+            if (!$user) {
368
+                $error[] = "User <$username> could not be created.";
369
+            }
370
+        } catch(Exception $exception) {
371
+            $error[] = $exception->getMessage();
372
+        }
373
+
374
+        if (empty($error)) {
375
+            $config = \OC::$server->getConfig();
376
+            $config->setAppValue('core', 'installedat', microtime(true));
377
+            $config->setAppValue('core', 'lastupdatedat', microtime(true));
378
+            $config->setAppValue('core', 'vendor', $this->getVendor());
379
+
380
+            $group =\OC::$server->getGroupManager()->createGroup('admin');
381
+            $group->addUser($user);
382
+
383
+            // Install shipped apps and specified app bundles
384
+            Installer::installShippedApps();
385
+            $bundleFetcher = new BundleFetcher(\OC::$server->getL10N('lib'));
386
+            $defaultInstallationBundles = $bundleFetcher->getDefaultInstallationBundle();
387
+            foreach($defaultInstallationBundles as $bundle) {
388
+                try {
389
+                    $this->installer->installAppBundle($bundle);
390
+                } catch (Exception $e) {}
391
+            }
392
+
393
+            // create empty file in data dir, so we can later find
394
+            // out that this is indeed an ownCloud data directory
395
+            file_put_contents($config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', '');
396
+
397
+            // Update .htaccess files
398
+            self::updateHtaccess();
399
+            self::protectDataDirectory();
400
+
401
+            self::installBackgroundJobs();
402
+
403
+            //and we are done
404
+            $config->setSystemValue('installed', true);
405
+
406
+            // Create a session token for the newly created user
407
+            // The token provider requires a working db, so it's not injected on setup
408
+            /* @var $userSession User\Session */
409
+            $userSession = \OC::$server->getUserSession();
410
+            $defaultTokenProvider = \OC::$server->query(DefaultTokenProvider::class);
411
+            $userSession->setTokenProvider($defaultTokenProvider);
412
+            $userSession->login($username, $password);
413
+            $userSession->createSessionToken($request, $userSession->getUser()->getUID(), $username, $password);
414
+        }
415
+
416
+        return $error;
417
+    }
418
+
419
+    public static function installBackgroundJobs() {
420
+        $jobList = \OC::$server->getJobList();
421
+        $jobList->add(DefaultTokenCleanupJob::class);
422
+        $jobList->add(Rotate::class);
423
+        $jobList->add(BackgroundCleanupJob::class);
424
+    }
425
+
426
+    /**
427
+     * @return string Absolute path to htaccess
428
+     */
429
+    private function pathToHtaccess() {
430
+        return \OC::$SERVERROOT.'/.htaccess';
431
+    }
432
+
433
+    /**
434
+     * Append the correct ErrorDocument path for Apache hosts
435
+     * @return bool True when success, False otherwise
436
+     */
437
+    public static function updateHtaccess() {
438
+        $config = \OC::$server->getSystemConfig();
439
+
440
+        // For CLI read the value from overwrite.cli.url
441
+        if(\OC::$CLI) {
442
+            $webRoot = $config->getValue('overwrite.cli.url', '');
443
+            if($webRoot === '') {
444
+                return false;
445
+            }
446
+            $webRoot = parse_url($webRoot, PHP_URL_PATH);
447
+            if ($webRoot === null) {
448
+                return false;
449
+            }
450
+            $webRoot = rtrim($webRoot, '/');
451
+        } else {
452
+            $webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';
453
+        }
454
+
455
+        $setupHelper = new \OC\Setup(
456
+            $config,
457
+            \OC::$server->getIniWrapper(),
458
+            \OC::$server->getL10N('lib'),
459
+            \OC::$server->query(Defaults::class),
460
+            \OC::$server->getLogger(),
461
+            \OC::$server->getSecureRandom(),
462
+            \OC::$server->query(Installer::class)
463
+        );
464
+
465
+        $htaccessContent = file_get_contents($setupHelper->pathToHtaccess());
466
+        $content = "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####\n";
467
+        $htaccessContent = explode($content, $htaccessContent, 2)[0];
468
+
469
+        //custom 403 error page
470
+        $content.= "\nErrorDocument 403 ".$webRoot."/";
471
+
472
+        //custom 404 error page
473
+        $content.= "\nErrorDocument 404 ".$webRoot."/";
474
+
475
+        // Add rewrite rules if the RewriteBase is configured
476
+        $rewriteBase = $config->getValue('htaccess.RewriteBase', '');
477
+        if($rewriteBase !== '') {
478
+            $content .= "\n<IfModule mod_rewrite.c>";
479
+            $content .= "\n  Options -MultiViews";
480
+            $content .= "\n  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]";
481
+            $content .= "\n  RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]";
482
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !\\.(css|js|svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$";
483
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$";
484
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !core/img/manifest.json$";
485
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/remote.php";
486
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/public.php";
487
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/cron.php";
488
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php";
489
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/status.php";
490
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php";
491
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php";
492
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/robots.txt";
493
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/updater/";
494
+            $content .= "\n  RewriteCond %{REQUEST_FILENAME} !/ocs-provider/";
495
+            $content .= "\n  RewriteCond %{REQUEST_URI} !^/\\.well-known/(acme-challenge|pki-validation)/.*";
496
+            $content .= "\n  RewriteRule . index.php [PT,E=PATH_INFO:$1]";
497
+            $content .= "\n  RewriteBase " . $rewriteBase;
498
+            $content .= "\n  <IfModule mod_env.c>";
499
+            $content .= "\n    SetEnv front_controller_active true";
500
+            $content .= "\n    <IfModule mod_dir.c>";
501
+            $content .= "\n      DirectorySlash off";
502
+            $content .= "\n    </IfModule>";
503
+            $content .= "\n  </IfModule>";
504
+            $content .= "\n</IfModule>";
505
+        }
506
+
507
+        if ($content !== '') {
508
+            //suppress errors in case we don't have permissions for it
509
+            return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n");
510
+        }
511
+
512
+        return false;
513
+    }
514
+
515
+    public static function protectDataDirectory() {
516
+        //Require all denied
517
+        $now =  date('Y-m-d H:i:s');
518
+        $content = "# Generated by Nextcloud on $now\n";
519
+        $content.= "# line below if for Apache 2.4\n";
520
+        $content.= "<ifModule mod_authz_core.c>\n";
521
+        $content.= "Require all denied\n";
522
+        $content.= "</ifModule>\n\n";
523
+        $content.= "# line below if for Apache 2.2\n";
524
+        $content.= "<ifModule !mod_authz_core.c>\n";
525
+        $content.= "deny from all\n";
526
+        $content.= "Satisfy All\n";
527
+        $content.= "</ifModule>\n\n";
528
+        $content.= "# section for Apache 2.2 and 2.4\n";
529
+        $content.= "<ifModule mod_autoindex.c>\n";
530
+        $content.= "IndexIgnore *\n";
531
+        $content.= "</ifModule>\n";
532
+
533
+        $baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
534
+        file_put_contents($baseDir . '/.htaccess', $content);
535
+        file_put_contents($baseDir . '/index.html', '');
536
+    }
537
+
538
+    /**
539
+     * Return vendor from which this version was published
540
+     *
541
+     * @return string Get the vendor
542
+     *
543
+     * Copy of \OC\Updater::getVendor()
544
+     */
545
+    private function getVendor() {
546
+        // this should really be a JSON file
547
+        require \OC::$SERVERROOT . '/version.php';
548
+        /** @var string $vendor */
549
+        return (string) $vendor;
550
+    }
551 551
 }
Please login to merge, or discard this patch.
lib/private/Repair.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -54,168 +54,168 @@
 block discarded – undo
54 54
 use Symfony\Component\EventDispatcher\GenericEvent;
55 55
 
56 56
 class Repair implements IOutput{
57
-	/* @var IRepairStep[] */
58
-	private $repairSteps;
59
-	/** @var EventDispatcher */
60
-	private $dispatcher;
61
-	/** @var string */
62
-	private $currentStep;
63
-
64
-	/**
65
-	 * Creates a new repair step runner
66
-	 *
67
-	 * @param IRepairStep[] $repairSteps array of RepairStep instances
68
-	 * @param EventDispatcher $dispatcher
69
-	 */
70
-	public function __construct($repairSteps = [], EventDispatcher $dispatcher = null) {
71
-		$this->repairSteps = $repairSteps;
72
-		$this->dispatcher = $dispatcher;
73
-	}
74
-
75
-	/**
76
-	 * Run a series of repair steps for common problems
77
-	 */
78
-	public function run() {
79
-		if (count($this->repairSteps) === 0) {
80
-			$this->emit('\OC\Repair', 'info', array('No repair steps available'));
81
-			return;
82
-		}
83
-		// run each repair step
84
-		foreach ($this->repairSteps as $step) {
85
-			$this->currentStep = $step->getName();
86
-			$this->emit('\OC\Repair', 'step', [$this->currentStep]);
87
-			$step->run($this);
88
-		}
89
-	}
90
-
91
-	/**
92
-	 * Add repair step
93
-	 *
94
-	 * @param IRepairStep|string $repairStep repair step
95
-	 * @throws \Exception
96
-	 */
97
-	public function addStep($repairStep) {
98
-		if (is_string($repairStep)) {
99
-			try {
100
-				$s = \OC::$server->query($repairStep);
101
-			} catch (QueryException $e) {
102
-				if (class_exists($repairStep)) {
103
-					$s = new $repairStep();
104
-				} else {
105
-					throw new \Exception("Repair step '$repairStep' is unknown");
106
-				}
107
-			}
108
-
109
-			if ($s instanceof IRepairStep) {
110
-				$this->repairSteps[] = $s;
111
-			} else {
112
-				throw new \Exception("Repair step '$repairStep' is not of type \\OCP\\Migration\\IRepairStep");
113
-			}
114
-		} else {
115
-			$this->repairSteps[] = $repairStep;
116
-		}
117
-	}
118
-
119
-	/**
120
-	 * Returns the default repair steps to be run on the
121
-	 * command line or after an upgrade.
122
-	 *
123
-	 * @return IRepairStep[]
124
-	 */
125
-	public static function getRepairSteps() {
126
-		return [
127
-			new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false),
128
-			new RepairMimeTypes(\OC::$server->getConfig()),
129
-			new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()),
130
-			new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()),
131
-			new RemoveRootShares(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager(), \OC::$server->getLazyRootFolder()),
132
-			new MoveUpdaterStepFile(\OC::$server->getConfig()),
133
-			new FixMountStorages(\OC::$server->getDatabaseConnection()),
134
-			new RepairInvalidPaths(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
135
-			new AddLogRotateJob(\OC::$server->getJobList()),
136
-			new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(SCSSCacher::class), \OC::$server->query(JSCombiner::class)),
137
-			new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
138
-		];
139
-	}
140
-
141
-	/**
142
-	 * Returns expensive repair steps to be run on the
143
-	 * command line with a special option.
144
-	 *
145
-	 * @return IRepairStep[]
146
-	 */
147
-	public static function getExpensiveRepairSteps() {
148
-		return [
149
-			new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager())
150
-		];
151
-	}
152
-
153
-	/**
154
-	 * Returns the repair steps to be run before an
155
-	 * upgrade.
156
-	 *
157
-	 * @return IRepairStep[]
158
-	 */
159
-	public static function getBeforeUpgradeRepairSteps() {
160
-		$connection = \OC::$server->getDatabaseConnection();
161
-		$config = \OC::$server->getConfig();
162
-		$steps = [
163
-			new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connection, true),
164
-			new SqliteAutoincrement($connection),
165
-			new SaveAccountsTableData($connection, $config),
166
-			new DropAccountTermsTable($connection),
167
-		];
168
-
169
-		return $steps;
170
-	}
171
-
172
-	/**
173
-	 * @param string $scope
174
-	 * @param string $method
175
-	 * @param array $arguments
176
-	 */
177
-	public function emit($scope, $method, array $arguments = []) {
178
-		if (!is_null($this->dispatcher)) {
179
-			$this->dispatcher->dispatch("$scope::$method",
180
-				new GenericEvent("$scope::$method", $arguments));
181
-		}
182
-	}
183
-
184
-	public function info($string) {
185
-		// for now just emit as we did in the past
186
-		$this->emit('\OC\Repair', 'info', array($string));
187
-	}
188
-
189
-	/**
190
-	 * @param string $message
191
-	 */
192
-	public function warning($message) {
193
-		// for now just emit as we did in the past
194
-		$this->emit('\OC\Repair', 'warning', [$message]);
195
-	}
196
-
197
-	/**
198
-	 * @param int $max
199
-	 */
200
-	public function startProgress($max = 0) {
201
-		// for now just emit as we did in the past
202
-		$this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]);
203
-	}
204
-
205
-	/**
206
-	 * @param int $step
207
-	 * @param string $description
208
-	 */
209
-	public function advance($step = 1, $description = '') {
210
-		// for now just emit as we did in the past
211
-		$this->emit('\OC\Repair', 'advance', [$step, $description]);
212
-	}
213
-
214
-	/**
215
-	 * @param int $max
216
-	 */
217
-	public function finishProgress() {
218
-		// for now just emit as we did in the past
219
-		$this->emit('\OC\Repair', 'finishProgress', []);
220
-	}
57
+    /* @var IRepairStep[] */
58
+    private $repairSteps;
59
+    /** @var EventDispatcher */
60
+    private $dispatcher;
61
+    /** @var string */
62
+    private $currentStep;
63
+
64
+    /**
65
+     * Creates a new repair step runner
66
+     *
67
+     * @param IRepairStep[] $repairSteps array of RepairStep instances
68
+     * @param EventDispatcher $dispatcher
69
+     */
70
+    public function __construct($repairSteps = [], EventDispatcher $dispatcher = null) {
71
+        $this->repairSteps = $repairSteps;
72
+        $this->dispatcher = $dispatcher;
73
+    }
74
+
75
+    /**
76
+     * Run a series of repair steps for common problems
77
+     */
78
+    public function run() {
79
+        if (count($this->repairSteps) === 0) {
80
+            $this->emit('\OC\Repair', 'info', array('No repair steps available'));
81
+            return;
82
+        }
83
+        // run each repair step
84
+        foreach ($this->repairSteps as $step) {
85
+            $this->currentStep = $step->getName();
86
+            $this->emit('\OC\Repair', 'step', [$this->currentStep]);
87
+            $step->run($this);
88
+        }
89
+    }
90
+
91
+    /**
92
+     * Add repair step
93
+     *
94
+     * @param IRepairStep|string $repairStep repair step
95
+     * @throws \Exception
96
+     */
97
+    public function addStep($repairStep) {
98
+        if (is_string($repairStep)) {
99
+            try {
100
+                $s = \OC::$server->query($repairStep);
101
+            } catch (QueryException $e) {
102
+                if (class_exists($repairStep)) {
103
+                    $s = new $repairStep();
104
+                } else {
105
+                    throw new \Exception("Repair step '$repairStep' is unknown");
106
+                }
107
+            }
108
+
109
+            if ($s instanceof IRepairStep) {
110
+                $this->repairSteps[] = $s;
111
+            } else {
112
+                throw new \Exception("Repair step '$repairStep' is not of type \\OCP\\Migration\\IRepairStep");
113
+            }
114
+        } else {
115
+            $this->repairSteps[] = $repairStep;
116
+        }
117
+    }
118
+
119
+    /**
120
+     * Returns the default repair steps to be run on the
121
+     * command line or after an upgrade.
122
+     *
123
+     * @return IRepairStep[]
124
+     */
125
+    public static function getRepairSteps() {
126
+        return [
127
+            new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false),
128
+            new RepairMimeTypes(\OC::$server->getConfig()),
129
+            new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()),
130
+            new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()),
131
+            new RemoveRootShares(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager(), \OC::$server->getLazyRootFolder()),
132
+            new MoveUpdaterStepFile(\OC::$server->getConfig()),
133
+            new FixMountStorages(\OC::$server->getDatabaseConnection()),
134
+            new RepairInvalidPaths(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
135
+            new AddLogRotateJob(\OC::$server->getJobList()),
136
+            new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(SCSSCacher::class), \OC::$server->query(JSCombiner::class)),
137
+            new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
138
+        ];
139
+    }
140
+
141
+    /**
142
+     * Returns expensive repair steps to be run on the
143
+     * command line with a special option.
144
+     *
145
+     * @return IRepairStep[]
146
+     */
147
+    public static function getExpensiveRepairSteps() {
148
+        return [
149
+            new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager())
150
+        ];
151
+    }
152
+
153
+    /**
154
+     * Returns the repair steps to be run before an
155
+     * upgrade.
156
+     *
157
+     * @return IRepairStep[]
158
+     */
159
+    public static function getBeforeUpgradeRepairSteps() {
160
+        $connection = \OC::$server->getDatabaseConnection();
161
+        $config = \OC::$server->getConfig();
162
+        $steps = [
163
+            new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connection, true),
164
+            new SqliteAutoincrement($connection),
165
+            new SaveAccountsTableData($connection, $config),
166
+            new DropAccountTermsTable($connection),
167
+        ];
168
+
169
+        return $steps;
170
+    }
171
+
172
+    /**
173
+     * @param string $scope
174
+     * @param string $method
175
+     * @param array $arguments
176
+     */
177
+    public function emit($scope, $method, array $arguments = []) {
178
+        if (!is_null($this->dispatcher)) {
179
+            $this->dispatcher->dispatch("$scope::$method",
180
+                new GenericEvent("$scope::$method", $arguments));
181
+        }
182
+    }
183
+
184
+    public function info($string) {
185
+        // for now just emit as we did in the past
186
+        $this->emit('\OC\Repair', 'info', array($string));
187
+    }
188
+
189
+    /**
190
+     * @param string $message
191
+     */
192
+    public function warning($message) {
193
+        // for now just emit as we did in the past
194
+        $this->emit('\OC\Repair', 'warning', [$message]);
195
+    }
196
+
197
+    /**
198
+     * @param int $max
199
+     */
200
+    public function startProgress($max = 0) {
201
+        // for now just emit as we did in the past
202
+        $this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]);
203
+    }
204
+
205
+    /**
206
+     * @param int $step
207
+     * @param string $description
208
+     */
209
+    public function advance($step = 1, $description = '') {
210
+        // for now just emit as we did in the past
211
+        $this->emit('\OC\Repair', 'advance', [$step, $description]);
212
+    }
213
+
214
+    /**
215
+     * @param int $max
216
+     */
217
+    public function finishProgress() {
218
+        // for now just emit as we did in the past
219
+        $this->emit('\OC\Repair', 'finishProgress', []);
220
+    }
221 221
 }
Please login to merge, or discard this patch.
lib/private/Preview/BackgroundCleanupJob.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -32,60 +32,60 @@
 block discarded – undo
32 32
 
33 33
 class BackgroundCleanupJob extends TimedJob {
34 34
 
35
-	/** @var IDBConnection */
36
-	private $connection;
35
+    /** @var IDBConnection */
36
+    private $connection;
37 37
 
38
-	/** @var Factory */
39
-	private $appDataFactory;
38
+    /** @var Factory */
39
+    private $appDataFactory;
40 40
 
41
-	/** @var bool */
42
-	private $isCLI;
41
+    /** @var bool */
42
+    private $isCLI;
43 43
 
44
-	public function __construct(IDBConnection $connection,
45
-								Factory $appDataFactory,
46
-								bool $isCLI) {
47
-		// Run at most once an hour
48
-		$this->setInterval(3600);
44
+    public function __construct(IDBConnection $connection,
45
+                                Factory $appDataFactory,
46
+                                bool $isCLI) {
47
+        // Run at most once an hour
48
+        $this->setInterval(3600);
49 49
 
50
-		$this->connection = $connection;
51
-		$this->appDataFactory = $appDataFactory;
52
-		$this->isCLI = $isCLI;
53
-	}
50
+        $this->connection = $connection;
51
+        $this->appDataFactory = $appDataFactory;
52
+        $this->isCLI = $isCLI;
53
+    }
54 54
 
55
-	public function run($argument) {
56
-		$previews = $this->appDataFactory->get('preview');
55
+    public function run($argument) {
56
+        $previews = $this->appDataFactory->get('preview');
57 57
 
58
-		$previewFodlerId = $previews->getId();
58
+        $previewFodlerId = $previews->getId();
59 59
 
60
-		$qb = $this->connection->getQueryBuilder();
61
-		$qb->select('a.name')
62
-			->from('filecache', 'a')
63
-			->leftJoin('a', 'filecache', 'b', $qb->expr()->eq(
64
-				$qb->expr()->castColumn('a.name', IQueryBuilder::PARAM_INT), 'b.fileid'
65
-			))
66
-			->where(
67
-				$qb->expr()->isNull('b.fileid')
68
-			)->andWhere(
69
-				$qb->expr()->eq('a.parent', $qb->createNamedParameter($previewFodlerId))
70
-			);
60
+        $qb = $this->connection->getQueryBuilder();
61
+        $qb->select('a.name')
62
+            ->from('filecache', 'a')
63
+            ->leftJoin('a', 'filecache', 'b', $qb->expr()->eq(
64
+                $qb->expr()->castColumn('a.name', IQueryBuilder::PARAM_INT), 'b.fileid'
65
+            ))
66
+            ->where(
67
+                $qb->expr()->isNull('b.fileid')
68
+            )->andWhere(
69
+                $qb->expr()->eq('a.parent', $qb->createNamedParameter($previewFodlerId))
70
+            );
71 71
 
72
-		if (!$this->isCLI) {
73
-			$qb->setMaxResults(10);
74
-		}
72
+        if (!$this->isCLI) {
73
+            $qb->setMaxResults(10);
74
+        }
75 75
 
76
-		$cursor = $qb->execute();
76
+        $cursor = $qb->execute();
77 77
 
78
-		while ($row = $cursor->fetch()) {
79
-			try {
80
-				$preview = $previews->getFolder($row['name']);
81
-				$preview->delete();
82
-			} catch (NotFoundException $e) {
83
-				// continue
84
-			} catch (NotPermittedException $e) {
85
-				// continue
86
-			}
87
-		}
78
+        while ($row = $cursor->fetch()) {
79
+            try {
80
+                $preview = $previews->getFolder($row['name']);
81
+                $preview->delete();
82
+            } catch (NotFoundException $e) {
83
+                // continue
84
+            } catch (NotPermittedException $e) {
85
+                // continue
86
+            }
87
+        }
88 88
 
89
-		$cursor->closeCursor();
90
-	}
89
+        $cursor->closeCursor();
90
+    }
91 91
 }
Please login to merge, or discard this patch.
lib/private/Preview/WatcherConnector.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -29,37 +29,37 @@
 block discarded – undo
29 29
 
30 30
 class WatcherConnector {
31 31
 
32
-	/** @var IRootFolder */
33
-	private $root;
32
+    /** @var IRootFolder */
33
+    private $root;
34 34
 
35
-	/** @var SystemConfig */
36
-	private $config;
35
+    /** @var SystemConfig */
36
+    private $config;
37 37
 
38
-	/**
39
-	 * WatcherConnector constructor.
40
-	 *
41
-	 * @param IRootFolder $root
42
-	 * @param SystemConfig $config
43
-	 */
44
-	public function __construct(IRootFolder $root,
45
-								SystemConfig $config) {
46
-		$this->root = $root;
47
-		$this->config = $config;
48
-	}
38
+    /**
39
+     * WatcherConnector constructor.
40
+     *
41
+     * @param IRootFolder $root
42
+     * @param SystemConfig $config
43
+     */
44
+    public function __construct(IRootFolder $root,
45
+                                SystemConfig $config) {
46
+        $this->root = $root;
47
+        $this->config = $config;
48
+    }
49 49
 
50
-	/**
51
-	 * @return Watcher
52
-	 */
53
-	private function getWatcher(): Watcher {
54
-		return \OC::$server->query(Watcher::class);
55
-	}
50
+    /**
51
+     * @return Watcher
52
+     */
53
+    private function getWatcher(): Watcher {
54
+        return \OC::$server->query(Watcher::class);
55
+    }
56 56
 
57
-	public function connectWatcher() {
58
-		// Do not connect if we are not setup yet!
59
-		if ($this->config->getValue('instanceid', null) !== null) {
60
-			$this->root->listen('\OC\Files', 'postWrite', function (Node $node) {
61
-				$this->getWatcher()->postWrite($node);
62
-			});
63
-		}
64
-	}
57
+    public function connectWatcher() {
58
+        // Do not connect if we are not setup yet!
59
+        if ($this->config->getValue('instanceid', null) !== null) {
60
+            $this->root->listen('\OC\Files', 'postWrite', function (Node $node) {
61
+                $this->getWatcher()->postWrite($node);
62
+            });
63
+        }
64
+    }
65 65
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 	public function connectWatcher() {
58 58
 		// Do not connect if we are not setup yet!
59 59
 		if ($this->config->getValue('instanceid', null) !== null) {
60
-			$this->root->listen('\OC\Files', 'postWrite', function (Node $node) {
60
+			$this->root->listen('\OC\Files', 'postWrite', function(Node $node) {
61 61
 				$this->getWatcher()->postWrite($node);
62 62
 			});
63 63
 		}
Please login to merge, or discard this patch.
lib/private/Preview/Watcher.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -36,29 +36,29 @@
 block discarded – undo
36 36
  * Class that will watch filesystem activity and remove previews as needed.
37 37
  */
38 38
 class Watcher {
39
-	/** @var IAppData */
40
-	private $appData;
39
+    /** @var IAppData */
40
+    private $appData;
41 41
 
42
-	/**
43
-	 * Watcher constructor.
44
-	 *
45
-	 * @param IAppData $appData
46
-	 */
47
-	public function __construct(IAppData $appData) {
48
-		$this->appData = $appData;
49
-	}
42
+    /**
43
+     * Watcher constructor.
44
+     *
45
+     * @param IAppData $appData
46
+     */
47
+    public function __construct(IAppData $appData) {
48
+        $this->appData = $appData;
49
+    }
50 50
 
51
-	public function postWrite(Node $node) {
52
-		// We only handle files
53
-		if ($node instanceof Folder) {
54
-			return;
55
-		}
51
+    public function postWrite(Node $node) {
52
+        // We only handle files
53
+        if ($node instanceof Folder) {
54
+            return;
55
+        }
56 56
 
57
-		try {
58
-			$folder = $this->appData->getFolder((string)$node->getId());
59
-			$folder->delete();
60
-		} catch (NotFoundException $e) {
61
-			//Nothing to do
62
-		}
63
-	}
57
+        try {
58
+            $folder = $this->appData->getFolder((string)$node->getId());
59
+            $folder->delete();
60
+        } catch (NotFoundException $e) {
61
+            //Nothing to do
62
+        }
63
+    }
64 64
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 		}
56 56
 
57 57
 		try {
58
-			$folder = $this->appData->getFolder((string)$node->getId());
58
+			$folder = $this->appData->getFolder((string) $node->getId());
59 59
 			$folder->delete();
60 60
 		} catch (NotFoundException $e) {
61 61
 			//Nothing to do
Please login to merge, or discard this patch.