X Tutup
Skip to content

Commit dbad94a

Browse files
author
Vincent Petry
authored
Merge pull request #27238 from owncloud/show_status_in_general
Show system status in Settings/General
2 parents c9fa309 + 0616ac0 commit dbad94a

File tree

5 files changed

+97
-15
lines changed

5 files changed

+97
-15
lines changed

lib/private/Settings/SettingsManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
use OC\Settings\Panels\Admin\SecurityWarning;
5757
use OC\Settings\Panels\Admin\Updater;
5858
use OC\Settings\Panels\Admin\Tips;
59+
use OC\Settings\Panels\Admin\Status;
5960

6061
/*
6162
* @since 10.0
@@ -239,7 +240,8 @@ private function getBuiltInPanels() {
239240
FileSharing::class,
240241
Encryption::class,
241242
Certificates::class,
242-
Apps::class
243+
Apps::class,
244+
Status::class
243245
]
244246
];
245247
}

lib/public/Util.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,4 +703,29 @@ public static function needUpgrade() {
703703
}
704704
return self::$needUpgradeCache;
705705
}
706+
707+
/**
708+
* Collects all status infos.
709+
*
710+
* @return array
711+
* @since 10.0
712+
*/
713+
public static function getStatusInfo() {
714+
$systemConfig = \OC::$server->getSystemConfig();
715+
716+
$installed = (bool) $systemConfig->getValue('installed', false);
717+
$maintenance = (bool) $systemConfig->getValue('maintenance', false);
718+
# see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
719+
# for description and defaults
720+
$defaults = new \OCP\Defaults();
721+
$values = [
722+
'installed'=> $installed ? 'true' : 'false',
723+
'maintenance' => $maintenance ? 'true' : 'false',
724+
'needsDbUpgrade' => self::needUpgrade() ? 'true' : 'false',
725+
'version' => implode('.', self::getVersion()),
726+
'versionstring' => \OC_Util::getVersionString(),
727+
'edition' => \OC_Util::getEditionString(),
728+
'productname' => $defaults->getName()];
729+
return $values;
730+
}
706731
}

settings/Panels/Admin/Status.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* @author Martin Mattel <martin.mattel@diemattels.at>
4+
*
5+
* @copyright Copyright (c) 2017, ownCloud GmbH
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License, version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
namespace OC\Settings\Panels\Admin;
23+
24+
use OCP\Settings\ISettings;
25+
use OCP\Template;
26+
27+
class Status implements ISettings {
28+
29+
public function getPriority() {
30+
return 0;
31+
}
32+
33+
public function getPanel() {
34+
$tmpl = new Template('settings', 'panels/admin/status');
35+
$values = \OCP\Util::getStatusInfo();
36+
$tmpl->assign('showStatus', $values);
37+
return $tmpl;
38+
}
39+
40+
public function getSectionID() {
41+
return 'general';
42+
}
43+
44+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* @var array $_
4+
* @var \OCP\IL10N $l
5+
* @var OC_Defaults $theme
6+
*/
7+
?>
8+
<div class="section">
9+
<h2 class="app-name"><?php p($l->t('System Status'));?></h2>
10+
<table>
11+
<tr>
12+
<?php
13+
// show system status
14+
// do not translate, keep original keywords = same output as via status.php
15+
foreach ($_['showStatus'] as $statusKey => $statusValue) {
16+
?>
17+
<td style="padding: 0 15px;"><?php p($statusKey); ?></td>
18+
<td style="padding: 0 15px;"><?php p($statusValue); ?></td>
19+
</tr>
20+
<?php
21+
}
22+
?>
23+
</table>
24+
</div>

status.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,8 @@
3434

3535
require_once __DIR__ . '/lib/base.php';
3636

37-
$systemConfig = \OC::$server->getSystemConfig();
37+
$values = \OCP\Util::getStatusInfo();
3838

39-
$installed = (bool) $systemConfig->getValue('installed', false);
40-
$maintenance = (bool) $systemConfig->getValue('maintenance', false);
41-
# see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
42-
# for description and defaults
43-
$defaults = new \OCP\Defaults();
44-
$values= [
45-
'installed'=>$installed,
46-
'maintenance' => $maintenance,
47-
'needsDbUpgrade' => \OCP\Util::needUpgrade(),
48-
'version'=>implode('.', \OCP\Util::getVersion()),
49-
'versionstring'=>OC_Util::getVersionString(),
50-
'edition'=>OC_Util::getEditionString(),
51-
'productname'=>$defaults->getName()];
5239
if (OC::$CLI) {
5340
print_r($values);
5441
} else {

0 commit comments

Comments
 (0)
X Tutup