Completed
Push — master ( ca65b8...fdb873 )
by Björn
29:58
created

status.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * @copyright Copyright (c) 2016, ownCloud, Inc.
4
 *
5
 * @author Andreas Fischer <[email protected]>
6
 * @author Christopher Schäpers <[email protected]>
7
 * @author Frank Karlitschek <[email protected]>
8
 * @author Joas Schilling <[email protected]>
9
 * @author Jörn Friedrich Dreyer <[email protected]>
10
 * @author Kristof Provost <[email protected]>
11
 * @author Lukas Reschke <[email protected]>
12
 * @author [email protected] <[email protected]>
13
 * @author Masaki Kawabata Neto <[email protected]>
14
 * @author Morris Jobke <[email protected]>
15
 *
16
 * @license AGPL-3.0
17
 *
18
 * This code is free software: you can redistribute it and/or modify
19
 * it under the terms of the GNU Affero General Public License, version 3,
20
 * as published by the Free Software Foundation.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
 * GNU Affero General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU Affero General Public License, version 3,
28
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
29
 *
30
 */
31
32
require_once __DIR__ . '/lib/versioncheck.php';
33
34
try {
35
36
	require_once __DIR__ . '/lib/base.php';
37
38
	$systemConfig = \OC::$server->getSystemConfig();
39
40
	$installed = (bool) $systemConfig->getValue('installed', false);
41
	$maintenance = (bool) $systemConfig->getValue('maintenance', false);
42
	# see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
43
	# for description and defaults
44
	$defaults = new \OCP\Defaults();
45
	$values=array(
46
		'installed'=>$installed,
47
		'maintenance' => $maintenance,
48
		'needsDbUpgrade' => \OCP\Util::needUpgrade(),
49
		'version'=>implode('.', \OCP\Util::getVersion()),
50
		'versionstring'=>OC_Util::getVersionString(),
51
		'edition'=> '',
52
		'productname'=>$defaults->getName());
53
	if (OC::$CLI) {
54
		print_r($values);
55
	} else {
56
		header('Access-Control-Allow-Origin: *');
57
		header('Content-Type: application/json');
58
		echo json_encode($values);
59
	}
60
61
} catch (Exception $ex) {
62
	http_response_code(500);
63
	\OC::$server->getLogger()->logException($ex, ['app' => 'remote']);
0 ignored issues
show
$ex is of type object<Exception>, but the function expects a object<Throwable>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
64
}
65