public static function getSources($version) { $base = Downloader::getPackageDir($version); return array ( self::APP_DIRNAME => $base . '/' . self::APP_DIRNAME, self::THIRDPARTY_DIRNAME => $base . '/' . self::THIRDPARTY_DIRNAME, self::CORE_DIRNAME => $base . '/' . self::CORE_DIRNAME, ); }
$updateData = \OC_Updater::check(); 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')); } //Some cleanup first Downloader::cleanUp($packageVersion); if (!Downloader::isClean($packageVersion)) { $message = App::$l10n->t('Upgrade is not possible. Your web server does not have permission to remove the following directory:'); $message .= '<br />' . Downloader::getPackageDir($packageVersion); $message .= '<br />' . App::$l10n->t('Update permissions on this directory and its content or remove it manually first.'); throw new \Exception($message); } Updater::cleanUp(); if (!Updater::isClean()) { $message = App::$l10n->t('Upgrade is not possible. Your web server does not have permission to remove the following directory:'); $message .= '<br />' . Updater::getTempDir(); $message .= '<br />' . App::$l10n->t('Update permissions on this directory and its content or remove it manually first.'); throw new \Exception($message); } $backupPath = Backup::create(); \OCP\JSON::success(array('backup' => $backupPath, 'version' => $packageVersion, 'url' => $packageUrl)); } catch (PermissionException $e) { //Something is not writable|readable \OCP\JSON::error(array('message' => $e->getExtendedMessage()));