@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -64,10 +64,10 @@ |
||
64 | 64 | public function setupDatabase($username) { |
65 | 65 | $datadir = $this->config->getValue( |
66 | 66 | 'datadirectory', |
67 | - \OC::$SERVERROOT . '/data' |
|
67 | + \OC::$SERVERROOT.'/data' |
|
68 | 68 | ); |
69 | 69 | |
70 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
70 | + $sqliteFile = $datadir.'/'.$this->dbName.'db'; |
|
71 | 71 | if (file_exists($sqliteFile)) { |
72 | 72 | unlink($sqliteFile); |
73 | 73 | } |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | use OC\DB\ConnectionFactory; |
11 | 11 | |
12 | 12 | class Sqlite extends AbstractDatabase { |
13 | - public $dbprettyname = 'Sqlite'; |
|
13 | + public $dbprettyname = 'Sqlite'; |
|
14 | 14 | |
15 | - public function validate($config) { |
|
16 | - return []; |
|
17 | - } |
|
15 | + public function validate($config) { |
|
16 | + return []; |
|
17 | + } |
|
18 | 18 | |
19 | - public function initialize($config) { |
|
20 | - /* |
|
19 | + public function initialize($config) { |
|
20 | + /* |
|
21 | 21 | * Web: When using web based installer its not possible to set dbname |
22 | 22 | * or dbtableprefix. Defaults used from ConnectionFactory and dbtype = 'sqlite' |
23 | 23 | * is written to config.php. |
@@ -28,32 +28,32 @@ discard block |
||
28 | 28 | * in connection factory configuration is obtained from config.php. |
29 | 29 | */ |
30 | 30 | |
31 | - $this->dbName = empty($config['dbname']) |
|
32 | - ? ConnectionFactory::DEFAULT_DBNAME |
|
33 | - : $config['dbname']; |
|
34 | - |
|
35 | - $this->tablePrefix = empty($config['dbtableprefix']) |
|
36 | - ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
37 | - : $config['dbtableprefix']; |
|
38 | - |
|
39 | - if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
40 | - $this->config->setValue('dbname', $this->dbName); |
|
41 | - } |
|
42 | - |
|
43 | - if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
44 | - $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
45 | - } |
|
46 | - } |
|
47 | - |
|
48 | - public function setupDatabase($username) { |
|
49 | - $datadir = $this->config->getValue( |
|
50 | - 'datadirectory', |
|
51 | - \OC::$SERVERROOT . '/data' |
|
52 | - ); |
|
53 | - |
|
54 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
55 | - if (file_exists($sqliteFile)) { |
|
56 | - unlink($sqliteFile); |
|
57 | - } |
|
58 | - } |
|
31 | + $this->dbName = empty($config['dbname']) |
|
32 | + ? ConnectionFactory::DEFAULT_DBNAME |
|
33 | + : $config['dbname']; |
|
34 | + |
|
35 | + $this->tablePrefix = empty($config['dbtableprefix']) |
|
36 | + ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
37 | + : $config['dbtableprefix']; |
|
38 | + |
|
39 | + if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
40 | + $this->config->setValue('dbname', $this->dbName); |
|
41 | + } |
|
42 | + |
|
43 | + if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
44 | + $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
45 | + } |
|
46 | + } |
|
47 | + |
|
48 | + public function setupDatabase($username) { |
|
49 | + $datadir = $this->config->getValue( |
|
50 | + 'datadirectory', |
|
51 | + \OC::$SERVERROOT . '/data' |
|
52 | + ); |
|
53 | + |
|
54 | + $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
55 | + if (file_exists($sqliteFile)) { |
|
56 | + unlink($sqliteFile); |
|
57 | + } |
|
58 | + } |
|
59 | 59 | } |
@@ -8,6 +8,6 @@ |
||
8 | 8 | </p> |
9 | 9 | <br /> |
10 | 10 | <p> |
11 | - <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="' . $_['docUrl'] . '" target="blank">', '</a>'])); ?> |
|
11 | + <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="'.$_['docUrl'].'" target="blank">', '</a>'])); ?> |
|
12 | 12 | </p> |
13 | 13 | </div> |
@@ -98,10 +98,10 @@ |
||
98 | 98 | if (empty($state->getEnforcedGroups())) { |
99 | 99 | $message = 'Two-factor authentication is enforced for all users'; |
100 | 100 | } else { |
101 | - $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
101 | + $message = 'Two-factor authentication is enforced for members of the group(s) '.implode(', ', $state->getEnforcedGroups()); |
|
102 | 102 | } |
103 | 103 | if (!empty($state->getExcludedGroups())) { |
104 | - $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
104 | + $message .= ', except members of '.implode(', ', $state->getExcludedGroups()); |
|
105 | 105 | } |
106 | 106 | $output->writeln($message); |
107 | 107 | } |
@@ -17,72 +17,72 @@ |
||
17 | 17 | use function implode; |
18 | 18 | |
19 | 19 | class Enforce extends Command { |
20 | - public function __construct( |
|
21 | - private MandatoryTwoFactor $mandatoryTwoFactor, |
|
22 | - ) { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
20 | + public function __construct( |
|
21 | + private MandatoryTwoFactor $mandatoryTwoFactor, |
|
22 | + ) { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | 25 | |
26 | - protected function configure() { |
|
27 | - $this->setName('twofactorauth:enforce'); |
|
28 | - $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
29 | - $this->addOption( |
|
30 | - 'on', |
|
31 | - null, |
|
32 | - InputOption::VALUE_NONE, |
|
33 | - 'enforce two-factor authentication' |
|
34 | - ); |
|
35 | - $this->addOption( |
|
36 | - 'off', |
|
37 | - null, |
|
38 | - InputOption::VALUE_NONE, |
|
39 | - 'don\'t enforce two-factor authenticaton' |
|
40 | - ); |
|
41 | - $this->addOption( |
|
42 | - 'group', |
|
43 | - null, |
|
44 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
45 | - 'enforce only for the given group(s)' |
|
46 | - ); |
|
47 | - $this->addOption( |
|
48 | - 'exclude', |
|
49 | - null, |
|
50 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
51 | - 'exclude mandatory two-factor auth for the given group(s)' |
|
52 | - ); |
|
53 | - } |
|
26 | + protected function configure() { |
|
27 | + $this->setName('twofactorauth:enforce'); |
|
28 | + $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
29 | + $this->addOption( |
|
30 | + 'on', |
|
31 | + null, |
|
32 | + InputOption::VALUE_NONE, |
|
33 | + 'enforce two-factor authentication' |
|
34 | + ); |
|
35 | + $this->addOption( |
|
36 | + 'off', |
|
37 | + null, |
|
38 | + InputOption::VALUE_NONE, |
|
39 | + 'don\'t enforce two-factor authenticaton' |
|
40 | + ); |
|
41 | + $this->addOption( |
|
42 | + 'group', |
|
43 | + null, |
|
44 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
45 | + 'enforce only for the given group(s)' |
|
46 | + ); |
|
47 | + $this->addOption( |
|
48 | + 'exclude', |
|
49 | + null, |
|
50 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
51 | + 'exclude mandatory two-factor auth for the given group(s)' |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | - if ($input->getOption('on')) { |
|
57 | - $enforcedGroups = $input->getOption('group'); |
|
58 | - $excludedGroups = $input->getOption('exclude'); |
|
59 | - $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
60 | - } elseif ($input->getOption('off')) { |
|
61 | - $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
62 | - } |
|
55 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | + if ($input->getOption('on')) { |
|
57 | + $enforcedGroups = $input->getOption('group'); |
|
58 | + $excludedGroups = $input->getOption('exclude'); |
|
59 | + $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
60 | + } elseif ($input->getOption('off')) { |
|
61 | + $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
62 | + } |
|
63 | 63 | |
64 | - $state = $this->mandatoryTwoFactor->getState(); |
|
65 | - if ($state->isEnforced()) { |
|
66 | - $this->writeEnforced($output, $state); |
|
67 | - } else { |
|
68 | - $this->writeNotEnforced($output); |
|
69 | - } |
|
70 | - return 0; |
|
71 | - } |
|
64 | + $state = $this->mandatoryTwoFactor->getState(); |
|
65 | + if ($state->isEnforced()) { |
|
66 | + $this->writeEnforced($output, $state); |
|
67 | + } else { |
|
68 | + $this->writeNotEnforced($output); |
|
69 | + } |
|
70 | + return 0; |
|
71 | + } |
|
72 | 72 | |
73 | - protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
74 | - if (empty($state->getEnforcedGroups())) { |
|
75 | - $message = 'Two-factor authentication is enforced for all users'; |
|
76 | - } else { |
|
77 | - $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
78 | - } |
|
79 | - if (!empty($state->getExcludedGroups())) { |
|
80 | - $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
81 | - } |
|
82 | - $output->writeln($message); |
|
83 | - } |
|
73 | + protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
74 | + if (empty($state->getEnforcedGroups())) { |
|
75 | + $message = 'Two-factor authentication is enforced for all users'; |
|
76 | + } else { |
|
77 | + $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
78 | + } |
|
79 | + if (!empty($state->getExcludedGroups())) { |
|
80 | + $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
81 | + } |
|
82 | + $output->writeln($message); |
|
83 | + } |
|
84 | 84 | |
85 | - protected function writeNotEnforced(OutputInterface $output) { |
|
86 | - $output->writeln('Two-factor authentication is not enforced'); |
|
87 | - } |
|
85 | + protected function writeNotEnforced(OutputInterface $output) { |
|
86 | + $output->writeln('Two-factor authentication is not enforced'); |
|
87 | + } |
|
88 | 88 | } |