예제 #1
0
 public function getFeed($helper = null, $config = null)
 {
     $helper = is_null($helper) ? \OC::$server->getHTTPHelper() : $helper;
     $config = is_null($config) ? \OC::$server->getConfig() : $config;
     $updater = new \OC\Updater($helper, $config);
     $data = $updater->check('https://updates.owncloud.com/server/');
     if (!is_array($data)) {
         $data = [];
     }
     return $data;
 }
예제 #2
0
	public static function getFeed($helper = false, $config = false){
		if (!$helper){
			$helper = \OC::$server->getHTTPHelper();
		}
		if (!$config){
			$config = \OC::$server->getAppConfig();
		}
		$updater = new \OC\Updater($helper, $config);
		$data = $updater->check('https://apps.owncloud.com/updater.php');
		if (!is_array($data)){
			$data = array();
		}
		return $data;
	}
예제 #3
0
set_time_limit(0);
require_once '../../lib/base.php';

\OCP\JSON::callCheck();

if (OC::checkUpgrade(false)) {
	// if a user is currently logged in, their session must be ignored to
	// avoid side effects
	\OC_User::setIncognitoMode(true);

	$l = new \OC_L10N('core');
	$eventSource = \OC::$server->createEventSource();
	$logger = \OC::$server->getLogger();
	$updater = new \OC\Updater(
			\OC::$server->getHTTPHelper(),
			\OC::$server->getConfig(),
			$logger
	);
	$incompatibleApps = [];
	$disabledThirdPartyApps = [];

	$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
	});
	$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
	});
	$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
	});
	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
예제 #4
0
 /**
  * @param string $renderAs
  * @param string $appId application id
  */
 public function __construct($renderAs, $appId = '')
 {
     // yes - should be injected ....
     $this->config = \OC::$server->getConfig();
     // Decide which page we show
     if ($renderAs == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
             $this->assign('bodyid', 'body-settings');
         } else {
             $this->assign('bodyid', 'body-user');
         }
         // Update notification
         if ($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) {
             $updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig());
             $data = $updater->check();
             if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array()) {
                 $this->assign('updateAvailable', true);
                 $this->assign('updateVersion', $data['versionstring']);
                 $this->assign('updateLink', $data['web']);
                 \OCP\Util::addScript('core', 'update-notification');
             } else {
                 $this->assign('updateAvailable', false);
                 // No update available or not an admin user
             }
         } else {
             $this->assign('updateAvailable', false);
             // Update check is disabled
         }
         // Add navigation entry
         $this->assign('application', '');
         $this->assign('appid', $appId);
         $navigation = OC_App::getNavigation();
         $this->assign('navigation', $navigation);
         $settingsNavigation = OC_App::getSettingsNavigation();
         $this->assign('settingsnavigation', $settingsNavigation);
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         foreach ($settingsNavigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         $userDisplayName = OC_User::getDisplayName();
         $this->assign('user_displayname', $userDisplayName);
         $this->assign('user_uid', OC_User::getUser());
         $this->assign('appsmanagement_active', strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0);
         $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true));
         $this->assign('userAvatarSet', \OC_Helper::userAvatarSet(OC_User::getUser()));
     } else {
         if ($renderAs == 'error') {
             parent::__construct('core', 'layout.guest', '', false);
             $this->assign('bodyid', 'body-login');
         } else {
             if ($renderAs == 'guest') {
                 parent::__construct('core', 'layout.guest');
                 $this->assign('bodyid', 'body-login');
             } else {
                 parent::__construct('core', 'layout.base');
             }
         }
     }
     // Send the language to our layouts
     $this->assign('language', OC_L10N::findLanguage());
     if (empty(self::$versionHash)) {
         $v = OC_App::getAppVersions();
         $v['core'] = implode('.', \OC_Util::getVersion());
         self::$versionHash = md5(implode(',', $v));
     }
     $useAssetPipeline = self::isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
         $this->generateAssets();
     } else {
         // Add the js files
         $jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
         $this->assign('jsfiles', array(), false);
         if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
             $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
         }
         foreach ($jsFiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
         // Add the css files
         $cssFiles = self::findStylesheetFiles(OC_Util::$styles);
         $this->assign('cssfiles', array());
         foreach ($cssFiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('cssfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
     }
 }
예제 #5
0
<?php

set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
    $l = new \OC_L10N('core');
    $eventSource = new OC_EventSource();
    $updater = new \OC\Updater(\OC_Log::$object);
    $updater->listen('\\OC\\Updater', 'maintenanceStart', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Turned on maintenance mode'));
    });
    $updater->listen('\\OC\\Updater', 'maintenanceEnd', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Turned off maintenance mode'));
    });
    $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Updated database'));
    });
    $updater->listen('\\OC\\Updater', 'filecacheStart', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Updating filecache, this may take really long...'));
    });
    $updater->listen('\\OC\\Updater', 'filecacheDone', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Updated filecache'));
    });
    $updater->listen('\\OC\\Updater', 'filecacheProgress', function ($out) use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('... %d%% done ...', array('percent' => $out)));
    });
    $updater->listen('\\OC\\Updater', 'failure', function ($message) use($eventSource) {
        $eventSource->send('failure', $message);
        $eventSource->close();
        OC_Config::setValue('maintenance', false);
예제 #6
0
<?php
set_time_limit(0);
require_once '../../lib/base.php';

if (OC::checkUpgrade(false)) {
	$l = new \OC_L10N('core');
	$eventSource = new OC_EventSource();
	$updater = new \OC\Updater(\OC_Log::$object);
	$updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
	});
	$updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
	});
	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Updated database'));
	});
	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Checked database schema update'));
	});
	$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
	});
	$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
		$eventSource->send('success', (string)$l->t('Updated "%s" to %s', array($app, $version)));
	});
	$updater->listen('\OC\Updater', 'disabledApps', function ($appList) use ($eventSource, $l) {
		$list = array();
		foreach ($appList as $appId) {
			$info = OC_App::getAppInfo($appId);
			$list[] = $info['name'] . ' (' . $info['id'] . ')';
예제 #7
0
파일: update.php 프로젝트: kenwi/core
 */
set_time_limit(0);
require_once '../../lib/base.php';
$l = \OC::$server->getL10N('core');
$eventSource = \OC::$server->createEventSource();
// need to send an initial message to force-init the event source,
// which will then trigger its own CSRF check and produces its own CSRF error
// message
$eventSource->send('success', (string) $l->t('Preparing update'));
if (OC::checkUpgrade(false)) {
    // if a user is currently logged in, their session must be ignored to
    // avoid side effects
    \OC_User::setIncognitoMode(true);
    $logger = \OC::$server->getLogger();
    $config = \OC::$server->getConfig();
    $updater = new \OC\Updater(\OC::$server->getHTTPHelper(), $config, \OC::$server->getIntegrityCodeChecker(), $logger);
    $incompatibleApps = [];
    $disabledThirdPartyApps = [];
    $updater->listen('\\OC\\Updater', 'maintenanceEnabled', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Turned on maintenance mode'));
    });
    $updater->listen('\\OC\\Updater', 'maintenanceDisabled', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Turned off maintenance mode'));
    });
    $updater->listen('\\OC\\Updater', 'maintenanceActive', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Maintenance mode is kept active'));
    });
    $updater->listen('\\OC\\Updater', 'dbUpgradeBefore', function () use($eventSource, $l) {
        $eventSource->send('success', (string) $l->t('Updating database schema'));
    });
    $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($eventSource, $l) {
예제 #8
0
 public static function check()
 {
     $updater = new \OC\Updater();
     return $updater->check('http://apps.owncloud.com/updater.php');
 }
예제 #9
0
 * @copyright 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::getLegacyBackupBase())) {
    try {
        Helper::move(App::getLegacyBackupBase(), App::getBackupBase());
    } catch (Exception $e) {
    }
} else {
    if (!@file_exists(App::getBackupBase())) {
        Helper::mkdir(App::getBackupBase());
    }
}
$updater = new \OC\Updater();
$data = $updater->check('http://apps.owncloud.com/updater.php');
$isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array();
$tmpl = new \OCP\Template(App::APP_ID, 'update', 'guest');
$lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat');
$tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck));
$tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable);
$tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : '');
$tmpl->printPage();