feat(core): add index to systemtag objecttype

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
pull/48786/head
skjnldsv 1 month ago
parent 405a267408
commit 0893d4b4d2
  1. 42
      core/Migrations/Version31000Date20241018063111.php
  2. 1
      lib/composer/composer/autoload_classmap.php
  3. 1
      lib/composer/composer/autoload_static.php
  4. 15
      lib/private/SystemTag/SystemTagObjectMapper.php
  5. 10
      lib/public/SystemTag/ISystemTagObjectMapper.php
  6. 2
      version.php

@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Core\Migrations;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
/**
* Add objecttype index to systemtag_object_mapping
*/
class Version31000Date20241018063111 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if ($schema->hasTable('systemtag_object_mapping')) {
$table = $schema->getTable('systemtag_object_mapping');
if (!$table->hasIndex('systag_objecttype')) {
$table->addIndex(['objecttype'], 'systag_objecttype');
}
}
return $schema;
}
}

@ -1384,6 +1384,7 @@ return array(
'OC\\Core\\Migrations\\Version30000Date20240814180800' => $baseDir . '/core/Migrations/Version30000Date20240814180800.php',
'OC\\Core\\Migrations\\Version30000Date20240815080800' => $baseDir . '/core/Migrations/Version30000Date20240815080800.php',
'OC\\Core\\Migrations\\Version30000Date20240906095113' => $baseDir . '/core/Migrations/Version30000Date20240906095113.php',
'OC\\Core\\Migrations\\Version31000Date20241018063111' => $baseDir . '/core/Migrations/Version31000Date20241018063111.php',
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php',
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',

@ -1417,6 +1417,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Migrations\\Version30000Date20240814180800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240814180800.php',
'OC\\Core\\Migrations\\Version30000Date20240815080800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240815080800.php',
'OC\\Core\\Migrations\\Version30000Date20240906095113' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240906095113.php',
'OC\\Core\\Migrations\\Version31000Date20241018063111' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20241018063111.php',
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php',
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',

@ -260,4 +260,19 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
);
}
}
public function getAvailableObjectTypes(): array {
$query = $this->connection->getQueryBuilder();
$query->selectDistinct('objecttype')
->from(self::RELATION_TABLE);
$result = $query->executeQuery();
$objectTypes = [];
while ($row = $result->fetch()) {
$objectTypes[] = $row['objecttype'];
}
$result->closeCursor();
return $objectTypes;
}
}

@ -111,4 +111,14 @@ interface ISystemTagObjectMapper {
* @since 9.0.0
*/
public function haveTag($objIds, string $objectType, string $tagId, bool $all = true): bool;
/**
* Get the list of object types that have objects assigned to them.
*
* @return string[] list of object types
*
* @since 31.0.0
*/
public function getAvailableObjectTypes(): array;
}

@ -9,7 +9,7 @@
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patch level
// when updating major/minor version number.
$OC_Version = [31, 0, 0, 3];
$OC_Version = [31, 0, 0, 4];
// The human-readable string
$OC_VersionString = '31.0.0 dev';

Loading…
Cancel
Save