diff --git a/apps/testing/appinfo/info.xml b/apps/testing/appinfo/info.xml
index 12cf4c51e22..cb7d0a31c8e 100644
--- a/apps/testing/appinfo/info.xml
+++ b/apps/testing/appinfo/info.xml
@@ -16,6 +16,11 @@
+
+
+ OCA\Testing\Command\StaticHunt
+
+
monitoring
https://github.com/nextcloud/server/issues
diff --git a/apps/testing/composer/composer/autoload_classmap.php b/apps/testing/composer/composer/autoload_classmap.php
index ad50a15224a..ee7424a0ea8 100644
--- a/apps/testing/composer/composer/autoload_classmap.php
+++ b/apps/testing/composer/composer/autoload_classmap.php
@@ -9,6 +9,7 @@ return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'OCA\\Testing\\AlternativeHomeUserBackend' => $baseDir . '/../lib/AlternativeHomeUserBackend.php',
'OCA\\Testing\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
+ 'OCA\\Testing\\Command\\StaticHunt' => $baseDir . '/../lib/Command/StaticHunt.php',
'OCA\\Testing\\Controller\\ConfigController' => $baseDir . '/../lib/Controller/ConfigController.php',
'OCA\\Testing\\Controller\\LockingController' => $baseDir . '/../lib/Controller/LockingController.php',
'OCA\\Testing\\Controller\\RateLimitTestController' => $baseDir . '/../lib/Controller/RateLimitTestController.php',
diff --git a/apps/testing/composer/composer/autoload_static.php b/apps/testing/composer/composer/autoload_static.php
index d3e37546416..9ea8e6dc0a8 100644
--- a/apps/testing/composer/composer/autoload_static.php
+++ b/apps/testing/composer/composer/autoload_static.php
@@ -24,6 +24,7 @@ class ComposerStaticInitTesting
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'OCA\\Testing\\AlternativeHomeUserBackend' => __DIR__ . '/..' . '/../lib/AlternativeHomeUserBackend.php',
'OCA\\Testing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
+ 'OCA\\Testing\\Command\\StaticHunt' => __DIR__ . '/..' . '/../lib/Command/StaticHunt.php',
'OCA\\Testing\\Controller\\ConfigController' => __DIR__ . '/..' . '/../lib/Controller/ConfigController.php',
'OCA\\Testing\\Controller\\LockingController' => __DIR__ . '/..' . '/../lib/Controller/LockingController.php',
'OCA\\Testing\\Controller\\RateLimitTestController' => __DIR__ . '/..' . '/../lib/Controller/RateLimitTestController.php',
diff --git a/apps/testing/lib/Command/StaticHunt.php b/apps/testing/lib/Command/StaticHunt.php
new file mode 100644
index 00000000000..48fe283f2e3
--- /dev/null
+++ b/apps/testing/lib/Command/StaticHunt.php
@@ -0,0 +1,73 @@
+setName('testing:static-hunt')
+ ->setDescription('Hunt for static properties in classes');
+ }
+
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ //TODO run on all apps namespaces
+ $folders = [
+ '\\OC' => __DIR__ . '/../../../../lib/private',
+ '' => __DIR__ . '/../../../../lib/private/legacy',
+ ];
+ foreach ($folders as $namespace => $folder) {
+ $this->scanFolder($folder, $namespace, $output);
+ }
+
+ return 0;
+ }
+
+ private function scanFolder(string $folder, string $namespace, OutputInterface $output): void {
+ $folder = realpath($folder);
+ foreach (glob($folder.'/**.php') as $filename) {
+ try {
+ $filename = realpath($filename);
+ $classname = $namespace.substr(str_replace('/', '\\', substr($filename, strlen($folder))), 0, -4);
+ if (!class_exists($classname)) {
+ continue;
+ }
+ $rClass = new \ReflectionClass($classname);
+ $staticProperties = $rClass->getStaticProperties();
+ if (empty($staticProperties)) {
+ continue;
+ }
+ $output->writeln('# ' . str_replace(\OC::$SERVERROOT, '', $filename) . " $classname");
+ foreach ($staticProperties as $property => $value) {
+ $propertyObject = $rClass->getProperty($property);
+ $output->write("$propertyObject");
+ }
+ $output->writeln("");
+ } catch (\Throwable $t) {
+ $output->writeln("$t");
+ }
+ }
+ }
+}