diff --git a/lib/legacy/updater.php b/lib/legacy/updater.php index 8a769a2f14..eea7bb129c 100644 --- a/lib/legacy/updater.php +++ b/lib/legacy/updater.php @@ -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'); } } diff --git a/lib/updater.php b/lib/updater.php index 6baf346a8e..5a9f499f91 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -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(