/** * Retrieve the previous set of results from this feed. * * @throws \Zend\GData\App\Exception * @return mixed|null Returns the previous set of results as a feed of * the same class as this feed, or null if no results exist. */ public function getPreviousFeed() { $previousLink = $this->getPreviousLink(); if (!$previousLink) { throw new Exception('No link to previous set ' . 'of results found.'); } $previousLinkHref = $previousLink->getHref(); $service = new App($this->getHttpClient()); return $service->getFeed($previousLinkHref, get_class($this)); }
<?php /** * ownCloud - Updater plugin * * @author Victor Dubiniuk * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\Updater; \OCP\User::checkAdminUser(); \OCP\Util::addScript(App::APP_ID, '3rdparty/angular'); \OCP\Util::addScript(App::APP_ID, 'app'); \OCP\Util::addScript(App::APP_ID, 'controllers'); \OCP\Util::addStyle(App::APP_ID, 'updater'); if (!@file_exists(App::getBackupBase())) { Helper::mkdir(App::getBackupBase()); } $data = App::getFeed(); $isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array(); $tmpl = new \OCP\Template(App::APP_ID, 'admin'); $lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat'); $tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck)); $tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false'); $tmpl->assign('channels', Channel::getChannels()); $tmpl->assign('currentChannel', Channel::getCurrentChannel()); $tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : ''); return $tmpl->fetchPage();
/** * Retrieve feed as string or object * * @param mixed $location The location as string or \Zend\GData\Query * @param string $className The class type to use for returning the feed * @throws \Zend\GData\App\InvalidArgumentException * @return string|\Zend\GData\App\Feed Returns string only if the object * mapping has been disabled explicitly * by passing false to the * useObjectMapping() function. */ public function getFeed($location, $className = '\\Zend\\GData\\Feed') { if (is_string($location)) { $uri = $location; } elseif ($location instanceof Query) { $uri = $location->getQueryUrl(); } else { throw new App\InvalidArgumentException('You must specify the location as either a string URI ' . 'or a child of Zend\\GData\\Query'); } return parent::getFeed($uri, $className); }
* * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\Updater; \OCP\JSON::checkAdminUser(); \OCP\JSON::callCheck(); set_time_limit(0); clearstatcache(); try { // Url to download package e.g. http://download.owncloud.org/releases/owncloud-4.0.5.tar.bz2 $packageUrl = ''; //Package version e.g. 4.0.4 $packageVersion = ''; $updateData = App::getFeed(); if (isset($updateData['version']) && $updateData['version'] !== array()) { $packageVersion = $updateData['version']; } if (isset($updateData['url']) && $updateData['url'] !== array()) { $packageUrl = $updateData['url']; } if (!strlen($packageVersion) || !strlen($packageUrl)) { App::log('Invalid response from update feed.'); throw new \Exception((string) App::$l10n->t('Version not found')); } $packageVersionArray = explode('.', $packageVersion); Helper::checkVersion($packageVersionArray, $packageVersion); //Some cleanup first Downloader::cleanUp($packageVersion); if (!Downloader::isClean($packageVersion)) {