]> source.dussan.org Git - nextcloud-server.git/commitdiff
Updater: pass update url as argument to update check
authorRobin Appelman <icewind@owncloud.com>
Sat, 6 Jul 2013 15:05:38 +0000 (17:05 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sat, 6 Jul 2013 15:05:38 +0000 (17:05 +0200)
lib/legacy/updater.php
lib/updater.php

index 8a769a2f14bbdd8caf7d444ebf339318bd76fd31..eea7bb129cfba66bff7c88bb394ced024ce1a2b9 100644 (file)
@@ -9,6 +9,6 @@
 class OC_Updater {
        public static function check() {
                $updater = new \OC\Updater();
-               return $updater->check();
+               return $updater->check('http://apps.owncloud.com/updater.php');
        }
 }
index 6baf346a8e084005a8d19a7f530c8d6aecc7fe68..5a9f499f91bb283a746e1e272feef70d6beadcc7 100644 (file)
@@ -37,9 +37,10 @@ class Updater extends BasicEmitter {
 
        /**
         * Check if a new version is available
+        * @param string $updateUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
         * @return array | bool
         */
-       public function check() {
+       public function check($updaterUrl) {
 
                // Look up the cache - it is invalidated all 30 minutes
                if ((\OC_Appconfig::getValue('core', 'lastupdatedat') + 1800) > time()) {
@@ -51,17 +52,16 @@ class Updater extends BasicEmitter {
                if (\OC_Appconfig::getValue('core', 'installedat', '') == '') {
                        \OC_Appconfig::setValue('core', 'installedat', microtime(true));
                }
-
-               $updaterurl = 'http://apps.owncloud.com/updater.php';
+;
                $version = \OC_Util::getVersion();
                $version['installed'] = \OC_Appconfig::getValue('core', 'installedat');
                $version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat');
                $version['updatechannel'] = 'stable';
                $version['edition'] = \OC_Util::getEditionString();
-               $versionstring = implode('x', $version);
+               $versionString = implode('x', $version);
 
                //fetch xml data from updater
-               $url = $updaterurl . '?version=' . $versionstring;
+               $url = $updaterUrl . '?version=' . $versionString;
 
                // set a sensible timeout of 10 sec to stay responsive even if the update server is down.
                $ctx = stream_context_create(