use public api for session access from server container

remotes/origin/stable6
Thomas Müller 11 years ago
parent bed27b603d
commit 7c659eb291
  1. 30
      lib/util.php

@ -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);
}
}

Loading…
Cancel
Save