Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/files_external/appinfo/info.xml2
-rw-r--r--apps/files_external/lib/Migration/Version1011Date20200630192246.php2
-rw-r--r--apps/files_external/lib/Migration/Version1016Date20220324154536.php54
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php2
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php2
-rw-r--r--apps/user_ldap/lib/Command/CreateEmptyConfig.php1
-rw-r--r--apps/user_ldap/lib/Configuration.php11
-rw-r--r--apps/user_ldap/lib/Controller/ConfigAPIController.php1
-rw-r--r--apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php11
-rw-r--r--lib/private/DB/MigrationService.php4
-rw-r--r--lib/private/Repair/Owncloud/MigrateOauthTables.php37
-rw-r--r--tests/lib/DB/MigrationsTest.php40
12 files changed, 140 insertions, 27 deletions
diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml
index ea8e29c0166..f9b2b8341ce 100644
--- a/apps/files_external/appinfo/info.xml
+++ b/apps/files_external/appinfo/info.xml
@@ -9,7 +9,7 @@ This application enables administrators to configure connections to external sto
External storage can be configured using the GUI or at the command line. This second option provides the advanced user with more flexibility for configuring bulk external storage mounts and setting mount priorities. More information is available in the external storage GUI documentation and the external storage Configuration File documentation.
</description>
- <version>1.16.0</version>
+ <version>1.16.1</version>
<licence>agpl</licence>
<author>Robin Appelman</author>
<author>Michael Gapczynski</author>
diff --git a/apps/files_external/lib/Migration/Version1011Date20200630192246.php b/apps/files_external/lib/Migration/Version1011Date20200630192246.php
index 5ec289428fb..c2a53e346f1 100644
--- a/apps/files_external/lib/Migration/Version1011Date20200630192246.php
+++ b/apps/files_external/lib/Migration/Version1011Date20200630192246.php
@@ -116,7 +116,7 @@ class Version1011Date20200630192246 extends SimpleMigrationStep {
]);
$table->addColumn('value', Types::STRING, [
'notnull' => false,
- 'length' => 4096,
+ 'length' => 4000,
]);
$table->setPrimaryKey(['config_id']);
$table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key');
diff --git a/apps/files_external/lib/Migration/Version1016Date20220324154536.php b/apps/files_external/lib/Migration/Version1016Date20220324154536.php
new file mode 100644
index 00000000000..a2a7ecaff17
--- /dev/null
+++ b/apps/files_external/lib/Migration/Version1016Date20220324154536.php
@@ -0,0 +1,54 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @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 OCA\Files_External\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version1016Date20220324154536 extends SimpleMigrationStep {
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $table = $schema->getTable('external_config');
+ $column = $table->getColumn('value');
+
+ if ($column->getLength() > 4000) {
+ $column->setLength(4000);
+ return $schema;
+ }
+
+ return null;
+ }
+}
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 6375ee3d703..35a01ccdd61 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -1119,7 +1119,7 @@ class ShareAPIController extends OCSController {
if (!$this->hasPermission($newPermissions, Constants::PERMISSION_READ) && (
$this->hasPermission($newPermissions, Constants::PERMISSION_UPDATE) || $this->hasPermission($newPermissions, Constants::PERMISSION_DELETE)
)) {
- throw new OCSBadRequestException($this->l->t('Share must have READ permission if UPDATE or DELETE permission is set.'));
+ throw new OCSBadRequestException($this->l->t('Share must have READ permission if UPDATE or DELETE permission is set'));
}
}
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 324862a746d..c7c2b6d8757 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -2881,7 +2881,7 @@ class ShareAPIControllerTest extends TestCase {
*/
public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions) {
$this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
- $this->expectExceptionMessage('Share must have READ permission if UPDATE or DELETE permission is set.');
+ $this->expectExceptionMessage('Share must have READ permission if UPDATE or DELETE permission is set');
$this->testUpdateLinkShareSetCRUDPermissions($permissions);
}
diff --git a/apps/user_ldap/lib/Command/CreateEmptyConfig.php b/apps/user_ldap/lib/Command/CreateEmptyConfig.php
index 8b1736e3a53..f7f04e28e60 100644
--- a/apps/user_ldap/lib/Command/CreateEmptyConfig.php
+++ b/apps/user_ldap/lib/Command/CreateEmptyConfig.php
@@ -59,6 +59,7 @@ class CreateEmptyConfig extends Command {
protected function execute(InputInterface $input, OutputInterface $output): int {
$configPrefix = $this->helper->getNextServerConfigurationPrefix();
$configHolder = new Configuration($configPrefix);
+ $configHolder->ldapConfigurationActive = false;
$configHolder->saveConfiguration();
$prose = '';
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index 9ffb2a79781..c16823d39ee 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -56,10 +56,9 @@ class Configuration {
*/
protected $configRead = false;
/**
- * @var string[] pre-filled with one reference key so that at least one entry is written on save request and
- * the config ID is registered
+ * @var string[]
*/
- protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive'];
+ protected array $unsavedChanges = [];
/**
* @var array<string, mixed> settings
@@ -257,6 +256,7 @@ class Configuration {
*/
public function saveConfiguration(): void {
$cta = array_flip($this->getConfigTranslationArray());
+ $changed = false;
foreach ($this->unsavedChanges as $key) {
$value = $this->config[$key];
switch ($key) {
@@ -286,9 +286,12 @@ class Configuration {
if (is_null($value)) {
$value = '';
}
+ $changed = true;
$this->saveValue($cta[$key], $value);
}
- $this->saveValue('_lastChange', (string)time());
+ if ($changed) {
+ $this->saveValue('_lastChange', (string)time());
+ }
$this->unsavedChanges = [];
}
diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php
index 72ded754880..e408d03fcd5 100644
--- a/apps/user_ldap/lib/Controller/ConfigAPIController.php
+++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php
@@ -118,6 +118,7 @@ class ConfigAPIController extends OCSController {
try {
$configPrefix = $this->ldapHelper->getNextServerConfigurationPrefix();
$configHolder = new Configuration($configPrefix);
+ $configHolder->ldapConfigurationActive = false;
$configHolder->saveConfiguration();
} catch (\Exception $e) {
$this->logger->logException($e);
diff --git a/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php b/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php
index 6c38051d41a..a3806799ff0 100644
--- a/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php
+++ b/apps/workflowengine/lib/Listener/LoadAdditionalSettingsScriptsListener.php
@@ -32,7 +32,7 @@ use OCP\EventDispatcher\IEventListener;
use OCP\Template;
use function class_exists;
use function function_exists;
-use function script;
+use OCP\Util;
class LoadAdditionalSettingsScriptsListener implements IEventListener {
public function handle(Event $event): void {
@@ -41,10 +41,9 @@ class LoadAdditionalSettingsScriptsListener implements IEventListener {
class_exists(Template::class, true);
}
- script('core', 'systemtags');
-
- script(Application::APP_ID, [
- 'workflowengine',
- ]);
+ Util::addScript('core', 'files_fileinfo');
+ Util::addScript('core', 'files_client');
+ Util::addScript('core', 'systemtags');
+ Util::addScript(Application::APP_ID, 'workflowengine');
}
}
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index a0f905115cc..046e3a4924b 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -595,6 +595,10 @@ class MigrationService {
if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && $thing->getNotnull() && $thing->getType()->getName() === Types::BOOLEAN) {
throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type Bool and also NotNull, so it can not store "false".');
}
+
+ if ($thing->getLength() > 4000 && $thing->getType()->getName() === Types::STRING) {
+ throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type String, but exceeding the 4.000 length limit.');
+ }
}
foreach ($table->getIndexes() as $thing) {
diff --git a/lib/private/Repair/Owncloud/MigrateOauthTables.php b/lib/private/Repair/Owncloud/MigrateOauthTables.php
index 274c2ee28db..4011a043f20 100644
--- a/lib/private/Repair/Owncloud/MigrateOauthTables.php
+++ b/lib/private/Repair/Owncloud/MigrateOauthTables.php
@@ -55,23 +55,34 @@ class MigrateOauthTables implements IRepairStep {
$output->info("Update the oauth2_access_tokens table schema.");
$schema = new SchemaWrapper($this->db);
$table = $schema->getTable('oauth2_access_tokens');
- $table->addColumn('hashed_code', 'string', [
- 'notnull' => true,
- 'length' => 128,
- ]);
- $table->addColumn('encrypted_token', 'string', [
- 'notnull' => true,
- 'length' => 786,
- ]);
- $table->addUniqueIndex(['hashed_code'], 'oauth2_access_hash_idx');
- $table->addIndex(['client_id'], 'oauth2_access_client_id_idx');
-
+ if (!$table->hasColumn('hashed_code')) {
+ $table->addColumn('hashed_code', 'string', [
+ 'notnull' => true,
+ 'length' => 128,
+ ]);
+ }
+ if (!$table->hasColumn('encrypted_token')) {
+ $table->addColumn('encrypted_token', 'string', [
+ 'notnull' => true,
+ 'length' => 786,
+ ]);
+ }
+ if (!$table->hasIndex('oauth2_access_hash_idx')) {
+ $table->addUniqueIndex(['hashed_code'], 'oauth2_access_hash_idx');
+ }
+ if (!$table->hasIndex('oauth2_access_client_id_idx')) {
+ $table->addIndex(['client_id'], 'oauth2_access_client_id_idx');
+ }
$output->info("Update the oauth2_clients table schema.");
$schema = new SchemaWrapper($this->db);
$table = $schema->getTable('oauth2_clients');
- $table->getColumn('name')->setLength(64);
- $table->dropColumn('allow_subdomains');
+ if ($table->getColumn('name')->getLength() !== 64) {
+ $table->getColumn('name')->setLength(64);
+ }
+ if ($table->hasColumn('allow_subdomains')) {
+ $table->dropColumn('allow_subdomains');
+ }
if (!$schema->getTable('oauth2_clients')->hasColumn('client_identifier')) {
$table->addColumn('client_identifier', 'string', [
diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php
index b00b094b4aa..206fe1a3798 100644
--- a/tests/lib/DB/MigrationsTest.php
+++ b/tests/lib/DB/MigrationsTest.php
@@ -716,4 +716,44 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}
+
+
+ public function testEnsureOracleConstraintsStringLength4000() {
+ $this->expectException(\InvalidArgumentException::class);
+
+ $column = $this->createMock(Column::class);
+ $column->expects($this->any())
+ ->method('getName')
+ ->willReturn('aaaa');
+ $column->expects($this->any())
+ ->method('getType')
+ ->willReturn(Type::getType('string'));
+ $column->expects($this->any())
+ ->method('getLength')
+ ->willReturn(4001);
+
+ $table = $this->createMock(Table::class);
+ $table->expects($this->any())
+ ->method('getName')
+ ->willReturn(\str_repeat('a', 30));
+
+ $table->expects($this->once())
+ ->method('getColumns')
+ ->willReturn([$column]);
+
+ $schema = $this->createMock(Schema::class);
+ $schema->expects($this->once())
+ ->method('getTables')
+ ->willReturn([$table]);
+
+ $sourceSchema = $this->createMock(Schema::class);
+ $sourceSchema->expects($this->any())
+ ->method('getTable')
+ ->willThrowException(new SchemaException());
+ $sourceSchema->expects($this->any())
+ ->method('hasSequence')
+ ->willReturn(false);
+
+ self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
+ }
}