Skip to content

Commit

Permalink
Merge pull request #27473 from owncloud/kill-status.php
Browse files Browse the repository at this point in the history
No longer show the version number in the public
  • Loading branch information
Vincent Petry authored Apr 13, 2017
2 parents 52e46ab + 4abd357 commit 54150e7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
6 changes: 6 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
*/
'version' => '',

/**
* While hardening an ownCloud instance hiding the version information in status.php
* can be a legitimate step. Please consult the documentation before enabling this.
*/
'version.hide' => false,

/**
* Identifies the database used with this installation. See also config option
* ``supportedDatabases``
Expand Down
2 changes: 2 additions & 0 deletions lib/private/OCS/CoreCapabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

use OCP\Capabilities\ICapability;
use OCP\IConfig;
use OCP\Util;

/**
* Class Capabilities
Expand Down Expand Up @@ -52,6 +53,7 @@ public function getCapabilities() {
'core' => [
'pollinterval' => $this->config->getSystemValue('pollinterval', 60),
'webdav-root' => $this->config->getSystemValue('webdav-root', 'remote.php/webdav'),
'status' => Util::getStatusInfo(true),
]
];
}
Expand Down
21 changes: 15 additions & 6 deletions lib/public/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,11 @@ public static function needUpgrade() {
/**
* Collects all status infos.
*
* @return array
* @param bool $includeVersion
* @return array
* @since 10.0
*/
public static function getStatusInfo() {
public static function getStatusInfo($includeVersion = false) {
$systemConfig = \OC::$server->getSystemConfig();

$installed = (bool) $systemConfig->getValue('installed', false);
Expand All @@ -722,10 +723,18 @@ public static function getStatusInfo() {
'installed'=> $installed ? 'true' : 'false',
'maintenance' => $maintenance ? 'true' : 'false',
'needsDbUpgrade' => self::needUpgrade() ? 'true' : 'false',
'version' => implode('.', self::getVersion()),
'versionstring' => \OC_Util::getVersionString(),
'edition' => \OC_Util::getEditionString(),
'productname' => $defaults->getName()];
'version' => '',
'versionstring' => '',
'edition' => '',
'productname' => ''];

if ($includeVersion || (bool) $systemConfig->getValue('version.hide', false) === false) {
$values['version'] = implode('.', self::getVersion());
$values['versionstring'] = \OC_Util::getVersionString();
$values['edition'] = \OC_Util::getEditionString();
$values['productname'] = $defaults->getName();
}

return $values;
}
}

0 comments on commit 54150e7

Please sign in to comment.