diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-08-11 19:37:17 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-08-11 19:37:17 +0200 |
commit | 8261ccce1be32c1467874d537240585c0d841600 (patch) | |
tree | 2b654700b2069eafbc2562e89621c748632c0e31 /lib | |
parent | 225eb27bcac1e710a4aba723483745bb3677460f (diff) | |
parent | f68f1d5f37e248aa7e5ac56e34fe79ce184ce149 (diff) | |
download | nextcloud-server-8261ccce1be32c1467874d537240585c0d841600.tar.gz nextcloud-server-8261ccce1be32c1467874d537240585c0d841600.zip |
Merge branch 'master' into implement_712
Diffstat (limited to 'lib')
-rw-r--r-- | lib/l10n/de.js | 2 | ||||
-rw-r--r-- | lib/l10n/de.json | 2 | ||||
-rw-r--r-- | lib/private/AppFramework/Routing/RouteConfig.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Config/LazyStorageMountInfo.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Mount/MountPoint.php | 7 | ||||
-rw-r--r-- | lib/private/Files/Utils/Scanner.php | 10 | ||||
-rw-r--r-- | lib/private/OCS/Cloud.php | 55 | ||||
-rw-r--r-- | lib/private/Route/Router.php | 7 | ||||
-rw-r--r-- | lib/private/Updater.php | 29 | ||||
-rw-r--r-- | lib/private/legacy/app.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/ocs/cloud.php | 28 | ||||
-rw-r--r-- | lib/public/AppFramework/OCSController.php | 15 | ||||
-rw-r--r-- | lib/public/Files/Mount/IMountPoint.php | 8 |
13 files changed, 70 insertions, 109 deletions
diff --git a/lib/l10n/de.js b/lib/l10n/de.js index 48a6ad427fc..0f0973d8e31 100644 --- a/lib/l10n/de.js +++ b/lib/l10n/de.js @@ -125,7 +125,7 @@ OC.L10N.register( "App \"%s\" cannot be installed because the following dependencies are not fulfilled: %s" : "Die App „%s“ kann nicht installiert werden, da die folgenden Abhängigkeiten nicht erfüllt sind: %s", "No app name specified" : "Es wurde kein App-Name angegeben", "App '%s' could not be installed!" : "'%s' - App konnte nicht installiert werden!", - "a safe home for all your data" : "ein sicherer Ort für all deine Daten", + "a safe home for all your data" : "ein sicherer Ort für all Deine Daten", "File is currently busy, please try again later" : "Die Datei ist zur Zeit in Benutzung, bitte versuche es später noch einmal", "Can't read file" : "Datei kann nicht gelesen werden", "Application is not enabled" : "Die App ist nicht aktiviert", diff --git a/lib/l10n/de.json b/lib/l10n/de.json index 8f806af36c6..72e05f676e4 100644 --- a/lib/l10n/de.json +++ b/lib/l10n/de.json @@ -123,7 +123,7 @@ "App \"%s\" cannot be installed because the following dependencies are not fulfilled: %s" : "Die App „%s“ kann nicht installiert werden, da die folgenden Abhängigkeiten nicht erfüllt sind: %s", "No app name specified" : "Es wurde kein App-Name angegeben", "App '%s' could not be installed!" : "'%s' - App konnte nicht installiert werden!", - "a safe home for all your data" : "ein sicherer Ort für all deine Daten", + "a safe home for all your data" : "ein sicherer Ort für all Deine Daten", "File is currently busy, please try again later" : "Die Datei ist zur Zeit in Benutzung, bitte versuche es später noch einmal", "Can't read file" : "Datei kann nicht gelesen werden", "Application is not enabled" : "Die App ist nicht aktiviert", diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index 066c0da1138..e94f2e50c1d 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -86,7 +86,13 @@ class RouteConfig { $postfix = $ocsRoute['postfix']; } - $url = $ocsRoute['url']; + if (isset($ocsRoute['root'])) { + $root = $ocsRoute['root']; + } else { + $root = '/apps/'.$this->appName; + } + + $url = $root . $ocsRoute['url']; $verb = isset($ocsRoute['verb']) ? strtoupper($ocsRoute['verb']) : 'GET'; $split = explode('#', $name, 2); diff --git a/lib/private/Files/Config/LazyStorageMountInfo.php b/lib/private/Files/Config/LazyStorageMountInfo.php index 2e9639f5f08..4df813d57d0 100644 --- a/lib/private/Files/Config/LazyStorageMountInfo.php +++ b/lib/private/Files/Config/LazyStorageMountInfo.php @@ -48,11 +48,7 @@ class LazyStorageMountInfo extends CachedMountInfo { */ public function getStorageId() { if (!$this->storageId) { - $storage = $this->mount->getStorage(); - if (!$storage) { - return -1; - } - $this->storageId = $storage->getStorageCache()->getNumericId(); + $this->storageId = $this->mount->getNumericStorageId(); } return parent::getStorageId(); } diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php index d6a6a5565ad..8b8f0574ae0 100644 --- a/lib/private/Files/Mount/MountPoint.php +++ b/lib/private/Files/Mount/MountPoint.php @@ -192,6 +192,13 @@ class MountPoint implements IMountPoint { } /** + * @return int + */ + public function getNumericStorageId() { + return $this->getStorage()->getStorageCache()->getNumericId(); + } + + /** * @param string $path * @return string */ diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index f672cc75744..d26c601be1a 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -139,9 +139,10 @@ class Scanner extends PublicEmitter { $this->triggerPropagator($storage, $path); }); - $storage->getPropagator()->beginBatch(); + $propagator = $storage->getPropagator(); + $propagator->beginBatch(); $scanner->backgroundScan(); - $storage->getPropagator()->commitBatch(); + $propagator->commitBatch(); } } @@ -190,14 +191,15 @@ class Scanner extends PublicEmitter { $this->db->beginTransaction(); } try { - $storage->getPropagator()->beginBatch(); + $propagator = $storage->getPropagator(); + $propagator->beginBatch(); $scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); $cache = $storage->getCache(); if ($cache instanceof Cache) { // only re-calculate for the root folder we scanned, anything below that is taken care of by the scanner $cache->correctFolderSize($relativePath); } - $storage->getPropagator()->commitBatch(); + $propagator->commitBatch(); } catch (StorageNotAvailableException $e) { $this->logger->error('Storage ' . $storage->getId() . ' not available'); $this->logger->logException($e); diff --git a/lib/private/OCS/Cloud.php b/lib/private/OCS/Cloud.php deleted file mode 100644 index 84fcfe6e512..00000000000 --- a/lib/private/OCS/Cloud.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Tom Needham <tom@owncloud.com> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\OCS; - -class Cloud { - - public static function getCapabilities() { - $result = array(); - list($major, $minor, $micro) = \OCP\Util::getVersion(); - $result['version'] = array( - 'major' => $major, - 'minor' => $minor, - 'micro' => $micro, - 'string' => \OC_Util::getVersionString(), - 'edition' => \OC_Util::getEditionString(), - ); - - $result['capabilities'] = \OC::$server->getCapabilitiesManager()->getCapabilities(); - - return new Result($result); - } - - public static function getCurrentUser() { - $userObject = \OC::$server->getUserManager()->get(\OC_User::getUser()); - $data = array( - 'id' => $userObject->getUID(), - 'display-name' => $userObject->getDisplayName(), - 'email' => $userObject->getEMailAddress(), - ); - return new Result($data); - } -} diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index ac42c4025c2..59f403d66e8 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -154,7 +154,7 @@ class Router implements IRouter { // Also add the OCS collection $collection = $this->getCollection($app.'.ocs'); - $collection->addPrefix('/ocsapp/apps/' . $app); + $collection->addPrefix('/ocsapp'); $this->root->addCollection($collection); } } @@ -163,6 +163,11 @@ class Router implements IRouter { $this->useCollection('root'); require_once __DIR__ . '/../../../settings/routes.php'; require_once __DIR__ . '/../../../core/routes.php'; + + // Also add the OCS collection + $collection = $this->getCollection('root.ocs'); + $collection->addPrefix('/ocsapp'); + $this->root->addCollection($collection); } if ($this->loaded) { // include ocs routes, must be loaded last for /ocs prefix diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 0a6d9c9a31d..609e965bfad 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -184,6 +184,18 @@ class Updater extends BasicEmitter { } /** + * Return vendor from which this version was published + * + * @return string Get the vendor + */ + private function getVendor() { + // this should really be a JSON file + require \OC::$SERVERROOT . '/version.php'; + /** @var string $vendor */ + return (string) $vendor; + } + + /** * Whether an upgrade to a specified version is possible * @param string $oldVersion * @param string $newVersion @@ -191,8 +203,22 @@ class Updater extends BasicEmitter { * @return bool */ public function isUpgradePossible($oldVersion, $newVersion, $allowedPreviousVersion) { - return (version_compare($allowedPreviousVersion, $oldVersion, '<=') + $allowedUpgrade = (version_compare($allowedPreviousVersion, $oldVersion, '<=') && (version_compare($oldVersion, $newVersion, '<=') || $this->config->getSystemValue('debug', false))); + + if ($allowedUpgrade) { + return $allowedUpgrade; + } + + // Upgrade not allowed, someone switching vendor? + if ($this->getVendor() !== $this->config->getAppValue('core', 'vendor', '')) { + $oldVersion = explode('.', $oldVersion); + $newVersion = explode('.', $newVersion); + + return $oldVersion[0] === $newVersion[0] && $oldVersion[1] === $newVersion[1]; + } + + return false; } /** @@ -279,6 +305,7 @@ class Updater extends BasicEmitter { // only set the final version if everything went well $this->config->setSystemValue('version', implode('.', \OCP\Util::getVersion())); + $this->config->setAppValue('core', 'vendor', $this->getVendor()); } } diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 4144f3f6cf5..df76c5b89f0 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -995,7 +995,7 @@ class OC_App { $currentVersion = OC_App::getAppVersion($app); if ($currentVersion && isset($versions[$app])) { $installedVersion = $versions[$app]; - if (version_compare($currentVersion, $installedVersion, '>')) { + if (!version_compare($currentVersion, $installedVersion, '=')) { return true; } } diff --git a/lib/private/legacy/ocs/cloud.php b/lib/private/legacy/ocs/cloud.php deleted file mode 100644 index 11152958301..00000000000 --- a/lib/private/legacy/ocs/cloud.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -/** - * @deprecated Since 9.1.0 use \OC\OCS\Cloud - */ -class OC_OCS_Cloud extends \OC\OCS\Cloud { -} diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index bd50f0a4017..6036fc6a5a8 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -88,26 +88,19 @@ abstract class OCSController extends ApiController { /** * Unwrap data and build ocs response * @param string $format json or xml - * @param array|DataResponse $data the data which should be transformed + * @param DataResponse $data the data which should be transformed * @since 8.1.0 + * @return OCSResponse */ - private function buildOCSResponse($format, $data) { - if ($data instanceof DataResponse) { - $data = $data->getData(); - } - + private function buildOCSResponse($format, DataResponse $data) { $params = [ 'statuscode' => 100, 'message' => 'OK', - 'data' => [], + 'data' => $data->getData(), 'itemscount' => '', 'itemsperpage' => '' ]; - foreach ($data as $key => $value) { - $params[$key] = $value; - } - return new OCSResponse( $format, $params['statuscode'], $params['message'], $params['data'], diff --git a/lib/public/Files/Mount/IMountPoint.php b/lib/public/Files/Mount/IMountPoint.php index f9a00af7cb5..0876d8b11d6 100644 --- a/lib/public/Files/Mount/IMountPoint.php +++ b/lib/public/Files/Mount/IMountPoint.php @@ -62,6 +62,14 @@ interface IMountPoint { public function getStorageId(); /** + * Get the id of the storages + * + * @return int + * @since 9.1.0 + */ + public function getNumericStorageId(); + + /** * Get the path relative to the mountpoint * * @param string $path absolute path to a file or folder |