]> source.dussan.org Git - nextcloud-server.git/commitdiff
use public api for session access from server container
authorThomas Müller <thomas.mueller@tmit.eu>
Mon, 30 Sep 2013 18:28:00 +0000 (20:28 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 30 Sep 2013 18:28:00 +0000 (20:28 +0200)
lib/util.php

index 36969f096fa922ee9a323e8b2c29f23305a9ef13..ea2eb98d23c22de655d7c66ffc8329838ea1473a 100755 (executable)
@@ -107,7 +107,7 @@ class OC_Util {
         */
        public static function getVersion() {
                OC_Util::loadVersion();
-               return $_SESSION['OC_Version'];
+               return \OC::$server->getSession()->get('OC_Version');
        }
 
        /**
@@ -116,7 +116,7 @@ class OC_Util {
         */
        public static function getVersionString() {
                OC_Util::loadVersion();
-               return $_SESSION['OC_VersionString'];
+               return \OC::$server->getSession()->get('OC_VersionString');
        }
 
        /**
@@ -127,7 +127,7 @@ class OC_Util {
         */
        public static function getEditionString() {
                OC_Util::loadVersion();
-               return $_SESSION['OC_Edition'];
+               return \OC::$server->getSession()->get('OC_Edition');
        }
 
        /**
@@ -136,7 +136,7 @@ class OC_Util {
         */
        public static function getChannel() {
                OC_Util::loadVersion();
-               return $_SESSION['OC_Channel'];
+               return \OC::$server->getSession()->get('OC_Channel');
        }
         
        /**
@@ -145,20 +145,26 @@ class OC_Util {
         */
        public static function getBuild() {
                OC_Util::loadVersion();
-               return $_SESSION['OC_Build'];
+               return \OC::$server->getSession()->get('OC_Build');
        }
 
        /**
         * @description load the version.php into the session as cache
         */
        private static function loadVersion() {
-               if(!isset($_SESSION['OC_Version'])){
-                       require('version.php');
-                       $_SESSION['OC_Version']=$OC_Version;
-                       $_SESSION['OC_VersionString']=$OC_VersionString;
-                       $_SESSION['OC_Edition']=$OC_Edition;
-                       $_SESSION['OC_Channel']=$OC_Channel;
-                       $_SESSION['OC_Build']=$OC_Build;
+               if(!\OC::$server->getSession()->exists('OC_Version')) {
+                       require 'version.php';
+                       $session = \OC::$server->getSession();
+                       /** @var $OC_Version string */
+                       $session->set('OC_Version', $OC_Version);
+                       /** @var $OC_VersionString string */
+                       $session->set('OC_VersionString', $OC_VersionString);
+                       /** @var $OC_Edition string */
+                       $session->set('OC_Edition', $OC_Edition);
+                       /** @var $OC_Channel string */
+                       $session->set('OC_Channel', $OC_Channel);
+                       /** @var $OC_Build string */
+                       $session->set('OC_Build', $OC_Build);
                }
        }