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

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2022-01-23 11:56:40 +0300
committerdartcafe <github@dartcafe.de>2022-01-23 11:56:40 +0300
commitf68566602c0b3ad17990e536e7cb9e864936cf8f (patch)
tree1c7408c55084856bb700ea003d368d33d01df48d /lib
parentab4345bd378c80c3f60c4dd17984fc2e359e3c44 (diff)
some code maintenance
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/Command/Db/Rebuild.php32
-rw-r--r--lib/Migration/TableSchema.php2
-rw-r--r--lib/Service/ActivityService.php4
3 files changed, 22 insertions, 16 deletions
diff --git a/lib/Command/Db/Rebuild.php b/lib/Command/Db/Rebuild.php
index 4bd27c51..f635bc62 100644
--- a/lib/Command/Db/Rebuild.php
+++ b/lib/Command/Db/Rebuild.php
@@ -72,7 +72,7 @@ class Rebuild extends Command {
return 0;
}
- private function requestConfirmation(InputInterface $input, OutputInterface $output) {
+ private function requestConfirmation(InputInterface $input, OutputInterface $output): int {
if ($input->isInteractive()) {
$helper = $this->getHelper('question');
$output->writeln('<comment>All polls tables will get checked against the current schema.</comment>');
@@ -117,13 +117,19 @@ class Rebuild extends Command {
if ($schema->hasTable($tableName)) {
$table = $schema->getTable($tableName);
if (!$table->hasIndex($values['name'])) {
- if ($values['unique'] === true) {
- $table->addUniqueIndex($values['columns'], $values['name']);
- $output->writeln('<info> - Added unique index ' . $values['name'] . ' to ' . $tableName . '</info>');
- } else {
- $table->addIndex($values['columns'], $values['name']);
- $output->writeln('<info> - Added index ' . $values['name'] . ' to ' . $tableName . '</info>');
- }
+ $table->addUniqueIndex($values['columns'], $values['name']);
+ $output->writeln('<info> - Added unique index ' . $values['name'] . ' to ' . $tableName . '</info>');
+
+ // TODO: Commented out atm to get psalm quiet, because we just have unique indices.
+ //
+
+ // if ($values['unique']) {
+ // $table->addUniqueIndex($values['columns'], $values['name']);
+ // $output->writeln('<info> - Added unique index ' . $values['name'] . ' to ' . $tableName . '</info>');
+ // } else {
+ // $table->addIndex($values['columns'], $values['name']);
+ // $output->writeln('<info> - Added index ' . $values['name'] . ' to ' . $tableName . '</info>');
+ // }
}
}
}
@@ -142,7 +148,7 @@ class Rebuild extends Command {
$tableCreated = false;
if ($schema->hasTable($tableName)) {
- $output->writeln('<info> - Validating table ' . $tableName . '</info>');
+ $output->writeln(' - Validating table ' . $tableName);
$table = $schema->getTable($tableName);
} else {
$output->writeln('<info> - Creating table ' . $tableName . '</info>');
@@ -155,7 +161,7 @@ class Rebuild extends Command {
$column = $table->getColumn($columnName);
$column->setOptions($columnDefinition['options']);
if ($column->getType()->getName() !== $columnDefinition['type']) {
- $output->writeln('<comment> Migrated type of ' . $tableName . '[\'' . $columnName . '\'] from ' . $column->getType()->getName() . ' to ' . $columnDefinition['type'] . '</comment>');
+ $output->writeln('<info> Migrated type of ' . $tableName . '[\'' . $columnName . '\'] from ' . $column->getType()->getName() . ' to ' . $columnDefinition['type'] . '</info>');
$column->setType(Type::getType($columnDefinition['type']));
}
@@ -163,7 +169,7 @@ class Rebuild extends Command {
$table->changeColumn($columnName, $columnDefinition['options']);
} else {
$table->addColumn($columnName, $columnDefinition['type'], $columnDefinition['options']);
- $output->writeln('<comment> Added ' . $tableName . ', ' . $columnName . ' (' . $columnDefinition['type'] . ')</comment>');
+ $output->writeln('<info> Added ' . $tableName . ', ' . $columnName . ' (' . $columnDefinition['type'] . ')</info>');
}
}
@@ -196,7 +202,7 @@ class Rebuild extends Command {
$this->connection->migrateToSchema($schema->getWrappedSchema());
if (!$dropped) {
- $output->writeln('<info> - No orphaned columns found</info>');
+ $output->writeln(' - No orphaned columns found');
}
}
@@ -217,7 +223,7 @@ class Rebuild extends Command {
}
$this->connection->migrateToSchema($schema->getWrappedSchema());
if (!$dropped) {
- $output->writeln('<info> - No orphaned tables found</info>');
+ $output->writeln(' - No orphaned tables found');
}
}
diff --git a/lib/Migration/TableSchema.php b/lib/Migration/TableSchema.php
index a1dc6fbc..9f15e25b 100644
--- a/lib/Migration/TableSchema.php
+++ b/lib/Migration/TableSchema.php
@@ -223,7 +223,7 @@ abstract class TableSchema {
'id' => ['type' => Types::INTEGER, 'options' => ['autoincrement' => true, 'notnull' => true]],
'poll_id' => ['type' => Types::INTEGER, 'options' => ['notnull' => true, 'default' => 0]],
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
- 'comment' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => '', 'length' => 1024]],
+ 'comment' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 1024]],
'timestamp' => ['type' => Types::INTEGER, 'options' => ['notnull' => true, 'default' => 0]],
],
diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php
index 81c82e2a..f500d0a4 100644
--- a/lib/Service/ActivityService.php
+++ b/lib/Service/ActivityService.php
@@ -90,7 +90,7 @@ class ActivityService {
: $this->getMessageFull();
}
- private function getMessageFull() {
+ private function getMessageFull(): string {
switch ($this->eventType) {
case CommentEvent::ADD:
return $this->userIsActor
@@ -236,7 +236,7 @@ class ActivityService {
: $this->trans->t('{actor} has done something indescribable with poll {pollTitle}');
}
- private function getMessageFiltered() {
+ private function getMessageFiltered(): string {
switch ($this->eventType) {
case CommentEvent::ADD:
return $this->userIsActor