@@ -25,28 +25,28 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | if (!extension_loaded('intl')) { |
| 28 | - echo 'Intl extension is required to run this script.'; |
|
| 29 | - exit(1); |
|
| 28 | + echo 'Intl extension is required to run this script.'; |
|
| 29 | + exit(1); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | require '../3rdparty/autoload.php'; |
| 33 | 33 | |
| 34 | 34 | $locales = array_map(static function (string $localeCode) { |
| 35 | - return [ |
|
| 36 | - 'code' => $localeCode, |
|
| 37 | - 'name' => Locale::getDisplayName($localeCode, 'en') |
|
| 38 | - ]; |
|
| 35 | + return [ |
|
| 36 | + 'code' => $localeCode, |
|
| 37 | + 'name' => Locale::getDisplayName($localeCode, 'en') |
|
| 38 | + ]; |
|
| 39 | 39 | }, ResourceBundle::getLocales('')); |
| 40 | 40 | |
| 41 | 41 | $locales = array_filter($locales, static function (array $locale) { |
| 42 | - return is_array(Punic\Data::explodeLocale($locale['code'])); |
|
| 42 | + return is_array(Punic\Data::explodeLocale($locale['code'])); |
|
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | 45 | $locales = array_values($locales); |
| 46 | 46 | |
| 47 | 47 | if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
| 48 | - echo 'Failed to update locales.json'; |
|
| 49 | - exit(1); |
|
| 48 | + echo 'Failed to update locales.json'; |
|
| 49 | + exit(1); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | echo 'Updated locales.json. Don\'t forget to commit the result.'; |
@@ -31,20 +31,20 @@ |
||
| 31 | 31 | |
| 32 | 32 | require '../3rdparty/autoload.php'; |
| 33 | 33 | |
| 34 | -$locales = array_map(static function (string $localeCode) { |
|
| 34 | +$locales = array_map(static function(string $localeCode) { |
|
| 35 | 35 | return [ |
| 36 | 36 | 'code' => $localeCode, |
| 37 | 37 | 'name' => Locale::getDisplayName($localeCode, 'en') |
| 38 | 38 | ]; |
| 39 | 39 | }, ResourceBundle::getLocales('')); |
| 40 | 40 | |
| 41 | -$locales = array_filter($locales, static function (array $locale) { |
|
| 41 | +$locales = array_filter($locales, static function(array $locale) { |
|
| 42 | 42 | return is_array(Punic\Data::explodeLocale($locale['code'])); |
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | 45 | $locales = array_values($locales); |
| 46 | 46 | |
| 47 | -if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
|
| 47 | +if (file_put_contents(__DIR__.'/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) { |
|
| 48 | 48 | echo 'Failed to update locales.json'; |
| 49 | 49 | exit(1); |
| 50 | 50 | } |
@@ -62,10 +62,10 @@ |
||
| 62 | 62 | if (is_array($value)) { |
| 63 | 63 | $output->writeln(" <comment>>></comment> $key:"); |
| 64 | 64 | foreach ($value as $subKey => $subValue) { |
| 65 | - $output->writeln(" <comment>>></comment> $subKey: " . str_repeat(' ', 46 - strlen($subKey)) . $subValue); |
|
| 65 | + $output->writeln(" <comment>>></comment> $subKey: ".str_repeat(' ', 46 - strlen($subKey)).$subValue); |
|
| 66 | 66 | } |
| 67 | 67 | } else { |
| 68 | - $output->writeln(" <comment>>></comment> $key: " . str_repeat(' ', 50 - strlen($key)) . $value); |
|
| 68 | + $output->writeln(" <comment>>></comment> $key: ".str_repeat(' ', 50 - strlen($key)).$value); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | return 0; |
@@ -34,109 +34,109 @@ |
||
| 34 | 34 | use Symfony\Component\Console\Output\OutputInterface; |
| 35 | 35 | |
| 36 | 36 | class StatusCommand extends Command implements CompletionAwareInterface { |
| 37 | - public function __construct( |
|
| 38 | - private Connection $connection, |
|
| 39 | - ) { |
|
| 40 | - parent::__construct(); |
|
| 41 | - } |
|
| 37 | + public function __construct( |
|
| 38 | + private Connection $connection, |
|
| 39 | + ) { |
|
| 40 | + parent::__construct(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - protected function configure() { |
|
| 44 | - $this |
|
| 45 | - ->setName('migrations:status') |
|
| 46 | - ->setDescription('View the status of a set of migrations.') |
|
| 47 | - ->addArgument('app', InputArgument::REQUIRED, 'Name of the app this migration command shall work on'); |
|
| 48 | - } |
|
| 43 | + protected function configure() { |
|
| 44 | + $this |
|
| 45 | + ->setName('migrations:status') |
|
| 46 | + ->setDescription('View the status of a set of migrations.') |
|
| 47 | + ->addArgument('app', InputArgument::REQUIRED, 'Name of the app this migration command shall work on'); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function execute(InputInterface $input, OutputInterface $output): int { |
|
| 51 | - $appName = $input->getArgument('app'); |
|
| 52 | - $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
| 50 | + public function execute(InputInterface $input, OutputInterface $output): int { |
|
| 51 | + $appName = $input->getArgument('app'); |
|
| 52 | + $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
| 53 | 53 | |
| 54 | - $infos = $this->getMigrationsInfos($ms); |
|
| 55 | - foreach ($infos as $key => $value) { |
|
| 56 | - if (is_array($value)) { |
|
| 57 | - $output->writeln(" <comment>>></comment> $key:"); |
|
| 58 | - foreach ($value as $subKey => $subValue) { |
|
| 59 | - $output->writeln(" <comment>>></comment> $subKey: " . str_repeat(' ', 46 - strlen($subKey)) . $subValue); |
|
| 60 | - } |
|
| 61 | - } else { |
|
| 62 | - $output->writeln(" <comment>>></comment> $key: " . str_repeat(' ', 50 - strlen($key)) . $value); |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - return 0; |
|
| 66 | - } |
|
| 54 | + $infos = $this->getMigrationsInfos($ms); |
|
| 55 | + foreach ($infos as $key => $value) { |
|
| 56 | + if (is_array($value)) { |
|
| 57 | + $output->writeln(" <comment>>></comment> $key:"); |
|
| 58 | + foreach ($value as $subKey => $subValue) { |
|
| 59 | + $output->writeln(" <comment>>></comment> $subKey: " . str_repeat(' ', 46 - strlen($subKey)) . $subValue); |
|
| 60 | + } |
|
| 61 | + } else { |
|
| 62 | + $output->writeln(" <comment>>></comment> $key: " . str_repeat(' ', 50 - strlen($key)) . $value); |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + return 0; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @param string $optionName |
|
| 70 | - * @param CompletionContext $context |
|
| 71 | - * @return string[] |
|
| 72 | - */ |
|
| 73 | - public function completeOptionValues($optionName, CompletionContext $context) { |
|
| 74 | - return []; |
|
| 75 | - } |
|
| 68 | + /** |
|
| 69 | + * @param string $optionName |
|
| 70 | + * @param CompletionContext $context |
|
| 71 | + * @return string[] |
|
| 72 | + */ |
|
| 73 | + public function completeOptionValues($optionName, CompletionContext $context) { |
|
| 74 | + return []; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @param string $argumentName |
|
| 79 | - * @param CompletionContext $context |
|
| 80 | - * @return string[] |
|
| 81 | - */ |
|
| 82 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 83 | - if ($argumentName === 'app') { |
|
| 84 | - $allApps = \OC_App::getAllApps(); |
|
| 85 | - return array_diff($allApps, \OC_App::getEnabledApps(true, true)); |
|
| 86 | - } |
|
| 87 | - return []; |
|
| 88 | - } |
|
| 77 | + /** |
|
| 78 | + * @param string $argumentName |
|
| 79 | + * @param CompletionContext $context |
|
| 80 | + * @return string[] |
|
| 81 | + */ |
|
| 82 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 83 | + if ($argumentName === 'app') { |
|
| 84 | + $allApps = \OC_App::getAllApps(); |
|
| 85 | + return array_diff($allApps, \OC_App::getEnabledApps(true, true)); |
|
| 86 | + } |
|
| 87 | + return []; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @param MigrationService $ms |
|
| 92 | - * @return array associative array of human readable info name as key and the actual information as value |
|
| 93 | - */ |
|
| 94 | - public function getMigrationsInfos(MigrationService $ms) { |
|
| 95 | - $executedMigrations = $ms->getMigratedVersions(); |
|
| 96 | - $availableMigrations = $ms->getAvailableVersions(); |
|
| 97 | - $executedUnavailableMigrations = array_diff($executedMigrations, array_keys($availableMigrations)); |
|
| 90 | + /** |
|
| 91 | + * @param MigrationService $ms |
|
| 92 | + * @return array associative array of human readable info name as key and the actual information as value |
|
| 93 | + */ |
|
| 94 | + public function getMigrationsInfos(MigrationService $ms) { |
|
| 95 | + $executedMigrations = $ms->getMigratedVersions(); |
|
| 96 | + $availableMigrations = $ms->getAvailableVersions(); |
|
| 97 | + $executedUnavailableMigrations = array_diff($executedMigrations, array_keys($availableMigrations)); |
|
| 98 | 98 | |
| 99 | - $numExecutedUnavailableMigrations = count($executedUnavailableMigrations); |
|
| 100 | - $numNewMigrations = count(array_diff(array_keys($availableMigrations), $executedMigrations)); |
|
| 101 | - $pending = $ms->describeMigrationStep('lastest'); |
|
| 99 | + $numExecutedUnavailableMigrations = count($executedUnavailableMigrations); |
|
| 100 | + $numNewMigrations = count(array_diff(array_keys($availableMigrations), $executedMigrations)); |
|
| 101 | + $pending = $ms->describeMigrationStep('lastest'); |
|
| 102 | 102 | |
| 103 | - $infos = [ |
|
| 104 | - 'App' => $ms->getApp(), |
|
| 105 | - 'Version Table Name' => $ms->getMigrationsTableName(), |
|
| 106 | - 'Migrations Namespace' => $ms->getMigrationsNamespace(), |
|
| 107 | - 'Migrations Directory' => $ms->getMigrationsDirectory(), |
|
| 108 | - 'Previous Version' => $this->getFormattedVersionAlias($ms, 'prev'), |
|
| 109 | - 'Current Version' => $this->getFormattedVersionAlias($ms, 'current'), |
|
| 110 | - 'Next Version' => $this->getFormattedVersionAlias($ms, 'next'), |
|
| 111 | - 'Latest Version' => $this->getFormattedVersionAlias($ms, 'latest'), |
|
| 112 | - 'Executed Migrations' => count($executedMigrations), |
|
| 113 | - 'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations, |
|
| 114 | - 'Available Migrations' => count($availableMigrations), |
|
| 115 | - 'New Migrations' => $numNewMigrations, |
|
| 116 | - 'Pending Migrations' => count($pending) ? $pending : 'None' |
|
| 117 | - ]; |
|
| 103 | + $infos = [ |
|
| 104 | + 'App' => $ms->getApp(), |
|
| 105 | + 'Version Table Name' => $ms->getMigrationsTableName(), |
|
| 106 | + 'Migrations Namespace' => $ms->getMigrationsNamespace(), |
|
| 107 | + 'Migrations Directory' => $ms->getMigrationsDirectory(), |
|
| 108 | + 'Previous Version' => $this->getFormattedVersionAlias($ms, 'prev'), |
|
| 109 | + 'Current Version' => $this->getFormattedVersionAlias($ms, 'current'), |
|
| 110 | + 'Next Version' => $this->getFormattedVersionAlias($ms, 'next'), |
|
| 111 | + 'Latest Version' => $this->getFormattedVersionAlias($ms, 'latest'), |
|
| 112 | + 'Executed Migrations' => count($executedMigrations), |
|
| 113 | + 'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations, |
|
| 114 | + 'Available Migrations' => count($availableMigrations), |
|
| 115 | + 'New Migrations' => $numNewMigrations, |
|
| 116 | + 'Pending Migrations' => count($pending) ? $pending : 'None' |
|
| 117 | + ]; |
|
| 118 | 118 | |
| 119 | - return $infos; |
|
| 120 | - } |
|
| 119 | + return $infos; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * @param MigrationService $migrationService |
|
| 124 | - * @param string $alias |
|
| 125 | - * @return mixed|null|string |
|
| 126 | - */ |
|
| 127 | - private function getFormattedVersionAlias(MigrationService $migrationService, $alias) { |
|
| 128 | - $migration = $migrationService->getMigration($alias); |
|
| 129 | - //No version found |
|
| 130 | - if ($migration === null) { |
|
| 131 | - if ($alias === 'next') { |
|
| 132 | - return 'Already at latest migration step'; |
|
| 133 | - } |
|
| 122 | + /** |
|
| 123 | + * @param MigrationService $migrationService |
|
| 124 | + * @param string $alias |
|
| 125 | + * @return mixed|null|string |
|
| 126 | + */ |
|
| 127 | + private function getFormattedVersionAlias(MigrationService $migrationService, $alias) { |
|
| 128 | + $migration = $migrationService->getMigration($alias); |
|
| 129 | + //No version found |
|
| 130 | + if ($migration === null) { |
|
| 131 | + if ($alias === 'next') { |
|
| 132 | + return 'Already at latest migration step'; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - if ($alias === 'prev') { |
|
| 136 | - return 'Already at first migration step'; |
|
| 137 | - } |
|
| 138 | - } |
|
| 135 | + if ($alias === 'prev') { |
|
| 136 | + return 'Already at first migration step'; |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - return $migration; |
|
| 141 | - } |
|
| 140 | + return $migration; |
|
| 141 | + } |
|
| 142 | 142 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | protected function execute(InputInterface $input, OutputInterface $output): int { |
| 54 | 54 | $outputType = $input->getOption('output'); |
| 55 | 55 | if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { |
| 56 | - $certificates = array_map(function (ICertificate $certificate) { |
|
| 56 | + $certificates = array_map(function(ICertificate $certificate) { |
|
| 57 | 57 | return [ |
| 58 | 58 | 'name' => $certificate->getName(), |
| 59 | 59 | 'common_name' => $certificate->getCommonName(), |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | 'Issued By' |
| 80 | 80 | ]); |
| 81 | 81 | |
| 82 | - $rows = array_map(function (ICertificate $certificate) { |
|
| 82 | + $rows = array_map(function(ICertificate $certificate) { |
|
| 83 | 83 | return [ |
| 84 | 84 | $certificate->getName(), |
| 85 | 85 | $certificate->getCommonName(), |
@@ -17,64 +17,64 @@ |
||
| 17 | 17 | use Symfony\Component\Console\Output\OutputInterface; |
| 18 | 18 | |
| 19 | 19 | class ListCertificates extends Base { |
| 20 | - protected IL10N $l; |
|
| 20 | + protected IL10N $l; |
|
| 21 | 21 | |
| 22 | - public function __construct( |
|
| 23 | - protected ICertificateManager $certificateManager, |
|
| 24 | - IL10NFactory $l10nFactory, |
|
| 25 | - ) { |
|
| 26 | - parent::__construct(); |
|
| 27 | - $this->l = $l10nFactory->get('core'); |
|
| 28 | - } |
|
| 22 | + public function __construct( |
|
| 23 | + protected ICertificateManager $certificateManager, |
|
| 24 | + IL10NFactory $l10nFactory, |
|
| 25 | + ) { |
|
| 26 | + parent::__construct(); |
|
| 27 | + $this->l = $l10nFactory->get('core'); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - protected function configure() { |
|
| 31 | - $this |
|
| 32 | - ->setName('security:certificates') |
|
| 33 | - ->setDescription('list trusted certificates'); |
|
| 34 | - parent::configure(); |
|
| 35 | - } |
|
| 30 | + protected function configure() { |
|
| 31 | + $this |
|
| 32 | + ->setName('security:certificates') |
|
| 33 | + ->setDescription('list trusted certificates'); |
|
| 34 | + parent::configure(); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 38 | - $outputType = $input->getOption('output'); |
|
| 39 | - if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { |
|
| 40 | - $certificates = array_map(function (ICertificate $certificate) { |
|
| 41 | - return [ |
|
| 42 | - 'name' => $certificate->getName(), |
|
| 43 | - 'common_name' => $certificate->getCommonName(), |
|
| 44 | - 'organization' => $certificate->getOrganization(), |
|
| 45 | - 'expire' => $certificate->getExpireDate()->format(\DateTimeInterface::ATOM), |
|
| 46 | - 'issuer' => $certificate->getIssuerName(), |
|
| 47 | - 'issuer_organization' => $certificate->getIssuerOrganization(), |
|
| 48 | - 'issue_date' => $certificate->getIssueDate()->format(\DateTimeInterface::ATOM) |
|
| 49 | - ]; |
|
| 50 | - }, $this->certificateManager->listCertificates()); |
|
| 51 | - if ($outputType === self::OUTPUT_FORMAT_JSON) { |
|
| 52 | - $output->writeln(json_encode(array_values($certificates))); |
|
| 53 | - } else { |
|
| 54 | - $output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT)); |
|
| 55 | - } |
|
| 56 | - } else { |
|
| 57 | - $table = new Table($output); |
|
| 58 | - $table->setHeaders([ |
|
| 59 | - 'File Name', |
|
| 60 | - 'Common Name', |
|
| 61 | - 'Organization', |
|
| 62 | - 'Valid Until', |
|
| 63 | - 'Issued By' |
|
| 64 | - ]); |
|
| 37 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 38 | + $outputType = $input->getOption('output'); |
|
| 39 | + if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { |
|
| 40 | + $certificates = array_map(function (ICertificate $certificate) { |
|
| 41 | + return [ |
|
| 42 | + 'name' => $certificate->getName(), |
|
| 43 | + 'common_name' => $certificate->getCommonName(), |
|
| 44 | + 'organization' => $certificate->getOrganization(), |
|
| 45 | + 'expire' => $certificate->getExpireDate()->format(\DateTimeInterface::ATOM), |
|
| 46 | + 'issuer' => $certificate->getIssuerName(), |
|
| 47 | + 'issuer_organization' => $certificate->getIssuerOrganization(), |
|
| 48 | + 'issue_date' => $certificate->getIssueDate()->format(\DateTimeInterface::ATOM) |
|
| 49 | + ]; |
|
| 50 | + }, $this->certificateManager->listCertificates()); |
|
| 51 | + if ($outputType === self::OUTPUT_FORMAT_JSON) { |
|
| 52 | + $output->writeln(json_encode(array_values($certificates))); |
|
| 53 | + } else { |
|
| 54 | + $output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT)); |
|
| 55 | + } |
|
| 56 | + } else { |
|
| 57 | + $table = new Table($output); |
|
| 58 | + $table->setHeaders([ |
|
| 59 | + 'File Name', |
|
| 60 | + 'Common Name', |
|
| 61 | + 'Organization', |
|
| 62 | + 'Valid Until', |
|
| 63 | + 'Issued By' |
|
| 64 | + ]); |
|
| 65 | 65 | |
| 66 | - $rows = array_map(function (ICertificate $certificate) { |
|
| 67 | - return [ |
|
| 68 | - $certificate->getName(), |
|
| 69 | - $certificate->getCommonName(), |
|
| 70 | - $certificate->getOrganization(), |
|
| 71 | - $this->l->l('date', $certificate->getExpireDate()), |
|
| 72 | - $certificate->getIssuerName() |
|
| 73 | - ]; |
|
| 74 | - }, $this->certificateManager->listCertificates()); |
|
| 75 | - $table->setRows($rows); |
|
| 76 | - $table->render(); |
|
| 77 | - } |
|
| 78 | - return 0; |
|
| 79 | - } |
|
| 66 | + $rows = array_map(function (ICertificate $certificate) { |
|
| 67 | + return [ |
|
| 68 | + $certificate->getName(), |
|
| 69 | + $certificate->getCommonName(), |
|
| 70 | + $certificate->getOrganization(), |
|
| 71 | + $this->l->l('date', $certificate->getExpireDate()), |
|
| 72 | + $certificate->getIssuerName() |
|
| 73 | + ]; |
|
| 74 | + }, $this->certificateManager->listCertificates()); |
|
| 75 | + $table->setRows($rows); |
|
| 76 | + $table->render(); |
|
| 77 | + } |
|
| 78 | + return 0; |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -76,11 +76,11 @@ |
||
| 76 | 76 | $moduleId = $input->getArgument('module'); |
| 77 | 77 | |
| 78 | 78 | if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) { |
| 79 | - $output->writeln('"' . $moduleId . '"" is already the default module'); |
|
| 79 | + $output->writeln('"'.$moduleId.'"" is already the default module'); |
|
| 80 | 80 | } elseif ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { |
| 81 | - $output->writeln('<info>Set default module to "' . $moduleId . '"</info>'); |
|
| 81 | + $output->writeln('<info>Set default module to "'.$moduleId.'"</info>'); |
|
| 82 | 82 | } else { |
| 83 | - $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>'); |
|
| 83 | + $output->writeln('<error>The specified module "'.$moduleId.'" does not exist</error>'); |
|
| 84 | 84 | return 1; |
| 85 | 85 | } |
| 86 | 86 | return 0; |
@@ -15,45 +15,45 @@ |
||
| 15 | 15 | use Symfony\Component\Console\Output\OutputInterface; |
| 16 | 16 | |
| 17 | 17 | class SetDefaultModule extends Command { |
| 18 | - public function __construct( |
|
| 19 | - protected IManager $encryptionManager, |
|
| 20 | - protected IConfig $config, |
|
| 21 | - ) { |
|
| 22 | - parent::__construct(); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - protected function configure() { |
|
| 26 | - parent::configure(); |
|
| 27 | - |
|
| 28 | - $this |
|
| 29 | - ->setName('encryption:set-default-module') |
|
| 30 | - ->setDescription('Set the encryption default module') |
|
| 31 | - ->addArgument( |
|
| 32 | - 'module', |
|
| 33 | - InputArgument::REQUIRED, |
|
| 34 | - 'ID of the encryption module that should be used' |
|
| 35 | - ) |
|
| 36 | - ; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 40 | - $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); |
|
| 41 | - if ($isMaintenanceModeEnabled) { |
|
| 42 | - $output->writeln('Maintenance mode must be disabled when setting default module,'); |
|
| 43 | - $output->writeln('in order to load the relevant encryption modules correctly.'); |
|
| 44 | - return 1; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - $moduleId = $input->getArgument('module'); |
|
| 48 | - |
|
| 49 | - if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) { |
|
| 50 | - $output->writeln('"' . $moduleId . '"" is already the default module'); |
|
| 51 | - } elseif ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { |
|
| 52 | - $output->writeln('<info>Set default module to "' . $moduleId . '"</info>'); |
|
| 53 | - } else { |
|
| 54 | - $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>'); |
|
| 55 | - return 1; |
|
| 56 | - } |
|
| 57 | - return 0; |
|
| 58 | - } |
|
| 18 | + public function __construct( |
|
| 19 | + protected IManager $encryptionManager, |
|
| 20 | + protected IConfig $config, |
|
| 21 | + ) { |
|
| 22 | + parent::__construct(); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + protected function configure() { |
|
| 26 | + parent::configure(); |
|
| 27 | + |
|
| 28 | + $this |
|
| 29 | + ->setName('encryption:set-default-module') |
|
| 30 | + ->setDescription('Set the encryption default module') |
|
| 31 | + ->addArgument( |
|
| 32 | + 'module', |
|
| 33 | + InputArgument::REQUIRED, |
|
| 34 | + 'ID of the encryption module that should be used' |
|
| 35 | + ) |
|
| 36 | + ; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 40 | + $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); |
|
| 41 | + if ($isMaintenanceModeEnabled) { |
|
| 42 | + $output->writeln('Maintenance mode must be disabled when setting default module,'); |
|
| 43 | + $output->writeln('in order to load the relevant encryption modules correctly.'); |
|
| 44 | + return 1; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + $moduleId = $input->getArgument('module'); |
|
| 48 | + |
|
| 49 | + if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) { |
|
| 50 | + $output->writeln('"' . $moduleId . '"" is already the default module'); |
|
| 51 | + } elseif ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { |
|
| 52 | + $output->writeln('<info>Set default module to "' . $moduleId . '"</info>'); |
|
| 53 | + } else { |
|
| 54 | + $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>'); |
|
| 55 | + return 1; |
|
| 56 | + } |
|
| 57 | + return 0; |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | $column->setType(Type::getType(Types::BIGINT)); |
| 94 | 94 | $column->setOptions(['length' => 20]); |
| 95 | 95 | |
| 96 | - $updates[] = '* ' . $tableName . '.' . $columnName; |
|
| 96 | + $updates[] = '* '.$tableName.'.'.$columnName; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -18,90 +18,90 @@ |
||
| 18 | 18 | use Symfony\Component\Console\Question\ConfirmationQuestion; |
| 19 | 19 | |
| 20 | 20 | class ConvertFilecacheBigInt extends Command { |
| 21 | - public function __construct( |
|
| 22 | - private Connection $connection, |
|
| 23 | - ) { |
|
| 24 | - parent::__construct(); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - protected function configure() { |
|
| 28 | - $this |
|
| 29 | - ->setName('db:convert-filecache-bigint') |
|
| 30 | - ->setDescription('Convert the ID columns of the filecache to BigInt'); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @return array<string,string[]> |
|
| 35 | - */ |
|
| 36 | - public static function getColumnsByTable(): array { |
|
| 37 | - return [ |
|
| 38 | - 'activity' => ['activity_id', 'object_id'], |
|
| 39 | - 'activity_mq' => ['mail_id'], |
|
| 40 | - 'authtoken' => ['id'], |
|
| 41 | - 'bruteforce_attempts' => ['id'], |
|
| 42 | - 'federated_reshares' => ['share_id'], |
|
| 43 | - 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], |
|
| 44 | - 'filecache_extended' => ['fileid'], |
|
| 45 | - 'files_trash' => ['auto_id'], |
|
| 46 | - 'file_locks' => ['id'], |
|
| 47 | - 'file_metadata' => ['id'], |
|
| 48 | - 'jobs' => ['id'], |
|
| 49 | - 'mimetypes' => ['id'], |
|
| 50 | - 'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'], |
|
| 51 | - 'share_external' => ['id', 'parent'], |
|
| 52 | - 'storages' => ['numeric_id'], |
|
| 53 | - ]; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 57 | - $schema = new SchemaWrapper($this->connection); |
|
| 58 | - $isSqlite = $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE; |
|
| 59 | - $updates = []; |
|
| 60 | - |
|
| 61 | - $tables = static::getColumnsByTable(); |
|
| 62 | - foreach ($tables as $tableName => $columns) { |
|
| 63 | - if (!$schema->hasTable($tableName)) { |
|
| 64 | - continue; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - $table = $schema->getTable($tableName); |
|
| 68 | - |
|
| 69 | - foreach ($columns as $columnName) { |
|
| 70 | - $column = $table->getColumn($columnName); |
|
| 71 | - $isAutoIncrement = $column->getAutoincrement(); |
|
| 72 | - $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; |
|
| 73 | - if (Type::lookupName($column->getType()) !== Types::BIGINT && !$isAutoIncrementOnSqlite) { |
|
| 74 | - $column->setType(Type::getType(Types::BIGINT)); |
|
| 75 | - $column->setOptions(['length' => 20]); |
|
| 76 | - |
|
| 77 | - $updates[] = '* ' . $tableName . '.' . $columnName; |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - if (empty($updates)) { |
|
| 83 | - $output->writeln('<info>All tables already up to date!</info>'); |
|
| 84 | - return 0; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - $output->writeln('<comment>Following columns will be updated:</comment>'); |
|
| 88 | - $output->writeln(''); |
|
| 89 | - $output->writeln($updates); |
|
| 90 | - $output->writeln(''); |
|
| 91 | - $output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>'); |
|
| 92 | - |
|
| 93 | - if ($input->isInteractive()) { |
|
| 94 | - /** @var QuestionHelper $helper */ |
|
| 95 | - $helper = $this->getHelper('question'); |
|
| 96 | - $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); |
|
| 97 | - |
|
| 98 | - if (!$helper->ask($input, $output, $question)) { |
|
| 99 | - return 1; |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
| 104 | - |
|
| 105 | - return 0; |
|
| 106 | - } |
|
| 21 | + public function __construct( |
|
| 22 | + private Connection $connection, |
|
| 23 | + ) { |
|
| 24 | + parent::__construct(); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + protected function configure() { |
|
| 28 | + $this |
|
| 29 | + ->setName('db:convert-filecache-bigint') |
|
| 30 | + ->setDescription('Convert the ID columns of the filecache to BigInt'); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @return array<string,string[]> |
|
| 35 | + */ |
|
| 36 | + public static function getColumnsByTable(): array { |
|
| 37 | + return [ |
|
| 38 | + 'activity' => ['activity_id', 'object_id'], |
|
| 39 | + 'activity_mq' => ['mail_id'], |
|
| 40 | + 'authtoken' => ['id'], |
|
| 41 | + 'bruteforce_attempts' => ['id'], |
|
| 42 | + 'federated_reshares' => ['share_id'], |
|
| 43 | + 'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'], |
|
| 44 | + 'filecache_extended' => ['fileid'], |
|
| 45 | + 'files_trash' => ['auto_id'], |
|
| 46 | + 'file_locks' => ['id'], |
|
| 47 | + 'file_metadata' => ['id'], |
|
| 48 | + 'jobs' => ['id'], |
|
| 49 | + 'mimetypes' => ['id'], |
|
| 50 | + 'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'], |
|
| 51 | + 'share_external' => ['id', 'parent'], |
|
| 52 | + 'storages' => ['numeric_id'], |
|
| 53 | + ]; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 57 | + $schema = new SchemaWrapper($this->connection); |
|
| 58 | + $isSqlite = $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE; |
|
| 59 | + $updates = []; |
|
| 60 | + |
|
| 61 | + $tables = static::getColumnsByTable(); |
|
| 62 | + foreach ($tables as $tableName => $columns) { |
|
| 63 | + if (!$schema->hasTable($tableName)) { |
|
| 64 | + continue; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + $table = $schema->getTable($tableName); |
|
| 68 | + |
|
| 69 | + foreach ($columns as $columnName) { |
|
| 70 | + $column = $table->getColumn($columnName); |
|
| 71 | + $isAutoIncrement = $column->getAutoincrement(); |
|
| 72 | + $isAutoIncrementOnSqlite = $isSqlite && $isAutoIncrement; |
|
| 73 | + if (Type::lookupName($column->getType()) !== Types::BIGINT && !$isAutoIncrementOnSqlite) { |
|
| 74 | + $column->setType(Type::getType(Types::BIGINT)); |
|
| 75 | + $column->setOptions(['length' => 20]); |
|
| 76 | + |
|
| 77 | + $updates[] = '* ' . $tableName . '.' . $columnName; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + if (empty($updates)) { |
|
| 83 | + $output->writeln('<info>All tables already up to date!</info>'); |
|
| 84 | + return 0; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + $output->writeln('<comment>Following columns will be updated:</comment>'); |
|
| 88 | + $output->writeln(''); |
|
| 89 | + $output->writeln($updates); |
|
| 90 | + $output->writeln(''); |
|
| 91 | + $output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>'); |
|
| 92 | + |
|
| 93 | + if ($input->isInteractive()) { |
|
| 94 | + /** @var QuestionHelper $helper */ |
|
| 95 | + $helper = $this->getHelper('question'); |
|
| 96 | + $question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false); |
|
| 97 | + |
|
| 98 | + if (!$helper->ask($input, $output, $question)) { |
|
| 99 | + return 1; |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + $this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
| 104 | + |
|
| 105 | + return 0; |
|
| 106 | + } |
|
| 107 | 107 | } |
@@ -35,72 +35,72 @@ |
||
| 35 | 35 | use OCP\Migration\SimpleMigrationStep; |
| 36 | 36 | |
| 37 | 37 | class Version16000Date20190212081545 extends SimpleMigrationStep { |
| 38 | - /** |
|
| 39 | - * @param IOutput $output |
|
| 40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | - * @param array $options |
|
| 42 | - * |
|
| 43 | - * @return ISchemaWrapper |
|
| 44 | - */ |
|
| 45 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
| 46 | - /** @var ISchemaWrapper $schema */ |
|
| 47 | - $schema = $schemaClosure(); |
|
| 38 | + /** |
|
| 39 | + * @param IOutput $output |
|
| 40 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | + * @param array $options |
|
| 42 | + * |
|
| 43 | + * @return ISchemaWrapper |
|
| 44 | + */ |
|
| 45 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
| 46 | + /** @var ISchemaWrapper $schema */ |
|
| 47 | + $schema = $schemaClosure(); |
|
| 48 | 48 | |
| 49 | - $table = $schema->createTable('login_flow_v2'); |
|
| 50 | - $table->addColumn('id', Types::BIGINT, [ |
|
| 51 | - 'autoincrement' => true, |
|
| 52 | - 'notnull' => true, |
|
| 53 | - 'length' => 20, |
|
| 54 | - 'unsigned' => true, |
|
| 55 | - ]); |
|
| 56 | - $table->addColumn('timestamp', Types::BIGINT, [ |
|
| 57 | - 'notnull' => true, |
|
| 58 | - 'length' => 20, |
|
| 59 | - 'unsigned' => true, |
|
| 60 | - ]); |
|
| 61 | - $table->addColumn('started', Types::SMALLINT, [ |
|
| 62 | - 'notnull' => true, |
|
| 63 | - 'length' => 1, |
|
| 64 | - 'unsigned' => true, |
|
| 65 | - 'default' => 0, |
|
| 66 | - ]); |
|
| 67 | - $table->addColumn('poll_token', Types::STRING, [ |
|
| 68 | - 'notnull' => true, |
|
| 69 | - 'length' => 255, |
|
| 70 | - ]); |
|
| 71 | - $table->addColumn('login_token', Types::STRING, [ |
|
| 72 | - 'notnull' => true, |
|
| 73 | - 'length' => 255, |
|
| 74 | - ]); |
|
| 75 | - $table->addColumn('public_key', Types::TEXT, [ |
|
| 76 | - 'notnull' => true, |
|
| 77 | - 'length' => 32768, |
|
| 78 | - ]); |
|
| 79 | - $table->addColumn('private_key', Types::TEXT, [ |
|
| 80 | - 'notnull' => true, |
|
| 81 | - 'length' => 32768, |
|
| 82 | - ]); |
|
| 83 | - $table->addColumn('client_name', Types::STRING, [ |
|
| 84 | - 'notnull' => true, |
|
| 85 | - 'length' => 255, |
|
| 86 | - ]); |
|
| 87 | - $table->addColumn('login_name', Types::STRING, [ |
|
| 88 | - 'notnull' => false, |
|
| 89 | - 'length' => 255, |
|
| 90 | - ]); |
|
| 91 | - $table->addColumn('server', Types::STRING, [ |
|
| 92 | - 'notnull' => false, |
|
| 93 | - 'length' => 255, |
|
| 94 | - ]); |
|
| 95 | - $table->addColumn('app_password', Types::STRING, [ |
|
| 96 | - 'notnull' => false, |
|
| 97 | - 'length' => 1024, |
|
| 98 | - ]); |
|
| 99 | - $table->setPrimaryKey(['id']); |
|
| 100 | - $table->addUniqueIndex(['poll_token'], 'poll_token'); |
|
| 101 | - $table->addUniqueIndex(['login_token'], 'login_token'); |
|
| 102 | - $table->addIndex(['timestamp'], 'timestamp'); |
|
| 49 | + $table = $schema->createTable('login_flow_v2'); |
|
| 50 | + $table->addColumn('id', Types::BIGINT, [ |
|
| 51 | + 'autoincrement' => true, |
|
| 52 | + 'notnull' => true, |
|
| 53 | + 'length' => 20, |
|
| 54 | + 'unsigned' => true, |
|
| 55 | + ]); |
|
| 56 | + $table->addColumn('timestamp', Types::BIGINT, [ |
|
| 57 | + 'notnull' => true, |
|
| 58 | + 'length' => 20, |
|
| 59 | + 'unsigned' => true, |
|
| 60 | + ]); |
|
| 61 | + $table->addColumn('started', Types::SMALLINT, [ |
|
| 62 | + 'notnull' => true, |
|
| 63 | + 'length' => 1, |
|
| 64 | + 'unsigned' => true, |
|
| 65 | + 'default' => 0, |
|
| 66 | + ]); |
|
| 67 | + $table->addColumn('poll_token', Types::STRING, [ |
|
| 68 | + 'notnull' => true, |
|
| 69 | + 'length' => 255, |
|
| 70 | + ]); |
|
| 71 | + $table->addColumn('login_token', Types::STRING, [ |
|
| 72 | + 'notnull' => true, |
|
| 73 | + 'length' => 255, |
|
| 74 | + ]); |
|
| 75 | + $table->addColumn('public_key', Types::TEXT, [ |
|
| 76 | + 'notnull' => true, |
|
| 77 | + 'length' => 32768, |
|
| 78 | + ]); |
|
| 79 | + $table->addColumn('private_key', Types::TEXT, [ |
|
| 80 | + 'notnull' => true, |
|
| 81 | + 'length' => 32768, |
|
| 82 | + ]); |
|
| 83 | + $table->addColumn('client_name', Types::STRING, [ |
|
| 84 | + 'notnull' => true, |
|
| 85 | + 'length' => 255, |
|
| 86 | + ]); |
|
| 87 | + $table->addColumn('login_name', Types::STRING, [ |
|
| 88 | + 'notnull' => false, |
|
| 89 | + 'length' => 255, |
|
| 90 | + ]); |
|
| 91 | + $table->addColumn('server', Types::STRING, [ |
|
| 92 | + 'notnull' => false, |
|
| 93 | + 'length' => 255, |
|
| 94 | + ]); |
|
| 95 | + $table->addColumn('app_password', Types::STRING, [ |
|
| 96 | + 'notnull' => false, |
|
| 97 | + 'length' => 1024, |
|
| 98 | + ]); |
|
| 99 | + $table->setPrimaryKey(['id']); |
|
| 100 | + $table->addUniqueIndex(['poll_token'], 'poll_token'); |
|
| 101 | + $table->addUniqueIndex(['login_token'], 'login_token'); |
|
| 102 | + $table->addIndex(['timestamp'], 'timestamp'); |
|
| 103 | 103 | |
| 104 | - return $schema; |
|
| 105 | - } |
|
| 104 | + return $schema; |
|
| 105 | + } |
|
| 106 | 106 | } |
@@ -30,65 +30,65 @@ |
||
| 30 | 30 | use OCP\Migration\SimpleMigrationStep; |
| 31 | 31 | |
| 32 | 32 | class Version13000Date20170705121758 extends SimpleMigrationStep { |
| 33 | - /** |
|
| 34 | - * @param IOutput $output |
|
| 35 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 36 | - * @param array $options |
|
| 37 | - * @return null|ISchemaWrapper |
|
| 38 | - * @since 13.0.0 |
|
| 39 | - */ |
|
| 40 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 41 | - /** @var ISchemaWrapper $schema */ |
|
| 42 | - $schema = $schemaClosure(); |
|
| 33 | + /** |
|
| 34 | + * @param IOutput $output |
|
| 35 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 36 | + * @param array $options |
|
| 37 | + * @return null|ISchemaWrapper |
|
| 38 | + * @since 13.0.0 |
|
| 39 | + */ |
|
| 40 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 41 | + /** @var ISchemaWrapper $schema */ |
|
| 42 | + $schema = $schemaClosure(); |
|
| 43 | 43 | |
| 44 | - if (!$schema->hasTable('personal_sections')) { |
|
| 45 | - $table = $schema->createTable('personal_sections'); |
|
| 44 | + if (!$schema->hasTable('personal_sections')) { |
|
| 45 | + $table = $schema->createTable('personal_sections'); |
|
| 46 | 46 | |
| 47 | - $table->addColumn('id', Types::STRING, [ |
|
| 48 | - 'notnull' => false, |
|
| 49 | - 'length' => 64, |
|
| 50 | - ]); |
|
| 51 | - $table->addColumn('class', Types::STRING, [ |
|
| 52 | - 'notnull' => true, |
|
| 53 | - 'length' => 255, |
|
| 54 | - ]); |
|
| 55 | - $table->addColumn('priority', Types::INTEGER, [ |
|
| 56 | - 'notnull' => true, |
|
| 57 | - 'length' => 6, |
|
| 58 | - 'default' => 0, |
|
| 59 | - ]); |
|
| 47 | + $table->addColumn('id', Types::STRING, [ |
|
| 48 | + 'notnull' => false, |
|
| 49 | + 'length' => 64, |
|
| 50 | + ]); |
|
| 51 | + $table->addColumn('class', Types::STRING, [ |
|
| 52 | + 'notnull' => true, |
|
| 53 | + 'length' => 255, |
|
| 54 | + ]); |
|
| 55 | + $table->addColumn('priority', Types::INTEGER, [ |
|
| 56 | + 'notnull' => true, |
|
| 57 | + 'length' => 6, |
|
| 58 | + 'default' => 0, |
|
| 59 | + ]); |
|
| 60 | 60 | |
| 61 | - $table->setPrimaryKey(['id'], 'personal_sections_id_index'); |
|
| 62 | - $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
| 63 | - } |
|
| 61 | + $table->setPrimaryKey(['id'], 'personal_sections_id_index'); |
|
| 62 | + $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - if (!$schema->hasTable('personal_settings')) { |
|
| 66 | - $table = $schema->createTable('personal_settings'); |
|
| 65 | + if (!$schema->hasTable('personal_settings')) { |
|
| 66 | + $table = $schema->createTable('personal_settings'); |
|
| 67 | 67 | |
| 68 | - $table->addColumn('id', Types::INTEGER, [ |
|
| 69 | - 'autoincrement' => true, |
|
| 70 | - 'notnull' => true, |
|
| 71 | - 'length' => 20, |
|
| 72 | - ]); |
|
| 73 | - $table->addColumn('class', Types::STRING, [ |
|
| 74 | - 'notnull' => true, |
|
| 75 | - 'length' => 255, |
|
| 76 | - ]); |
|
| 77 | - $table->addColumn('section', Types::STRING, [ |
|
| 78 | - 'notnull' => false, |
|
| 79 | - 'length' => 64, |
|
| 80 | - ]); |
|
| 81 | - $table->addColumn('priority', Types::INTEGER, [ |
|
| 82 | - 'notnull' => true, |
|
| 83 | - 'length' => 6, |
|
| 84 | - 'default' => 0, |
|
| 85 | - ]); |
|
| 68 | + $table->addColumn('id', Types::INTEGER, [ |
|
| 69 | + 'autoincrement' => true, |
|
| 70 | + 'notnull' => true, |
|
| 71 | + 'length' => 20, |
|
| 72 | + ]); |
|
| 73 | + $table->addColumn('class', Types::STRING, [ |
|
| 74 | + 'notnull' => true, |
|
| 75 | + 'length' => 255, |
|
| 76 | + ]); |
|
| 77 | + $table->addColumn('section', Types::STRING, [ |
|
| 78 | + 'notnull' => false, |
|
| 79 | + 'length' => 64, |
|
| 80 | + ]); |
|
| 81 | + $table->addColumn('priority', Types::INTEGER, [ |
|
| 82 | + 'notnull' => true, |
|
| 83 | + 'length' => 6, |
|
| 84 | + 'default' => 0, |
|
| 85 | + ]); |
|
| 86 | 86 | |
| 87 | - $table->setPrimaryKey(['id'], 'personal_settings_id_index'); |
|
| 88 | - $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
| 89 | - $table->addIndex(['section'], 'personal_settings_section'); |
|
| 90 | - } |
|
| 87 | + $table->setPrimaryKey(['id'], 'personal_settings_id_index'); |
|
| 88 | + $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
| 89 | + $table->addIndex(['section'], 'personal_settings_section'); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return $schema; |
|
| 93 | - } |
|
| 92 | + return $schema; |
|
| 93 | + } |
|
| 94 | 94 | } |
@@ -35,61 +35,61 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | class Version1006Date20180619154313 extends SimpleMigrationStep { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param IOutput $output |
|
| 40 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | - * @param array $options |
|
| 42 | - * @return null|ISchemaWrapper |
|
| 43 | - * @since 13.0.0 |
|
| 44 | - */ |
|
| 45 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 46 | - /** @var ISchemaWrapper $schema */ |
|
| 47 | - $schema = $schemaClosure(); |
|
| 38 | + /** |
|
| 39 | + * @param IOutput $output |
|
| 40 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | + * @param array $options |
|
| 42 | + * @return null|ISchemaWrapper |
|
| 43 | + * @since 13.0.0 |
|
| 44 | + */ |
|
| 45 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 46 | + /** @var ISchemaWrapper $schema */ |
|
| 47 | + $schema = $schemaClosure(); |
|
| 48 | 48 | |
| 49 | - if (!$schema->hasTable('calendar_invitations')) { |
|
| 50 | - $table = $schema->createTable('calendar_invitations'); |
|
| 49 | + if (!$schema->hasTable('calendar_invitations')) { |
|
| 50 | + $table = $schema->createTable('calendar_invitations'); |
|
| 51 | 51 | |
| 52 | - $table->addColumn('id', Types::BIGINT, [ |
|
| 53 | - 'autoincrement' => true, |
|
| 54 | - 'notnull' => true, |
|
| 55 | - 'length' => 11, |
|
| 56 | - 'unsigned' => true, |
|
| 57 | - ]); |
|
| 58 | - $table->addColumn('uid', Types::STRING, [ |
|
| 59 | - 'notnull' => true, |
|
| 60 | - 'length' => 255, |
|
| 61 | - ]); |
|
| 62 | - $table->addColumn('recurrenceid', Types::STRING, [ |
|
| 63 | - 'notnull' => false, |
|
| 64 | - 'length' => 255, |
|
| 65 | - ]); |
|
| 66 | - $table->addColumn('attendee', Types::STRING, [ |
|
| 67 | - 'notnull' => true, |
|
| 68 | - 'length' => 255, |
|
| 69 | - ]); |
|
| 70 | - $table->addColumn('organizer', Types::STRING, [ |
|
| 71 | - 'notnull' => true, |
|
| 72 | - 'length' => 255, |
|
| 73 | - ]); |
|
| 74 | - $table->addColumn('sequence', Types::BIGINT, [ |
|
| 75 | - 'notnull' => false, |
|
| 76 | - 'length' => 11, |
|
| 77 | - 'unsigned' => true, |
|
| 78 | - ]); |
|
| 79 | - $table->addColumn('token', Types::STRING, [ |
|
| 80 | - 'notnull' => true, |
|
| 81 | - 'length' => 60, |
|
| 82 | - ]); |
|
| 83 | - $table->addColumn('expiration', Types::BIGINT, [ |
|
| 84 | - 'notnull' => true, |
|
| 85 | - 'length' => 11, |
|
| 86 | - 'unsigned' => true, |
|
| 87 | - ]); |
|
| 52 | + $table->addColumn('id', Types::BIGINT, [ |
|
| 53 | + 'autoincrement' => true, |
|
| 54 | + 'notnull' => true, |
|
| 55 | + 'length' => 11, |
|
| 56 | + 'unsigned' => true, |
|
| 57 | + ]); |
|
| 58 | + $table->addColumn('uid', Types::STRING, [ |
|
| 59 | + 'notnull' => true, |
|
| 60 | + 'length' => 255, |
|
| 61 | + ]); |
|
| 62 | + $table->addColumn('recurrenceid', Types::STRING, [ |
|
| 63 | + 'notnull' => false, |
|
| 64 | + 'length' => 255, |
|
| 65 | + ]); |
|
| 66 | + $table->addColumn('attendee', Types::STRING, [ |
|
| 67 | + 'notnull' => true, |
|
| 68 | + 'length' => 255, |
|
| 69 | + ]); |
|
| 70 | + $table->addColumn('organizer', Types::STRING, [ |
|
| 71 | + 'notnull' => true, |
|
| 72 | + 'length' => 255, |
|
| 73 | + ]); |
|
| 74 | + $table->addColumn('sequence', Types::BIGINT, [ |
|
| 75 | + 'notnull' => false, |
|
| 76 | + 'length' => 11, |
|
| 77 | + 'unsigned' => true, |
|
| 78 | + ]); |
|
| 79 | + $table->addColumn('token', Types::STRING, [ |
|
| 80 | + 'notnull' => true, |
|
| 81 | + 'length' => 60, |
|
| 82 | + ]); |
|
| 83 | + $table->addColumn('expiration', Types::BIGINT, [ |
|
| 84 | + 'notnull' => true, |
|
| 85 | + 'length' => 11, |
|
| 86 | + 'unsigned' => true, |
|
| 87 | + ]); |
|
| 88 | 88 | |
| 89 | - $table->setPrimaryKey(['id']); |
|
| 90 | - $table->addIndex(['token'], 'calendar_invitation_tokens'); |
|
| 89 | + $table->setPrimaryKey(['id']); |
|
| 90 | + $table->addIndex(['token'], 'calendar_invitation_tokens'); |
|
| 91 | 91 | |
| 92 | - return $schema; |
|
| 93 | - } |
|
| 94 | - } |
|
| 92 | + return $schema; |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -33,56 +33,56 @@ |
||
| 33 | 33 | |
| 34 | 34 | class Version1005Date20180530124431 extends SimpleMigrationStep { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param IOutput $output |
|
| 38 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | - * @param array $options |
|
| 40 | - * @return null|ISchemaWrapper |
|
| 41 | - * @since 13.0.0 |
|
| 42 | - */ |
|
| 43 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 44 | - /** @var ISchemaWrapper $schema */ |
|
| 45 | - $schema = $schemaClosure(); |
|
| 36 | + /** |
|
| 37 | + * @param IOutput $output |
|
| 38 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | + * @param array $options |
|
| 40 | + * @return null|ISchemaWrapper |
|
| 41 | + * @since 13.0.0 |
|
| 42 | + */ |
|
| 43 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 44 | + /** @var ISchemaWrapper $schema */ |
|
| 45 | + $schema = $schemaClosure(); |
|
| 46 | 46 | |
| 47 | - $types = ['resources', 'rooms']; |
|
| 48 | - foreach ($types as $type) { |
|
| 49 | - if (!$schema->hasTable('calendar_' . $type)) { |
|
| 50 | - $table = $schema->createTable('calendar_' . $type); |
|
| 47 | + $types = ['resources', 'rooms']; |
|
| 48 | + foreach ($types as $type) { |
|
| 49 | + if (!$schema->hasTable('calendar_' . $type)) { |
|
| 50 | + $table = $schema->createTable('calendar_' . $type); |
|
| 51 | 51 | |
| 52 | - $table->addColumn('id', Types::BIGINT, [ |
|
| 53 | - 'autoincrement' => true, |
|
| 54 | - 'notnull' => true, |
|
| 55 | - 'length' => 11, |
|
| 56 | - 'unsigned' => true, |
|
| 57 | - ]); |
|
| 58 | - $table->addColumn('backend_id', Types::STRING, [ |
|
| 59 | - 'notnull' => false, |
|
| 60 | - 'length' => 64, |
|
| 61 | - ]); |
|
| 62 | - $table->addColumn('resource_id', Types::STRING, [ |
|
| 63 | - 'notnull' => false, |
|
| 64 | - 'length' => 64, |
|
| 65 | - ]); |
|
| 66 | - $table->addColumn('email', Types::STRING, [ |
|
| 67 | - 'notnull' => false, |
|
| 68 | - 'length' => 255, |
|
| 69 | - ]); |
|
| 70 | - $table->addColumn('displayname', Types::STRING, [ |
|
| 71 | - 'notnull' => false, |
|
| 72 | - 'length' => 255, |
|
| 73 | - ]); |
|
| 74 | - $table->addColumn('group_restrictions', Types::STRING, [ |
|
| 75 | - 'notnull' => false, |
|
| 76 | - 'length' => 4000, |
|
| 77 | - ]); |
|
| 52 | + $table->addColumn('id', Types::BIGINT, [ |
|
| 53 | + 'autoincrement' => true, |
|
| 54 | + 'notnull' => true, |
|
| 55 | + 'length' => 11, |
|
| 56 | + 'unsigned' => true, |
|
| 57 | + ]); |
|
| 58 | + $table->addColumn('backend_id', Types::STRING, [ |
|
| 59 | + 'notnull' => false, |
|
| 60 | + 'length' => 64, |
|
| 61 | + ]); |
|
| 62 | + $table->addColumn('resource_id', Types::STRING, [ |
|
| 63 | + 'notnull' => false, |
|
| 64 | + 'length' => 64, |
|
| 65 | + ]); |
|
| 66 | + $table->addColumn('email', Types::STRING, [ |
|
| 67 | + 'notnull' => false, |
|
| 68 | + 'length' => 255, |
|
| 69 | + ]); |
|
| 70 | + $table->addColumn('displayname', Types::STRING, [ |
|
| 71 | + 'notnull' => false, |
|
| 72 | + 'length' => 255, |
|
| 73 | + ]); |
|
| 74 | + $table->addColumn('group_restrictions', Types::STRING, [ |
|
| 75 | + 'notnull' => false, |
|
| 76 | + 'length' => 4000, |
|
| 77 | + ]); |
|
| 78 | 78 | |
| 79 | - $table->setPrimaryKey(['id']); |
|
| 80 | - $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc'); |
|
| 81 | - $table->addIndex(['email'], 'calendar_' . $type . '_email'); |
|
| 82 | - $table->addIndex(['displayname'], 'calendar_' . $type . '_name'); |
|
| 83 | - } |
|
| 84 | - } |
|
| 79 | + $table->setPrimaryKey(['id']); |
|
| 80 | + $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc'); |
|
| 81 | + $table->addIndex(['email'], 'calendar_' . $type . '_email'); |
|
| 82 | + $table->addIndex(['displayname'], 'calendar_' . $type . '_name'); |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - return $schema; |
|
| 87 | - } |
|
| 86 | + return $schema; |
|
| 87 | + } |
|
| 88 | 88 | } |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $types = ['resources', 'rooms']; |
| 48 | 48 | foreach ($types as $type) { |
| 49 | - if (!$schema->hasTable('calendar_' . $type)) { |
|
| 50 | - $table = $schema->createTable('calendar_' . $type); |
|
| 49 | + if (!$schema->hasTable('calendar_'.$type)) { |
|
| 50 | + $table = $schema->createTable('calendar_'.$type); |
|
| 51 | 51 | |
| 52 | 52 | $table->addColumn('id', Types::BIGINT, [ |
| 53 | 53 | 'autoincrement' => true, |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | ]); |
| 78 | 78 | |
| 79 | 79 | $table->setPrimaryKey(['id']); |
| 80 | - $table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc'); |
|
| 81 | - $table->addIndex(['email'], 'calendar_' . $type . '_email'); |
|
| 82 | - $table->addIndex(['displayname'], 'calendar_' . $type . '_name'); |
|
| 80 | + $table->addIndex(['backend_id', 'resource_id'], 'calendar_'.$type.'_bkdrsc'); |
|
| 81 | + $table->addIndex(['email'], 'calendar_'.$type.'_email'); |
|
| 82 | + $table->addIndex(['displayname'], 'calendar_'.$type.'_name'); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |