]> source.dussan.org Git - nextcloud-server.git/commitdiff
put the current version and edition into a seperate file to simplify packaging. intro...
authorFrank Karlitschek <frank@owncloud.org>
Fri, 27 Sep 2013 21:41:24 +0000 (23:41 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 30 Sep 2013 18:19:26 +0000 (20:19 +0200)
Conflicts:
lib/ocsclient.php
lib/util.php

lib/util.php
version.php [new file with mode: 0644]

index e03667b079442e25678d84300df0c38b23cd0dc2..5bfa7d74228966f38fa023b9e87cde83a4fbc576 100755 (executable)
@@ -96,9 +96,8 @@ class OC_Util {
         * @return array
         */
        public static function getVersion() {
-               // hint: We only can count up. Reset minor/patchlevel when
-               // updating major/minor version number.
-               return array(5, 80, 05);
+               OC_Util::loadVersion();
+               return $_SESSION['OC_Version'];
        }
 
        /**
@@ -106,7 +105,8 @@ class OC_Util {
         * @return string
         */
        public static function getVersionString() {
-               return '6.0 pre alpha';
+               OC_Util::loadVersion();
+               return $_SESSION['OC_VersionString'];
        }
 
        /**
@@ -116,7 +116,40 @@ class OC_Util {
         * @return string
         */
        public static function getEditionString() {
-               return '';
+               OC_Util::loadVersion();
+               return $_SESSION['OC_Edition'];
+       }
+
+       /**
+        * @description get the update channel of the current installed of ownCloud.
+        * @return string
+        */
+       public static function getChannel() {
+               OC_Util::loadVersion();
+               return $_SESSION['OC_Channel'];
+       }
+        
+       /**
+        * @description get the build number of the current installed of ownCloud.
+        * @return string
+        */
+       public static function getBuild() {
+               OC_Util::loadVersion();
+               return $_SESSION['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;
+               }
        }
 
        /**
diff --git a/version.php b/version.php
new file mode 100644 (file)
index 0000000..dcdc288
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+// We only can count up. Reset minor/patchlevel when updating major/minor version number.
+$OC_Version=array(5, 80, 8);
+
+// The human radable string
+$OC_VersionString='6.0 pre alpha';
+
+// The ownCloud edition
+$OC_Edition='';
+
+// The ownCloud channel
+$OC_Channel='';
+
+// The build number
+$OC_Build='';
+