Completed
Push — master ( 57ea46...72dc01 )
by Blizzz
14:28
created
lib/private/Encryption/HookManager.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -27,50 +27,50 @@
 block discarded – undo
27 27
 use OC\Files\View;
28 28
 
29 29
 class HookManager {
30
-	/**
31
-	 * @var Update
32
-	 */
33
-	private static $updater;
30
+    /**
31
+     * @var Update
32
+     */
33
+    private static $updater;
34 34
 
35
-	public static function postShared($params) {
36
-		self::getUpdate()->postShared($params);
37
-	}
38
-	public static function postUnshared($params) {
39
-		self::getUpdate()->postUnshared($params);
40
-	}
35
+    public static function postShared($params) {
36
+        self::getUpdate()->postShared($params);
37
+    }
38
+    public static function postUnshared($params) {
39
+        self::getUpdate()->postUnshared($params);
40
+    }
41 41
 
42
-	public static function postRename($params) {
43
-		self::getUpdate()->postRename($params);
44
-	}
42
+    public static function postRename($params) {
43
+        self::getUpdate()->postRename($params);
44
+    }
45 45
 
46
-	public static function postRestore($params) {
47
-		self::getUpdate()->postRestore($params);
48
-	}
46
+    public static function postRestore($params) {
47
+        self::getUpdate()->postRestore($params);
48
+    }
49 49
 
50
-	/**
51
-	 * @return Update
52
-	 */
53
-	private static function getUpdate() {
54
-		if (is_null(self::$updater)) {
55
-			$user = \OC::$server->getUserSession()->getUser();
56
-			$uid = '';
57
-			if ($user) {
58
-				$uid = $user->getUID();
59
-			}
60
-			self::$updater = new Update(
61
-				new View(),
62
-				new Util(
63
-					new View(),
64
-					\OC::$server->getUserManager(),
65
-					\OC::$server->getGroupManager(),
66
-					\OC::$server->getConfig()),
67
-				Filesystem::getMountManager(),
68
-				\OC::$server->getEncryptionManager(),
69
-				\OC::$server->getEncryptionFilesHelper(),
70
-				$uid
71
-			);
72
-		}
50
+    /**
51
+     * @return Update
52
+     */
53
+    private static function getUpdate() {
54
+        if (is_null(self::$updater)) {
55
+            $user = \OC::$server->getUserSession()->getUser();
56
+            $uid = '';
57
+            if ($user) {
58
+                $uid = $user->getUID();
59
+            }
60
+            self::$updater = new Update(
61
+                new View(),
62
+                new Util(
63
+                    new View(),
64
+                    \OC::$server->getUserManager(),
65
+                    \OC::$server->getGroupManager(),
66
+                    \OC::$server->getConfig()),
67
+                Filesystem::getMountManager(),
68
+                \OC::$server->getEncryptionManager(),
69
+                \OC::$server->getEncryptionFilesHelper(),
70
+                $uid
71
+            );
72
+        }
73 73
 
74
-		return self::$updater;
75
-	}
74
+        return self::$updater;
75
+    }
76 76
 }
Please login to merge, or discard this patch.
ocs-provider/index.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
 $server = \OC::$server;
27 27
 
28 28
 $controller = new \OC\OCS\Provider(
29
-	'ocs_provider',
30
-	$server->getRequest(),
31
-	$server->getAppManager()
29
+    'ocs_provider',
30
+    $server->getRequest(),
31
+    $server->getAppManager()
32 32
 );
33 33
 echo $controller->buildProviderList()->render();
Please login to merge, or discard this patch.
core/templates/update.admin.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 		<h2 class="title"><?php p($l->t('App update required')); ?></h2>
5 5
 		<?php } else { ?>
6 6
 		<h2 class="title"><?php p($l->t('%s will be updated to version %s',
7
-			array($_['productName'], $_['version']))); ?></h2>
7
+            array($_['productName'], $_['version']))); ?></h2>
8 8
 		<?php } ?>
9 9
 		<?php if (!empty($_['appsToUpgrade'])) { ?>
10 10
 		<div class="infogroup">
Please login to merge, or discard this patch.
core/templates/exception.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-	/** @var array $_ */
3
-	/** @var \OCP\IL10N $l */
2
+    /** @var array $_ */
3
+    /** @var \OCP\IL10N $l */
4 4
 
5 5
 style('core', ['styles', 'header']);
6 6
 ?>
Please login to merge, or discard this patch.
core/Controller/UserController.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -29,46 +29,46 @@
 block discarded – undo
29 29
 use \OCP\IUserManager;
30 30
 
31 31
 class UserController extends Controller {
32
-	/**
33
-	 * @var IUserManager
34
-	 */
35
-	protected $userManager;
32
+    /**
33
+     * @var IUserManager
34
+     */
35
+    protected $userManager;
36 36
 
37
-	public function __construct($appName,
38
-								IRequest $request,
39
-								IUserManager $userManager
40
-	) {
41
-		parent::__construct($appName, $request);
42
-		$this->userManager = $userManager;
43
-	}
37
+    public function __construct($appName,
38
+                                IRequest $request,
39
+                                IUserManager $userManager
40
+    ) {
41
+        parent::__construct($appName, $request);
42
+        $this->userManager = $userManager;
43
+    }
44 44
 
45
-	/**
46
-	 * Lookup user display names
47
-	 *
48
-	 * @NoAdminRequired
49
-	 *
50
-	 * @param array $users
51
-	 *
52
-	 * @return JSONResponse
53
-	 */
54
-	public function getDisplayNames($users) {
55
-		$result = array();
45
+    /**
46
+     * Lookup user display names
47
+     *
48
+     * @NoAdminRequired
49
+     *
50
+     * @param array $users
51
+     *
52
+     * @return JSONResponse
53
+     */
54
+    public function getDisplayNames($users) {
55
+        $result = array();
56 56
 
57
-		foreach ($users as $user) {
58
-			$userObject = $this->userManager->get($user);
59
-			if (is_object($userObject)) {
60
-				$result[$user] = $userObject->getDisplayName();
61
-			} else {
62
-				$result[$user] = $user;
63
-			}
64
-		}
57
+        foreach ($users as $user) {
58
+            $userObject = $this->userManager->get($user);
59
+            if (is_object($userObject)) {
60
+                $result[$user] = $userObject->getDisplayName();
61
+            } else {
62
+                $result[$user] = $user;
63
+            }
64
+        }
65 65
 
66
-		$json = array(
67
-			'users' => $result,
68
-			'status' => 'success'
69
-		);
66
+        $json = array(
67
+            'users' => $result,
68
+            'status' => 'success'
69
+        );
70 70
 
71
-		return new JSONResponse($json);
71
+        return new JSONResponse($json);
72 72
 
73
-	}
73
+    }
74 74
 }
Please login to merge, or discard this patch.
core/Command/Security/RemoveCertificate.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -34,28 +34,28 @@
 block discarded – undo
34 34
 
35 35
 class RemoveCertificate extends Base {
36 36
 
37
-	/** @var ICertificateManager */
38
-	protected $certificateManager;
39
-
40
-	public function __construct(ICertificateManager $certificateManager) {
41
-		$this->certificateManager = $certificateManager;
42
-		parent::__construct();
43
-	}
44
-
45
-	protected function configure() {
46
-		$this
47
-			->setName('security:certificates:remove')
48
-			->setDescription('remove trusted certificate')
49
-			->addArgument(
50
-				'name',
51
-				InputArgument::REQUIRED,
52
-				'the file name of the certificate to remove'
53
-			);
54
-	}
55
-
56
-	protected function execute(InputInterface $input, OutputInterface $output) {
57
-		$name = $input->getArgument('name');
58
-
59
-		$this->certificateManager->removeCertificate($name);
60
-	}
37
+    /** @var ICertificateManager */
38
+    protected $certificateManager;
39
+
40
+    public function __construct(ICertificateManager $certificateManager) {
41
+        $this->certificateManager = $certificateManager;
42
+        parent::__construct();
43
+    }
44
+
45
+    protected function configure() {
46
+        $this
47
+            ->setName('security:certificates:remove')
48
+            ->setDescription('remove trusted certificate')
49
+            ->addArgument(
50
+                'name',
51
+                InputArgument::REQUIRED,
52
+                'the file name of the certificate to remove'
53
+            );
54
+    }
55
+
56
+    protected function execute(InputInterface $input, OutputInterface $output) {
57
+        $name = $input->getArgument('name');
58
+
59
+        $this->certificateManager->removeCertificate($name);
60
+    }
61 61
 }
Please login to merge, or discard this patch.
core/Command/Security/ListCertificates.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -34,64 +34,64 @@
 block discarded – undo
34 34
 
35 35
 class ListCertificates extends Base {
36 36
 
37
-	/** @var ICertificateManager */
38
-	protected $certificateManager;
39
-	/** @var IL10N */
40
-	protected $l;
37
+    /** @var ICertificateManager */
38
+    protected $certificateManager;
39
+    /** @var IL10N */
40
+    protected $l;
41 41
 
42
-	public function __construct(ICertificateManager $certificateManager, IL10N $l) {
43
-		$this->certificateManager = $certificateManager;
44
-		$this->l = $l;
45
-		parent::__construct();
46
-	}
42
+    public function __construct(ICertificateManager $certificateManager, IL10N $l) {
43
+        $this->certificateManager = $certificateManager;
44
+        $this->l = $l;
45
+        parent::__construct();
46
+    }
47 47
 
48
-	protected function configure() {
49
-		$this
50
-			->setName('security:certificates')
51
-			->setDescription('list trusted certificates');
52
-		parent::configure();
53
-	}
48
+    protected function configure() {
49
+        $this
50
+            ->setName('security:certificates')
51
+            ->setDescription('list trusted certificates');
52
+        parent::configure();
53
+    }
54 54
 
55
-	protected function execute(InputInterface $input, OutputInterface $output) {
56
-		$outputType = $input->getOption('output');
57
-		if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
58
-			$certificates = array_map(function (ICertificate $certificate) {
59
-				return [
60
-					'name' => $certificate->getName(),
61
-					'common_name' => $certificate->getCommonName(),
62
-					'organization' => $certificate->getOrganization(),
63
-					'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM),
64
-					'issuer' => $certificate->getIssuerName(),
65
-					'issuer_organization' => $certificate->getIssuerOrganization(),
66
-					'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM)
67
-				];
68
-			}, $this->certificateManager->listCertificates());
69
-			if ($outputType === self::OUTPUT_FORMAT_JSON) {
70
-				$output->writeln(json_encode(array_values($certificates)));
71
-			} else {
72
-				$output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT));
73
-			}
74
-		} else {
75
-			$table = new Table($output);
76
-			$table->setHeaders([
77
-				'File Name',
78
-				'Common Name',
79
-				'Organization',
80
-				'Valid Until',
81
-				'Issued By'
82
-			]);
55
+    protected function execute(InputInterface $input, OutputInterface $output) {
56
+        $outputType = $input->getOption('output');
57
+        if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
58
+            $certificates = array_map(function (ICertificate $certificate) {
59
+                return [
60
+                    'name' => $certificate->getName(),
61
+                    'common_name' => $certificate->getCommonName(),
62
+                    'organization' => $certificate->getOrganization(),
63
+                    'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM),
64
+                    'issuer' => $certificate->getIssuerName(),
65
+                    'issuer_organization' => $certificate->getIssuerOrganization(),
66
+                    'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM)
67
+                ];
68
+            }, $this->certificateManager->listCertificates());
69
+            if ($outputType === self::OUTPUT_FORMAT_JSON) {
70
+                $output->writeln(json_encode(array_values($certificates)));
71
+            } else {
72
+                $output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT));
73
+            }
74
+        } else {
75
+            $table = new Table($output);
76
+            $table->setHeaders([
77
+                'File Name',
78
+                'Common Name',
79
+                'Organization',
80
+                'Valid Until',
81
+                'Issued By'
82
+            ]);
83 83
 
84
-			$rows = array_map(function (ICertificate $certificate) {
85
-				return [
86
-					$certificate->getName(),
87
-					$certificate->getCommonName(),
88
-					$certificate->getOrganization(),
89
-					$this->l->l('date', $certificate->getExpireDate()),
90
-					$certificate->getIssuerName()
91
-				];
92
-			}, $this->certificateManager->listCertificates());
93
-			$table->setRows($rows);
94
-			$table->render();
95
-		}
96
-	}
84
+            $rows = array_map(function (ICertificate $certificate) {
85
+                return [
86
+                    $certificate->getName(),
87
+                    $certificate->getCommonName(),
88
+                    $certificate->getOrganization(),
89
+                    $this->l->l('date', $certificate->getExpireDate()),
90
+                    $certificate->getIssuerName()
91
+                ];
92
+            }, $this->certificateManager->listCertificates());
93
+            $table->setRows($rows);
94
+            $table->render();
95
+        }
96
+    }
97 97
 }
Please login to merge, or discard this patch.
core/Command/Security/ImportCertificate.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,36 +33,36 @@
 block discarded – undo
33 33
 
34 34
 class ImportCertificate extends Base {
35 35
 
36
-	/** @var ICertificateManager */
37
-	protected $certificateManager;
36
+    /** @var ICertificateManager */
37
+    protected $certificateManager;
38 38
 
39
-	public function __construct(ICertificateManager $certificateManager) {
40
-		$this->certificateManager = $certificateManager;
41
-		parent::__construct();
42
-	}
39
+    public function __construct(ICertificateManager $certificateManager) {
40
+        $this->certificateManager = $certificateManager;
41
+        parent::__construct();
42
+    }
43 43
 
44
-	protected function configure() {
45
-		$this
46
-			->setName('security:certificates:import')
47
-			->setDescription('import trusted certificate')
48
-			->addArgument(
49
-				'path',
50
-				InputArgument::REQUIRED,
51
-				'path to the certificate to import'
52
-			);
53
-	}
44
+    protected function configure() {
45
+        $this
46
+            ->setName('security:certificates:import')
47
+            ->setDescription('import trusted certificate')
48
+            ->addArgument(
49
+                'path',
50
+                InputArgument::REQUIRED,
51
+                'path to the certificate to import'
52
+            );
53
+    }
54 54
 
55
-	protected function execute(InputInterface $input, OutputInterface $output) {
56
-		$path = $input->getArgument('path');
55
+    protected function execute(InputInterface $input, OutputInterface $output) {
56
+        $path = $input->getArgument('path');
57 57
 
58
-		if (!file_exists($path)) {
59
-			$output->writeln('<error>certificate not found</error>');
60
-			return;
61
-		}
58
+        if (!file_exists($path)) {
59
+            $output->writeln('<error>certificate not found</error>');
60
+            return;
61
+        }
62 62
 
63
-		$certData = file_get_contents($path);
64
-		$name = basename($path);
63
+        $certData = file_get_contents($path);
64
+        $name = basename($path);
65 65
 
66
-		$this->certificateManager->addCertificate($certData, $name);
67
-	}
66
+        $this->certificateManager->addCertificate($certData, $name);
67
+    }
68 68
 }
Please login to merge, or discard this patch.
core/Command/Log/Manage.php 1 patch
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -34,167 +34,167 @@
 block discarded – undo
34 34
 
35 35
 class Manage extends Command implements CompletionAwareInterface {
36 36
 
37
-	const DEFAULT_BACKEND = 'file';
38
-	const DEFAULT_LOG_LEVEL = 2;
39
-	const DEFAULT_TIMEZONE = 'UTC';
40
-
41
-	/** @var IConfig */
42
-	protected $config;
43
-
44
-	public function __construct(IConfig $config) {
45
-		$this->config = $config;
46
-		parent::__construct();
47
-	}
48
-
49
-	protected function configure() {
50
-		$this
51
-			->setName('log:manage')
52
-			->setDescription('manage logging configuration')
53
-			->addOption(
54
-				'backend',
55
-				null,
56
-				InputOption::VALUE_REQUIRED,
57
-				'set the logging backend [file, syslog, errorlog]'
58
-			)
59
-			->addOption(
60
-				'level',
61
-				null,
62
-				InputOption::VALUE_REQUIRED,
63
-				'set the log level [debug, info, warning, error]'
64
-			)
65
-			->addOption(
66
-				'timezone',
67
-				null,
68
-				InputOption::VALUE_REQUIRED,
69
-				'set the logging timezone'
70
-			)
71
-		;
72
-	}
73
-
74
-	protected function execute(InputInterface $input, OutputInterface $output) {
75
-		// collate config setting to the end, to avoid partial configuration
76
-		$toBeSet = [];
77
-
78
-		if ($backend = $input->getOption('backend')) {
79
-			$this->validateBackend($backend);
80
-			$toBeSet['log_type'] = $backend;
81
-		}
82
-
83
-		$level = $input->getOption('level');
84
-		if ($level !== null) {
85
-			if (is_numeric($level)) {
86
-				$levelNum = $level;
87
-				// sanity check
88
-				$this->convertLevelNumber($levelNum);
89
-			} else {
90
-				$levelNum = $this->convertLevelString($level);
91
-			}
92
-			$toBeSet['loglevel'] = $levelNum;
93
-		}
94
-
95
-		if ($timezone = $input->getOption('timezone')) {
96
-			$this->validateTimezone($timezone);
97
-			$toBeSet['logtimezone'] = $timezone;
98
-		}
99
-
100
-		// set config
101
-		foreach ($toBeSet as $option => $value) {
102
-			$this->config->setSystemValue($option, $value);
103
-		}
104
-
105
-		// display configuration
106
-		$backend = $this->config->getSystemValue('log_type', self::DEFAULT_BACKEND);
107
-		$output->writeln('Enabled logging backend: '.$backend);
108
-
109
-		$levelNum = $this->config->getSystemValue('loglevel', self::DEFAULT_LOG_LEVEL);
110
-		$level = $this->convertLevelNumber($levelNum);
111
-		$output->writeln('Log level: '.$level.' ('.$levelNum.')');
112
-
113
-		$timezone = $this->config->getSystemValue('logtimezone', self::DEFAULT_TIMEZONE);
114
-		$output->writeln('Log timezone: '.$timezone);
115
-	}
116
-
117
-	/**
118
-	 * @param string $backend
119
-	 * @throws \InvalidArgumentException
120
-	 */
121
-	protected function validateBackend($backend) {
122
-		if (!class_exists('OC\\Log\\'.ucfirst($backend))) {
123
-			throw new \InvalidArgumentException('Invalid backend');
124
-		}
125
-	}
126
-
127
-	/**
128
-	 * @param string $timezone
129
-	 * @throws \Exception
130
-	 */
131
-	protected function validateTimezone($timezone) {
132
-		new \DateTimeZone($timezone);
133
-	}
134
-
135
-	/**
136
-	 * @param string $level
137
-	 * @return int
138
-	 * @throws \InvalidArgumentException
139
-	 */
140
-	protected function convertLevelString($level) {
141
-		$level = strtolower($level);
142
-		switch ($level) {
143
-		case 'debug':
144
-			return 0;
145
-		case 'info':
146
-			return 1;
147
-		case 'warning':
148
-		case 'warn':
149
-			return 2;
150
-		case 'error':
151
-		case 'err':
152
-			return 3;
153
-		}
154
-		throw new \InvalidArgumentException('Invalid log level string');
155
-	}
156
-
157
-	/**
158
-	 * @param int $levelNum
159
-	 * @return string
160
-	 * @throws \InvalidArgumentException
161
-	 */
162
-	protected function convertLevelNumber($levelNum) {
163
-		switch ($levelNum) {
164
-		case 0:
165
-			return 'Debug';
166
-		case 1:
167
-			return 'Info';
168
-		case 2:
169
-			return 'Warning';
170
-		case 3:
171
-			return 'Error';
172
-		}
173
-		throw new \InvalidArgumentException('Invalid log level number');
174
-	}
175
-
176
-	/**
177
-	 * @param string $optionName
178
-	 * @param CompletionContext $context
179
-	 * @return string[]
180
-	 */
181
-	public function completeOptionValues($optionName, CompletionContext $context) {
182
-		if ($optionName === 'backend') {
183
-			return ['file', 'syslog', 'errorlog'];
184
-		} else if ($optionName === 'level') {
185
-			return ['debug', 'info', 'warning', 'error'];
186
-		} else if ($optionName === 'timezone') {
187
-			return \DateTimeZone::listIdentifiers();
188
-		}
189
-		return [];
190
-	}
191
-
192
-	/**
193
-	 * @param string $argumentName
194
-	 * @param CompletionContext $context
195
-	 * @return string[]
196
-	 */
197
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
198
-		return [];
199
-	}
37
+    const DEFAULT_BACKEND = 'file';
38
+    const DEFAULT_LOG_LEVEL = 2;
39
+    const DEFAULT_TIMEZONE = 'UTC';
40
+
41
+    /** @var IConfig */
42
+    protected $config;
43
+
44
+    public function __construct(IConfig $config) {
45
+        $this->config = $config;
46
+        parent::__construct();
47
+    }
48
+
49
+    protected function configure() {
50
+        $this
51
+            ->setName('log:manage')
52
+            ->setDescription('manage logging configuration')
53
+            ->addOption(
54
+                'backend',
55
+                null,
56
+                InputOption::VALUE_REQUIRED,
57
+                'set the logging backend [file, syslog, errorlog]'
58
+            )
59
+            ->addOption(
60
+                'level',
61
+                null,
62
+                InputOption::VALUE_REQUIRED,
63
+                'set the log level [debug, info, warning, error]'
64
+            )
65
+            ->addOption(
66
+                'timezone',
67
+                null,
68
+                InputOption::VALUE_REQUIRED,
69
+                'set the logging timezone'
70
+            )
71
+        ;
72
+    }
73
+
74
+    protected function execute(InputInterface $input, OutputInterface $output) {
75
+        // collate config setting to the end, to avoid partial configuration
76
+        $toBeSet = [];
77
+
78
+        if ($backend = $input->getOption('backend')) {
79
+            $this->validateBackend($backend);
80
+            $toBeSet['log_type'] = $backend;
81
+        }
82
+
83
+        $level = $input->getOption('level');
84
+        if ($level !== null) {
85
+            if (is_numeric($level)) {
86
+                $levelNum = $level;
87
+                // sanity check
88
+                $this->convertLevelNumber($levelNum);
89
+            } else {
90
+                $levelNum = $this->convertLevelString($level);
91
+            }
92
+            $toBeSet['loglevel'] = $levelNum;
93
+        }
94
+
95
+        if ($timezone = $input->getOption('timezone')) {
96
+            $this->validateTimezone($timezone);
97
+            $toBeSet['logtimezone'] = $timezone;
98
+        }
99
+
100
+        // set config
101
+        foreach ($toBeSet as $option => $value) {
102
+            $this->config->setSystemValue($option, $value);
103
+        }
104
+
105
+        // display configuration
106
+        $backend = $this->config->getSystemValue('log_type', self::DEFAULT_BACKEND);
107
+        $output->writeln('Enabled logging backend: '.$backend);
108
+
109
+        $levelNum = $this->config->getSystemValue('loglevel', self::DEFAULT_LOG_LEVEL);
110
+        $level = $this->convertLevelNumber($levelNum);
111
+        $output->writeln('Log level: '.$level.' ('.$levelNum.')');
112
+
113
+        $timezone = $this->config->getSystemValue('logtimezone', self::DEFAULT_TIMEZONE);
114
+        $output->writeln('Log timezone: '.$timezone);
115
+    }
116
+
117
+    /**
118
+     * @param string $backend
119
+     * @throws \InvalidArgumentException
120
+     */
121
+    protected function validateBackend($backend) {
122
+        if (!class_exists('OC\\Log\\'.ucfirst($backend))) {
123
+            throw new \InvalidArgumentException('Invalid backend');
124
+        }
125
+    }
126
+
127
+    /**
128
+     * @param string $timezone
129
+     * @throws \Exception
130
+     */
131
+    protected function validateTimezone($timezone) {
132
+        new \DateTimeZone($timezone);
133
+    }
134
+
135
+    /**
136
+     * @param string $level
137
+     * @return int
138
+     * @throws \InvalidArgumentException
139
+     */
140
+    protected function convertLevelString($level) {
141
+        $level = strtolower($level);
142
+        switch ($level) {
143
+        case 'debug':
144
+            return 0;
145
+        case 'info':
146
+            return 1;
147
+        case 'warning':
148
+        case 'warn':
149
+            return 2;
150
+        case 'error':
151
+        case 'err':
152
+            return 3;
153
+        }
154
+        throw new \InvalidArgumentException('Invalid log level string');
155
+    }
156
+
157
+    /**
158
+     * @param int $levelNum
159
+     * @return string
160
+     * @throws \InvalidArgumentException
161
+     */
162
+    protected function convertLevelNumber($levelNum) {
163
+        switch ($levelNum) {
164
+        case 0:
165
+            return 'Debug';
166
+        case 1:
167
+            return 'Info';
168
+        case 2:
169
+            return 'Warning';
170
+        case 3:
171
+            return 'Error';
172
+        }
173
+        throw new \InvalidArgumentException('Invalid log level number');
174
+    }
175
+
176
+    /**
177
+     * @param string $optionName
178
+     * @param CompletionContext $context
179
+     * @return string[]
180
+     */
181
+    public function completeOptionValues($optionName, CompletionContext $context) {
182
+        if ($optionName === 'backend') {
183
+            return ['file', 'syslog', 'errorlog'];
184
+        } else if ($optionName === 'level') {
185
+            return ['debug', 'info', 'warning', 'error'];
186
+        } else if ($optionName === 'timezone') {
187
+            return \DateTimeZone::listIdentifiers();
188
+        }
189
+        return [];
190
+    }
191
+
192
+    /**
193
+     * @param string $argumentName
194
+     * @param CompletionContext $context
195
+     * @return string[]
196
+     */
197
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
198
+        return [];
199
+    }
200 200
 }
Please login to merge, or discard this patch.