[Pkg-owncloud-commits] [owncloud] 14/457: Allow change update channel via public API

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:05:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit af814ba2703b6ad63d567138fdba5d740d48496e
Author: Victor Dubiniuk <victor.dubiniuk at gmail.com>
Date:   Wed May 13 20:00:46 2015 +0300

    Allow change update channel via public API
---
 lib/private/util.php | 17 +++++++++++++++--
 lib/public/util.php  | 18 ++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/lib/private/util.php b/lib/private/util.php
index 367199f..46fb929 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -388,10 +388,23 @@ class OC_Util {
 			$session->set('OC_Version', $OC_Version);
 			/** @var $OC_VersionString string */
 			$session->set('OC_VersionString', $OC_VersionString);
-			/** @var $OC_Channel string */
-			$session->set('OC_Channel', $OC_Channel);
 			/** @var $OC_Build string */
 			$session->set('OC_Build', $OC_Build);
+			
+			// Allow overriding update channel
+			
+			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
+				$channel = \OC::$server->getAppConfig()->getValue('core', 'OC_Channel');
+			} else {
+				$channel = $OC_Channel;
+			}
+			
+			if (!is_null($channel)) {
+				$session->set('OC_Channel', $channel);
+			} else {
+				/** @var $OC_Channel string */
+				$session->set('OC_Channel', $OC_Channel);
+			}
 		}
 	}
 
diff --git a/lib/public/util.php b/lib/public/util.php
index 6eb5c60..f032d0a 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -69,6 +69,24 @@ class Util {
 	public static function getVersion() {
 		return(\OC_Util::getVersion());
 	}
+	
+	/**
+	 * Set current update channel
+	 * @param string $channel
+	 */
+	public static function setChannel($channel) {
+		//Flush timestamp to reload version.php
+		\OC::$server->getSession()->set('OC_Version_Timestamp', 0);
+		return \OC::$server->getAppConfig()->setValue('core', 'OC_Channel', $channel);
+	}
+	
+	/**
+	 * Get current update channel
+	 * @return string
+	 */
+	public static function getChannel() {
+		return \OC_Util::getChannel();
+	}
 
 	/**
 	 * send an email

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list