mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 06:08:46 -04:00
Merge pull request #57781 from nextcloud/bugfix/57766/allow-openmetrics-infoxml
This commit is contained in:
commit
afe1c1ebde
10 changed files with 64 additions and 18 deletions
|
|
@ -196,6 +196,9 @@ class InfoParser {
|
|||
if (isset($array['dependencies']['backend']) && !is_array($array['dependencies']['backend'])) {
|
||||
$array['dependencies']['backend'] = [$array['dependencies']['backend']];
|
||||
}
|
||||
if (isset($array['openmetrics']['exporter']) && !is_array($array['openmetrics']['exporter'])) {
|
||||
$array['openmetrics']['exporter'] = [$array['openmetrics']['exporter']];
|
||||
}
|
||||
|
||||
// Ensure some fields are always arrays
|
||||
if (isset($array['screenshot']) && !is_array($array['screenshot'])) {
|
||||
|
|
|
|||
|
|
@ -64,10 +64,7 @@ class ExporterManager {
|
|||
if (!isset($appInfo[self::XML_ENTRY]) || !is_array($appInfo[self::XML_ENTRY])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($appInfo[self::XML_ENTRY] as $classEntries) {
|
||||
// When multiple exporters are specified, $classEntries will be an array, instead of a string
|
||||
$classnames = is_array($classEntries) ? $classEntries : [$classEntries];
|
||||
|
||||
foreach ($appInfo[self::XML_ENTRY] as $classnames) {
|
||||
foreach ($classnames as $classname) {
|
||||
if (isset($this->skippedClasses[$classname])) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@
|
|||
maxOccurs="1"/>
|
||||
<xs:element name="collaboration" type="collaboration" minOccurs="0"
|
||||
maxOccurs="1" />
|
||||
<xs:element name="openmetrics" type="openmetrics" minOccurs="0"
|
||||
maxOccurs="1" />
|
||||
<xs:element name="sabre" type="sabre" minOccurs="0"
|
||||
maxOccurs="1" />
|
||||
<xs:element name="public" type="public" minOccurs="0"
|
||||
|
|
@ -408,16 +410,16 @@
|
|||
|
||||
<xs:complexType name="settings">
|
||||
<xs:sequence>
|
||||
<xs:element name="admin" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="admin" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-section" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="personal" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="personal-section" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-delegation" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-delegation-section" type="php-class" minOccurs="0"
|
||||
<xs:element name="admin-delegation" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-delegation-section" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
|
@ -529,6 +531,18 @@
|
|||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="openmetrics">
|
||||
<xs:sequence>
|
||||
<xs:element name="exporter" type="openmetrics-exporter" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="openmetrics-exporter">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="php-class"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="sabre">
|
||||
<xs:sequence>
|
||||
<xs:element name="collections" type="sabre-collections" minOccurs="0" maxOccurs="1"/>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@
|
|||
maxOccurs="1"/>
|
||||
<xs:element name="collaboration" type="collaboration" minOccurs="0"
|
||||
maxOccurs="1" />
|
||||
<xs:element name="openmetrics" type="openmetrics" minOccurs="0"
|
||||
maxOccurs="1" />
|
||||
<xs:element name="sabre" type="sabre" minOccurs="0"
|
||||
maxOccurs="1" />
|
||||
<xs:element name="trash" type="trash" minOccurs="0"
|
||||
|
|
@ -404,16 +406,16 @@
|
|||
|
||||
<xs:complexType name="settings">
|
||||
<xs:sequence>
|
||||
<xs:element name="admin" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-section" type="php-class" minOccurs="0"
|
||||
<xs:element name="admin" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-section" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="personal" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="personal-section" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-delegation" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-delegation-section" type="php-class" minOccurs="0"
|
||||
<xs:element name="admin-delegation" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="admin-delegation-section" type="php-class" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
|
@ -525,6 +527,18 @@
|
|||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="openmetrics">
|
||||
<xs:sequence>
|
||||
<xs:element name="exporter" type="openmetrics-exporter" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="openmetrics-exporter">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="php-class"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="sabre">
|
||||
<xs:sequence>
|
||||
<xs:element name="collections" type="sabre-collections" minOccurs="0" maxOccurs="1"/>
|
||||
|
|
|
|||
|
|
@ -91,5 +91,11 @@
|
|||
"admin-section": [],
|
||||
"personal": [],
|
||||
"personal-section": []
|
||||
},
|
||||
"openmetrics": {
|
||||
"exporter": [
|
||||
"OC\\OpenMetrics\\Exporters\\ActiveSessions",
|
||||
"OC\\OpenMetrics\\Exporters\\ActiveUsers"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,9 @@
|
|||
<owncloud min-version="7.0.1" max-version="8" />
|
||||
<backend>caldav</backend>
|
||||
</dependencies>
|
||||
|
||||
<openmetrics>
|
||||
<exporter>OC\OpenMetrics\Exporters\ActiveSessions</exporter>
|
||||
<exporter>OC\OpenMetrics\Exporters\ActiveUsers</exporter>
|
||||
</openmetrics>
|
||||
</info>
|
||||
|
|
|
|||
|
|
@ -46,5 +46,10 @@
|
|||
"personal-section": []
|
||||
},
|
||||
"two-factor-providers": [],
|
||||
"types": []
|
||||
"types": [],
|
||||
"openmetrics": {
|
||||
"exporter": [
|
||||
"OC\\OpenMetrics\\Exporters\\ActiveUsers"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,8 @@
|
|||
<dependencies>
|
||||
<nextcloud min-version="16" max-version="16"/>
|
||||
</dependencies>
|
||||
|
||||
<openmetrics>
|
||||
<exporter>OC\OpenMetrics\Exporters\ActiveUsers</exporter>
|
||||
</openmetrics>
|
||||
</info>
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ class InfoParserTest extends TestCase {
|
|||
|
||||
public static function providesInfoXml(): array {
|
||||
return [
|
||||
['expected-info.json', 'valid-info.xml'],
|
||||
[null, 'invalid-info.xml'],
|
||||
['expected-info.json', 'valid-info.xml'],
|
||||
[null, 'invalid-info.xml'],
|
||||
['navigation-one-item.json', 'navigation-one-item.xml'],
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ class InfoXmlTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($appInfo['openmetrics'])) {
|
||||
foreach ($appInfo['openmetrics'] as $class) {
|
||||
if (isset($appInfo['openmetrics']['exporter'])) {
|
||||
foreach ($appInfo['openmetrics']['exporter'] as $class) {
|
||||
$this->assertTrue(class_exists($class), 'Asserting exporter "' . $class . '"exists');
|
||||
$exporter = Server::get($class);
|
||||
$this->assertInstanceOf($class, $exporter);
|
||||
|
|
|
|||
Loading…
Reference in a new issue