Serverinfo OS info

Could anybody take a look at these changes?

This should fill in the OS field in serverinfo which is currently blank.

https://…/nextcloud/index.php/settings/admin/serverinfo

Thank you.

diff -ur nextcloud-old/apps/serverinfo/lib/OperatingSystems/DefaultOs.php nextcloud-new/apps/serverinfo/lib/OperatingSystems/DefaultOs.php
--- nextcloud-old/apps/serverinfo/lib/OperatingSystems/DefaultOs.php    2020-01-17 14:47:00.000000000 +0100
+++ nextcloud-new/apps/serverinfo/lib/OperatingSystems/DefaultOs.php    2020-01-29 20:32:07.538029299 +0100
@@ -46,6 +46,14 @@
        /**
         * @return string
         */
+       public function getOSName() {
+               $osname = php_uname();
+               return $osname;
+       }
+
+       /**
+        * @return string
+        */
        public function getMemory() {
                $memory = shell_exec('cat /proc/meminfo  | grep -i \'MemTotal\' | cut -f 2 -d ":" | awk \'{$1=$1}1\'');
                $memory = explode(' ', $memory);
diff -ur nextcloud-old/apps/serverinfo/lib/Os.php nextcloud-new/apps/serverinfo/lib/Os.php
--- nextcloud-old/apps/serverinfo/lib/Os.php    2020-01-17 14:47:00.000000000 +0100
+++ nextcloud-new/apps/serverinfo/lib/Os.php    2020-01-29 20:30:39.463442268 +0100
@@ -93,7 +93,7 @@
         * @return string
         */
        public function getOSName() {
-               $data = $this->osname;
+               $data = $this->backend->getOSName();
                return $data;
        }
 

BTW

Doesn’t reading from /sys and /proc cause any compatibility issues on systems other than linux?

Good suggestion :+1:

Here is the serverinfo repository: https://github.com/nextcloud/serverinfo

Yes. I guess the purpose of OS and DefaultOS is to have a abstraction to support linux and other os. A FreeBsdOS for example with all the knowledge how to fetch those information.