diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 2 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 2 | ||||
-rw-r--r-- | lib/l10n/br.js | 13 | ||||
-rw-r--r-- | lib/l10n/br.json | 13 | ||||
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 6 | ||||
-rw-r--r-- | lib/private/DB/MigrationService.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Cache/LocalRootScanner.php | 47 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/LocalRootStorage.php | 38 | ||||
-rw-r--r-- | lib/private/Setup.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 3 | ||||
-rw-r--r-- | lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php | 2 | ||||
-rw-r--r-- | lib/public/Migration/BigIntMigration.php | 5 |
13 files changed, 131 insertions, 12 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index b51c9876e5d..9d1ebf2815b 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -985,6 +985,7 @@ return array( 'OC\\Files\\Cache\\FailedCache' => $baseDir . '/lib/private/Files/Cache/FailedCache.php', 'OC\\Files\\Cache\\HomeCache' => $baseDir . '/lib/private/Files/Cache/HomeCache.php', 'OC\\Files\\Cache\\HomePropagator' => $baseDir . '/lib/private/Files/Cache/HomePropagator.php', + 'OC\\Files\\Cache\\LocalRootScanner' => $baseDir . '/lib/private/Files/Cache/LocalRootScanner.php', 'OC\\Files\\Cache\\MoveFromCacheTrait' => $baseDir . '/lib/private/Files/Cache/MoveFromCacheTrait.php', 'OC\\Files\\Cache\\Propagator' => $baseDir . '/lib/private/Files/Cache/Propagator.php', 'OC\\Files\\Cache\\QuerySearchHelper' => $baseDir . '/lib/private/Files/Cache/QuerySearchHelper.php', @@ -1049,6 +1050,7 @@ return array( 'OC\\Files\\Storage\\Flysystem' => $baseDir . '/lib/private/Files/Storage/Flysystem.php', 'OC\\Files\\Storage\\Home' => $baseDir . '/lib/private/Files/Storage/Home.php', 'OC\\Files\\Storage\\Local' => $baseDir . '/lib/private/Files/Storage/Local.php', + 'OC\\Files\\Storage\\LocalRootStorage' => $baseDir . '/lib/private/Files/Storage/LocalRootStorage.php', 'OC\\Files\\Storage\\LocalTempFileTrait' => $baseDir . '/lib/private/Files/Storage/LocalTempFileTrait.php', 'OC\\Files\\Storage\\PolyFill\\CopyDirectory' => $baseDir . '/lib/private/Files/Storage/PolyFill/CopyDirectory.php', 'OC\\Files\\Storage\\Storage' => $baseDir . '/lib/private/Files/Storage/Storage.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 2f640e014f3..1b7cf1fa13a 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -1014,6 +1014,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Files\\Cache\\FailedCache' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/FailedCache.php', 'OC\\Files\\Cache\\HomeCache' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/HomeCache.php', 'OC\\Files\\Cache\\HomePropagator' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/HomePropagator.php', + 'OC\\Files\\Cache\\LocalRootScanner' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/LocalRootScanner.php', 'OC\\Files\\Cache\\MoveFromCacheTrait' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/MoveFromCacheTrait.php', 'OC\\Files\\Cache\\Propagator' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/Propagator.php', 'OC\\Files\\Cache\\QuerySearchHelper' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/QuerySearchHelper.php', @@ -1078,6 +1079,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Files\\Storage\\Flysystem' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Flysystem.php', 'OC\\Files\\Storage\\Home' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Home.php', 'OC\\Files\\Storage\\Local' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Local.php', + 'OC\\Files\\Storage\\LocalRootStorage' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/LocalRootStorage.php', 'OC\\Files\\Storage\\LocalTempFileTrait' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/LocalTempFileTrait.php', 'OC\\Files\\Storage\\PolyFill\\CopyDirectory' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/PolyFill/CopyDirectory.php', 'OC\\Files\\Storage\\Storage' => __DIR__ . '/../../..' . '/lib/private/Files/Storage/Storage.php', diff --git a/lib/l10n/br.js b/lib/l10n/br.js index 8d766a49ea3..ce6571bc200 100644 --- a/lib/l10n/br.js +++ b/lib/l10n/br.js @@ -3,13 +3,24 @@ OC.L10N.register( { "Unknown filetype" : "N'eo ket anavezet stumm an teuliad", "Invalid image" : "N'eo ket aotreet ar skeudenn", + "today" : "hiziv", + "yesterday" : "dec'h", + "_%n day ago_::_%n days ago_" : ["%n deiz zo","%n deiz zo","%n deiz zo","%n deiz zo","%n deiz zo"], + "last month" : "ar miz tremenet", + "_%n month ago_::_%n months ago_" : ["%n miz zo","%n miz zo","%n miz zo","%n miz zo","%n miz zo"], + "last year" : "Ar bloaz tremenet", "seconds ago" : "eilenn zo", + "File name is too long" : "Anv ar restr a zo re hir", "__language_name__" : "Brezhoneg", "Help" : "Skoazell", "Apps" : "Meziant", "Settings" : "Arventennoù", "Users" : "Implijer", + "Unknown user" : "Implijer dianv", "Open »%s«" : "Digeriñ »%s«", - "Storage is temporarily not available" : "N'haller ket tizhout ar skor roadennoù evit ar poent" + "User disabled" : "Implijer disaotreet", + "Can't read file" : "N'eo ket posupl lenn ar restr", + "Storage is temporarily not available" : "N'haller ket tizhout ar skor roadennoù evit ar poent", + "Sharing" : "Rannan" }, "nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99) ? 2 :(n != 0 && n % 1000000 == 0) ? 3 : 4);"); diff --git a/lib/l10n/br.json b/lib/l10n/br.json index b46fd2a05f9..88e818f8ecf 100644 --- a/lib/l10n/br.json +++ b/lib/l10n/br.json @@ -1,13 +1,24 @@ { "translations": { "Unknown filetype" : "N'eo ket anavezet stumm an teuliad", "Invalid image" : "N'eo ket aotreet ar skeudenn", + "today" : "hiziv", + "yesterday" : "dec'h", + "_%n day ago_::_%n days ago_" : ["%n deiz zo","%n deiz zo","%n deiz zo","%n deiz zo","%n deiz zo"], + "last month" : "ar miz tremenet", + "_%n month ago_::_%n months ago_" : ["%n miz zo","%n miz zo","%n miz zo","%n miz zo","%n miz zo"], + "last year" : "Ar bloaz tremenet", "seconds ago" : "eilenn zo", + "File name is too long" : "Anv ar restr a zo re hir", "__language_name__" : "Brezhoneg", "Help" : "Skoazell", "Apps" : "Meziant", "Settings" : "Arventennoù", "Users" : "Implijer", + "Unknown user" : "Implijer dianv", "Open »%s«" : "Digeriñ »%s«", - "Storage is temporarily not available" : "N'haller ket tizhout ar skor roadennoù evit ar poent" + "User disabled" : "Implijer disaotreet", + "Can't read file" : "N'eo ket posupl lenn ar restr", + "Storage is temporarily not available" : "N'haller ket tizhout ar skor roadennoù evit ar poent", + "Sharing" : "Rannan" },"pluralForm" :"nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99) ? 2 :(n != 0 && n % 1000000 == 0) ? 3 : 4);" }
\ No newline at end of file diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 12748e0dd62..6428f7116b0 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -653,6 +653,12 @@ class Request implements \ArrayAccess, \Countable, IRequest { if (isset($this->server[$header])) { foreach (explode(',', $this->server[$header]) as $IP) { $IP = trim($IP); + + // remove brackets from IPv6 addresses + if (strpos($IP, '[') === 0 && substr($IP, -1) === ']') { + $IP = substr($IP, 1, -1); + } + if (filter_var($IP, FILTER_VALIDATE_IP) !== false) { return $IP; } diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 6685c1917f5..62f1d731f55 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -34,7 +34,7 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use OC\App\InfoParser; use OC\IntegrityCheck\Helpers\AppLocator; use OC\Migration\SimpleOutput; @@ -165,8 +165,8 @@ class MigrationService { } $table = $schema->createTable('migrations'); - $table->addColumn('app', Type::STRING, ['length' => 255]); - $table->addColumn('version', Type::STRING, ['length' => 255]); + $table->addColumn('app', Types::STRING, ['length' => 255]); + $table->addColumn('version', Types::STRING, ['length' => 255]); $table->setPrimaryKey(['app', 'version']); $this->connection->migrateToSchema($schema->getWrappedSchema()); diff --git a/lib/private/Files/Cache/LocalRootScanner.php b/lib/private/Files/Cache/LocalRootScanner.php new file mode 100644 index 00000000000..9ecc8c6611d --- /dev/null +++ b/lib/private/Files/Cache/LocalRootScanner.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Files\Cache; + +class LocalRootScanner extends Scanner { + public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { + if ($this->shouldScanPath($file)) { + return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock, $data); + } else { + return null; + } + } + + public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { + if ($this->shouldScanPath($path)) { + return parent::scan($path, $recursive, $reuse, $lock); + } else { + return null; + } + } + + private function shouldScanPath(string $path): bool { + $path = trim($path, '/'); + return $path === '' || strpos($path, 'appdata_') === 0 || strpos($path, '__groupfolders') === 0; + } +} diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index 16a48ee82a0..b96a11833cd 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -110,7 +110,7 @@ trait S3ConnectionTrait { } $this->connection = new S3Client($options); - if (!$this->connection->isBucketDnsCompatible($this->bucket)) { + if (!$this->connection::isBucketDnsCompatible($this->bucket)) { $logger = \OC::$server->getLogger(); $logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.', ['app' => 'objectstore']); @@ -120,7 +120,7 @@ trait S3ConnectionTrait { $logger = \OC::$server->getLogger(); try { $logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']); - if (!$this->connection->isBucketDnsCompatible($this->bucket)) { + if (!$this->connection::isBucketDnsCompatible($this->bucket)) { throw new \Exception("The bucket will not be created because the name is not dns compatible, please correct it: " . $this->bucket); } $this->connection->createBucket(['Bucket' => $this->bucket]); diff --git a/lib/private/Files/Storage/LocalRootStorage.php b/lib/private/Files/Storage/LocalRootStorage.php new file mode 100644 index 00000000000..0ad9c18b640 --- /dev/null +++ b/lib/private/Files/Storage/LocalRootStorage.php @@ -0,0 +1,38 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Files\Storage; + +use OC\Files\Cache\LocalRootScanner; + +class LocalRootStorage extends Local { + public function getScanner($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } + if (!isset($storage->scanner)) { + $storage->scanner = new LocalRootScanner($storage); + } + return $storage->scanner; + } +} diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 856ed1d7885..775c2d0a952 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -528,7 +528,7 @@ class Setup { $content .= "\n Options -MultiViews"; $content .= "\n RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]"; $content .= "\n RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]"; - $content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4)$"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4|mp3|ogg|wav)$"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !core/img/manifest.json$"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/remote.php"; diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 71f6edba0bf..dde47041c2b 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -63,6 +63,7 @@ */ use OC\AppFramework\Http\Request; +use OC\Files\Storage\LocalRootStorage; use OCP\IConfig; use OCP\IGroupManager; use OCP\ILogger; @@ -88,7 +89,7 @@ class OC_Util { //first set up the local "root" storage \OC\Files\Filesystem::initMountManager(); if (!self::$rootMounted) { - \OC\Files\Filesystem::mount('\OC\Files\Storage\Local', ['datadir' => $configDataDirectory], '/'); + \OC\Files\Filesystem::mount(LocalRootStorage::class, ['datadir' => $configDataDirectory], '/'); self::$rootMounted = true; } } diff --git a/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php b/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php index 776bd46d407..73128f618f0 100644 --- a/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php +++ b/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php @@ -26,7 +26,7 @@ declare(strict_types=1); namespace OCP\Collaboration\AutoComplete; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; /** * @since 16.0.0 diff --git a/lib/public/Migration/BigIntMigration.php b/lib/public/Migration/BigIntMigration.php index 251b7a908d7..cf08acd8387 100644 --- a/lib/public/Migration/BigIntMigration.php +++ b/lib/public/Migration/BigIntMigration.php @@ -24,6 +24,7 @@ namespace OCP\Migration; use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use OCP\DB\ISchemaWrapper; /** @@ -56,8 +57,8 @@ abstract class BigIntMigration extends SimpleMigrationStep { foreach ($columns as $columnName) { $column = $table->getColumn($columnName); - if ($column->getType()->getName() !== Type::BIGINT) { - $column->setType(Type::getType(Type::BIGINT)); + if ($column->getType()->getName() !== Types::BIGINT) { + $column->setType(Type::getType(Types::BIGINT)); $column->setOptions(['length' => 20]); } } |