diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/l10n/pl.js | 1 | ||||
-rw-r--r-- | lib/l10n/pl.json | 1 | ||||
-rw-r--r-- | lib/l10n/ru.js | 7 | ||||
-rw-r--r-- | lib/l10n/ru.json | 7 | ||||
-rw-r--r-- | lib/private/IntegrityCheck/Checker.php | 10 | ||||
-rw-r--r-- | lib/private/Memcache/Memcached.php | 25 | ||||
-rw-r--r-- | lib/private/Repair.php | 2 | ||||
-rw-r--r-- | lib/private/Repair/RepairLegacyStorages.php | 257 | ||||
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 2 | ||||
-rw-r--r-- | lib/public/Activity/IManager.php | 1 |
12 files changed, 33 insertions, 282 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 272f7588d15..7a4cc6eaa84 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -687,7 +687,6 @@ return array( 'OC\\Repair\\RemoveOldShares' => $baseDir . '/lib/private/Repair/RemoveOldShares.php', 'OC\\Repair\\RemoveRootShares' => $baseDir . '/lib/private/Repair/RemoveRootShares.php', 'OC\\Repair\\RepairInvalidShares' => $baseDir . '/lib/private/Repair/RepairInvalidShares.php', - 'OC\\Repair\\RepairLegacyStorages' => $baseDir . '/lib/private/Repair/RepairLegacyStorages.php', 'OC\\Repair\\RepairMimeTypes' => $baseDir . '/lib/private/Repair/RepairMimeTypes.php', 'OC\\Repair\\RepairUnmergedShares' => $baseDir . '/lib/private/Repair/RepairUnmergedShares.php', 'OC\\Repair\\SearchLuceneTables' => $baseDir . '/lib/private/Repair/SearchLuceneTables.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 98f97d5e511..6a063f0d8c7 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -717,7 +717,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Repair\\RemoveOldShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RemoveOldShares.php', 'OC\\Repair\\RemoveRootShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RemoveRootShares.php', 'OC\\Repair\\RepairInvalidShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairInvalidShares.php', - 'OC\\Repair\\RepairLegacyStorages' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairLegacyStorages.php', 'OC\\Repair\\RepairMimeTypes' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairMimeTypes.php', 'OC\\Repair\\RepairUnmergedShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairUnmergedShares.php', 'OC\\Repair\\SearchLuceneTables' => __DIR__ . '/../../..' . '/lib/private/Repair/SearchLuceneTables.php', diff --git a/lib/l10n/pl.js b/lib/l10n/pl.js index c71ffa473b3..09916c829c7 100644 --- a/lib/l10n/pl.js +++ b/lib/l10n/pl.js @@ -82,6 +82,7 @@ OC.L10N.register( "Sharing %s failed, because resharing is not allowed" : "Współdzielenie %s nie powiodło się, ponieważ ponowne współdzielenie nie jest dozwolone", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Współdzielenie %s nie powiodło się, ponieważ zaplecze współdzielenia dla %s nie mogło znaleźć jego źródła", "Sharing %s failed, because the file could not be found in the file cache" : "Współdzielenie %s nie powiodło się, ponieważ plik nie może zostać odnaleziony w buforze plików", + "Cannot increase permissions of %s" : "Nie można zwiększyć uprawnienia %s", "Expiration date is in the past" : "Data ważności jest przeszła", "Could not find category \"%s\"" : "Nie można odnaleźć kategorii \"%s\"", "Sunday" : "Niedziela", diff --git a/lib/l10n/pl.json b/lib/l10n/pl.json index 1a4160b95c4..088f1a26414 100644 --- a/lib/l10n/pl.json +++ b/lib/l10n/pl.json @@ -80,6 +80,7 @@ "Sharing %s failed, because resharing is not allowed" : "Współdzielenie %s nie powiodło się, ponieważ ponowne współdzielenie nie jest dozwolone", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Współdzielenie %s nie powiodło się, ponieważ zaplecze współdzielenia dla %s nie mogło znaleźć jego źródła", "Sharing %s failed, because the file could not be found in the file cache" : "Współdzielenie %s nie powiodło się, ponieważ plik nie może zostać odnaleziony w buforze plików", + "Cannot increase permissions of %s" : "Nie można zwiększyć uprawnienia %s", "Expiration date is in the past" : "Data ważności jest przeszła", "Could not find category \"%s\"" : "Nie można odnaleźć kategorii \"%s\"", "Sunday" : "Niedziela", diff --git a/lib/l10n/ru.js b/lib/l10n/ru.js index 3904d0f86d1..399b48b38d6 100644 --- a/lib/l10n/ru.js +++ b/lib/l10n/ru.js @@ -5,8 +5,13 @@ OC.L10N.register( "This can usually be fixed by giving the webserver write access to the config directory" : "Обычно это можно исправить, предоставив веб-серверу права на запись в каталог конфигурации", "See %s" : "Смотрите %s", "This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Обычно это можно исправить %sпредоставив веб-серверу права на запись в каталоге конфигурации%s.", + "The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server." : "Файлы приложения %$1s не заменены корректно. Проверьте что его версия совместима с версией сервера.", "Sample configuration detected" : "Обнаружена конфигурация из примера", "It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Была обнаружена конфигурация из примера. Такая конфигурация не поддерживается и может повредить вашей системе. Прочтите документацию перед внесением изменений в файл config.php", + "%1$s and %2$s" : "%1$s и %2$s", + "%1$s, %2$s and %3$s" : "%1$s, %2$s и %3$s", + "%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s и %4$s", + "%1$s, %2$s, %3$s, %4$s and %5$s" : "%1$s, %2$s, %3$s, %4$s и %5$s", "PHP %s or higher is required." : "Требуется PHP %s или выше", "PHP with a version lower than %s is required." : "Требуется версия PHP ниже %s.", "%sbit or higher PHP required." : "Требуется PHP с разрядностью %s бит или более.", @@ -206,7 +211,7 @@ OC.L10N.register( "4-byte characters are not supported in file names" : "4-х байтовые символы в имени файлов не допускаются", "App directory already exists" : "Каталог приложения уже существует", "Can't create app folder. Please fix permissions. %s" : "Не удалось создать каталог приложения. Исправьте права доступа. %s", - "Archive does not contain a directory named %s" : "Архив не содержит папки с именем %s", + "Archive does not contain a directory named %s" : "Архив не содержит каталога с именем %s", "No source specified when installing app" : "Не указан источник при установке приложения", "No href specified when installing app from http" : "Не указан атрибут href при установке приложения через http", "No path specified when installing app from local file" : "Не указан путь при установке приложения из локального файла", diff --git a/lib/l10n/ru.json b/lib/l10n/ru.json index a64f3c29c98..82bc6583955 100644 --- a/lib/l10n/ru.json +++ b/lib/l10n/ru.json @@ -3,8 +3,13 @@ "This can usually be fixed by giving the webserver write access to the config directory" : "Обычно это можно исправить, предоставив веб-серверу права на запись в каталог конфигурации", "See %s" : "Смотрите %s", "This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "Обычно это можно исправить %sпредоставив веб-серверу права на запись в каталоге конфигурации%s.", + "The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server." : "Файлы приложения %$1s не заменены корректно. Проверьте что его версия совместима с версией сервера.", "Sample configuration detected" : "Обнаружена конфигурация из примера", "It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Была обнаружена конфигурация из примера. Такая конфигурация не поддерживается и может повредить вашей системе. Прочтите документацию перед внесением изменений в файл config.php", + "%1$s and %2$s" : "%1$s и %2$s", + "%1$s, %2$s and %3$s" : "%1$s, %2$s и %3$s", + "%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s и %4$s", + "%1$s, %2$s, %3$s, %4$s and %5$s" : "%1$s, %2$s, %3$s, %4$s и %5$s", "PHP %s or higher is required." : "Требуется PHP %s или выше", "PHP with a version lower than %s is required." : "Требуется версия PHP ниже %s.", "%sbit or higher PHP required." : "Требуется PHP с разрядностью %s бит или более.", @@ -204,7 +209,7 @@ "4-byte characters are not supported in file names" : "4-х байтовые символы в имени файлов не допускаются", "App directory already exists" : "Каталог приложения уже существует", "Can't create app folder. Please fix permissions. %s" : "Не удалось создать каталог приложения. Исправьте права доступа. %s", - "Archive does not contain a directory named %s" : "Архив не содержит папки с именем %s", + "Archive does not contain a directory named %s" : "Архив не содержит каталога с именем %s", "No source specified when installing app" : "Не указан источник при установке приложения", "No href specified when installing app from http" : "Не указан атрибут href при установке приложения через http", "No path specified when installing app from local file" : "Не указан путь при установке приложения из локального файла", diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php index 4588c006da6..419f989fa0f 100644 --- a/lib/private/IntegrityCheck/Checker.php +++ b/lib/private/IntegrityCheck/Checker.php @@ -96,12 +96,8 @@ class Checker { * @return bool */ public function isCodeCheckEnforced() { - $signedChannels = [ - 'daily', - 'testing', - 'stable', - ]; - if(!in_array($this->environmentHelper->getChannel(), $signedChannels, true)) { + $notSignedChannels = [ '', 'git']; + if (in_array($this->environmentHelper->getChannel(), $notSignedChannels, true)) { return false; } @@ -115,7 +111,7 @@ class Checker { } else { $isIntegrityCheckDisabled = false; } - if($isIntegrityCheckDisabled === true) { + if ($isIntegrityCheckDisabled === true) { return false; } diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index 12f45739374..dbff6dc2ec2 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -46,16 +46,6 @@ class Memcached extends Cache implements IMemcache { parent::__construct($prefix); if (is_null(self::$cache)) { self::$cache = new \Memcached(); - $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers'); - if (!$servers) { - $server = \OC::$server->getSystemConfig()->getValue('memcached_server'); - if ($server) { - $servers = array($server); - } else { - $servers = array(array('localhost', 11211)); - } - } - self::$cache->addServers($servers); $defaultOptions = [ \Memcached::OPT_CONNECT_TIMEOUT => 50, @@ -85,6 +75,17 @@ class Memcached extends Cache implements IMemcache { } else { throw new HintException("Expected 'memcached_options' config to be an array, got $options"); } + + $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers'); + if (!$servers) { + $server = \OC::$server->getSystemConfig()->getValue('memcached_server'); + if ($server) { + $servers = [$server]; + } else { + $servers = [['localhost', 11211]]; + } + } + self::$cache->addServers($servers); } } @@ -110,7 +111,9 @@ class Memcached extends Cache implements IMemcache { } else { $result = self::$cache->set($this->getNamespace() . $key, $value); } - $this->verifyReturnCode(); + if ($result !== true) { + $this->verifyReturnCode(); + } return $result; } diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 16236fd6bcc..f1bf586b49d 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -48,7 +48,6 @@ use OC\Repair\SqliteAutoincrement; use OC\Repair\DropOldTables; use OC\Repair\FillETags; use OC\Repair\InnoDB; -use OC\Repair\RepairLegacyStorages; use OC\Repair\RepairMimeTypes; use OC\Repair\SearchLuceneTables; use OC\Repair\UpdateOutdatedOcsIds; @@ -133,7 +132,6 @@ class Repair implements IOutput{ return [ new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false), new RepairMimeTypes(\OC::$server->getConfig()), - new RepairLegacyStorages(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), new AssetCache(), new FillETags(\OC::$server->getDatabaseConnection()), new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()), diff --git a/lib/private/Repair/RepairLegacyStorages.php b/lib/private/Repair/RepairLegacyStorages.php deleted file mode 100644 index 228bdb67fe8..00000000000 --- a/lib/private/Repair/RepairLegacyStorages.php +++ /dev/null @@ -1,257 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Aaron Wood <aaronjwood@gmail.com> - * @author Joas Schilling <coding@schilljs.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Vincent Petry <pvince81@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\Repair; - -use OC\Files\Cache\Storage; -use OC\RepairException; -use OCP\Migration\IOutput; -use OCP\Migration\IRepairStep; - -class RepairLegacyStorages implements IRepairStep{ - /** - * @var \OCP\IConfig - */ - protected $config; - - /** - * @var \OCP\IDBConnection - */ - protected $connection; - - protected $findStorageInCacheStatement; - protected $renameStorageStatement; - - /** - * @param \OCP\IConfig $config - * @param \OCP\IDBConnection $connection - */ - public function __construct($config, $connection) { - $this->connection = $connection; - $this->config = $config; - - $this->findStorageInCacheStatement = $this->connection->prepare( - 'SELECT DISTINCT `storage` FROM `*PREFIX*filecache`' - . ' WHERE `storage` in (?, ?)' - ); - $this->renameStorageStatement = $this->connection->prepare( - 'UPDATE `*PREFIX*storages`' - . ' SET `id` = ?' - . ' WHERE `id` = ?' - ); - } - - public function getName() { - return 'Repair legacy storages'; - } - - /** - * Extracts the user id from a legacy storage id - * - * @param string $storageId legacy storage id in the - * format "local::/path/to/datadir/userid" - * @return string user id extracted from the storage id - */ - private function extractUserId($storageId) { - $storageId = rtrim($storageId, '/'); - $pos = strrpos($storageId, '/'); - return substr($storageId, $pos + 1); - } - - /** - * Fix the given legacy storage by renaming the old id - * to the new id. If the new id already exists, whichever - * storage that has data in the file cache will be used. - * If both have data, nothing will be done and false is - * returned. - * - * @param string $oldId old storage id - * @param int $oldNumericId old storage numeric id - * @param string $userId - * @return bool true if fixed, false otherwise - * @throws RepairException - */ - private function fixLegacyStorage($oldId, $oldNumericId, $userId = null) { - // check whether the new storage already exists - if (is_null($userId)) { - $userId = $this->extractUserId($oldId); - } - $newId = 'home::' . $userId; - - // check if target id already exists - $newNumericId = Storage::getNumericStorageId($newId); - if (!is_null($newNumericId)) { - $newNumericId = (int)$newNumericId; - // try and resolve the conflict - // check which one of "local::" or "home::" needs to be kept - $this->findStorageInCacheStatement->execute(array($oldNumericId, $newNumericId)); - $row1 = $this->findStorageInCacheStatement->fetch(); - $row2 = $this->findStorageInCacheStatement->fetch(); - $this->findStorageInCacheStatement->closeCursor(); - if ($row2 !== false) { - // two results means both storages have data, not auto-fixable - throw new RepairException( - 'Could not automatically fix legacy storage ' - . '"' . $oldId . '" => "' . $newId . '"' - . ' because they both have data.' - ); - } - if ($row1 === false || (int)$row1['storage'] === $oldNumericId) { - // old storage has data, then delete the empty new id - $toDelete = $newId; - } else if ((int)$row1['storage'] === $newNumericId) { - // new storage has data, then delete the empty old id - $toDelete = $oldId; - } else { - // unknown case, do not continue - return false; - } - - // delete storage including file cache - Storage::remove($toDelete); - - // if we deleted the old id, the new id will be used - // automatically - if ($toDelete === $oldId) { - // nothing more to do - return true; - } - } - - // rename old id to new id - $newId = Storage::adjustStorageId($newId); - $oldId = Storage::adjustStorageId($oldId); - $rowCount = $this->renameStorageStatement->execute(array($newId, $oldId)); - $this->renameStorageStatement->closeCursor(); - return ($rowCount === 1); - } - - /** - * Converts legacy home storage ids in the format - * "local::/data/dir/path/userid/" to the new format "home::userid" - */ - public function run(IOutput $out) { - // only run once - if ($this->config->getAppValue('core', 'repairlegacystoragesdone') === 'yes') { - return; - } - - $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/'); - $dataDir = rtrim($dataDir, '/') . '/'; - $dataDirId = 'local::' . $dataDir; - - $count = 0; - $hasWarnings = false; - - $this->connection->beginTransaction(); - - // note: not doing a direct UPDATE with the REPLACE function - // because regexp search/extract is needed and it is not guaranteed - // to work on all database types - $sql = 'SELECT `id`, `numeric_id` FROM `*PREFIX*storages`' - . ' WHERE `id` LIKE ?' - . ' ORDER BY `id`'; - $result = $this->connection->executeQuery($sql, array($this->connection->escapeLikeParameter($dataDirId) . '%')); - - while ($row = $result->fetch()) { - $currentId = $row['id']; - // one entry is the datadir itself - if ($currentId === $dataDirId) { - continue; - } - - try { - if ($this->fixLegacyStorage($currentId, (int)$row['numeric_id'])) { - $count++; - } - } - catch (RepairException $e) { - $hasWarnings = true; - $out->warning('Could not repair legacy storage ' . $currentId . ' automatically.'); - } - } - - // check for md5 ids, not in the format "prefix::" - $sql = 'SELECT COUNT(*) AS "c" FROM `*PREFIX*storages`' - . ' WHERE `id` NOT LIKE \'%::%\''; - $result = $this->connection->executeQuery($sql); - $row = $result->fetch(); - - // find at least one to make sure it's worth - // querying the user list - if ((int)$row['c'] > 0) { - $userManager = \OC::$server->getUserManager(); - - // use chunks to avoid caching too many users in memory - $limit = 30; - $offset = 0; - - do { - // query the next page of users - $results = $userManager->search('', $limit, $offset); - $storageIds = array(); - foreach ($results as $uid => $userObject) { - $storageId = $dataDirId . $uid . '/'; - if (strlen($storageId) <= 64) { - // skip short storage ids as they were handled in the previous section - continue; - } - $storageIds[$uid] = $storageId; - } - - if (count($storageIds) > 0) { - // update the storages of these users - foreach ($storageIds as $uid => $storageId) { - $numericId = Storage::getNumericStorageId($storageId); - try { - if (!is_null($numericId) && $this->fixLegacyStorage($storageId, (int)$numericId)) { - $count++; - } - } - catch (RepairException $e) { - $hasWarnings = true; - $out->warning('Could not repair legacy storage ' . $storageId . ' automatically.'); - } - } - } - $offset += $limit; - } while (count($results) >= $limit); - } - - $out->info('Updated ' . $count . ' legacy home storage ids'); - - $this->connection->commit(); - - Storage::getGlobalCache()->clearCache(); - - if ($hasWarnings) { - $out->warning('Some legacy storages could not be repaired. Please manually fix them then re-run ./occ maintenance:repair'); - } else { - // if all were done, no need to redo the repair during next upgrade - $this->config->setAppValue('core', 'repairlegacystoragesdone', 'yes'); - } - } -} diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index fded7442d20..23e8db34d7f 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -162,7 +162,6 @@ class DefaultShareProvider implements IShareProvider { $this->dbConn->beginTransaction(); $qb->execute(); $id = $this->dbConn->lastInsertId('*PREFIX*share'); - $this->dbConn->commit(); // Now fetch the inserted share and create a complete share object $qb = $this->dbConn->getQueryBuilder(); @@ -172,6 +171,7 @@ class DefaultShareProvider implements IShareProvider { $cursor = $qb->execute(); $data = $cursor->fetch(); + $this->dbConn->commit(); $cursor->closeCursor(); if ($data === false) { diff --git a/lib/public/Activity/IManager.php b/lib/public/Activity/IManager.php index 2fe38ddb8d8..f5b495807c5 100644 --- a/lib/public/Activity/IManager.php +++ b/lib/public/Activity/IManager.php @@ -64,6 +64,7 @@ interface IManager { * - setSubject() * * @param IEvent $event + * @throws \BadMethodCallException if required values have not been set * @since 8.2.0 */ public function publish(IEvent $event); |