@@ -72,17 +72,17 @@ |
||
| 72 | 72 | public function run($arguments) { |
| 73 | 73 | $uid = $arguments['uid']; |
| 74 | 74 | if (!$this->userManager->userExists($uid)) { |
| 75 | - $this->logger->info('User no longer exists, skip user ' . $uid); |
|
| 75 | + $this->logger->info('User no longer exists, skip user '.$uid); |
|
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | - $this->logger->info('Started preview cleanup for ' . $uid); |
|
| 78 | + $this->logger->info('Started preview cleanup for '.$uid); |
|
| 79 | 79 | $empty = $this->cleanupPreviews($uid); |
| 80 | 80 | |
| 81 | 81 | if (!$empty) { |
| 82 | 82 | $this->jobList->add(self::class, ['uid' => $uid]); |
| 83 | - $this->logger->info('New preview cleanup scheduled for ' . $uid); |
|
| 83 | + $this->logger->info('New preview cleanup scheduled for '.$uid); |
|
| 84 | 84 | } else { |
| 85 | - $this->logger->info('Preview cleanup done for ' . $uid); |
|
| 85 | + $this->logger->info('Preview cleanup done for '.$uid); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
@@ -19,73 +19,73 @@ |
||
| 19 | 19 | use Psr\Log\LoggerInterface; |
| 20 | 20 | |
| 21 | 21 | class CleanPreviewsBackgroundJob extends QueuedJob { |
| 22 | - public function __construct( |
|
| 23 | - private IRootFolder $rootFolder, |
|
| 24 | - private LoggerInterface $logger, |
|
| 25 | - private IJobList $jobList, |
|
| 26 | - ITimeFactory $timeFactory, |
|
| 27 | - private IUserManager $userManager, |
|
| 28 | - ) { |
|
| 29 | - parent::__construct($timeFactory); |
|
| 30 | - } |
|
| 22 | + public function __construct( |
|
| 23 | + private IRootFolder $rootFolder, |
|
| 24 | + private LoggerInterface $logger, |
|
| 25 | + private IJobList $jobList, |
|
| 26 | + ITimeFactory $timeFactory, |
|
| 27 | + private IUserManager $userManager, |
|
| 28 | + ) { |
|
| 29 | + parent::__construct($timeFactory); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function run($arguments) { |
|
| 33 | - $uid = $arguments['uid']; |
|
| 34 | - if (!$this->userManager->userExists($uid)) { |
|
| 35 | - $this->logger->info('User no longer exists, skip user ' . $uid); |
|
| 36 | - return; |
|
| 37 | - } |
|
| 38 | - $this->logger->info('Started preview cleanup for ' . $uid); |
|
| 39 | - $empty = $this->cleanupPreviews($uid); |
|
| 32 | + public function run($arguments) { |
|
| 33 | + $uid = $arguments['uid']; |
|
| 34 | + if (!$this->userManager->userExists($uid)) { |
|
| 35 | + $this->logger->info('User no longer exists, skip user ' . $uid); |
|
| 36 | + return; |
|
| 37 | + } |
|
| 38 | + $this->logger->info('Started preview cleanup for ' . $uid); |
|
| 39 | + $empty = $this->cleanupPreviews($uid); |
|
| 40 | 40 | |
| 41 | - if (!$empty) { |
|
| 42 | - $this->jobList->add(self::class, ['uid' => $uid]); |
|
| 43 | - $this->logger->info('New preview cleanup scheduled for ' . $uid); |
|
| 44 | - } else { |
|
| 45 | - $this->logger->info('Preview cleanup done for ' . $uid); |
|
| 46 | - } |
|
| 47 | - } |
|
| 41 | + if (!$empty) { |
|
| 42 | + $this->jobList->add(self::class, ['uid' => $uid]); |
|
| 43 | + $this->logger->info('New preview cleanup scheduled for ' . $uid); |
|
| 44 | + } else { |
|
| 45 | + $this->logger->info('Preview cleanup done for ' . $uid); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param string $uid |
|
| 51 | - */ |
|
| 52 | - private function cleanupPreviews($uid): bool { |
|
| 53 | - try { |
|
| 54 | - $userFolder = $this->rootFolder->getUserFolder($uid); |
|
| 55 | - } catch (NotFoundException $e) { |
|
| 56 | - return true; |
|
| 57 | - } |
|
| 49 | + /** |
|
| 50 | + * @param string $uid |
|
| 51 | + */ |
|
| 52 | + private function cleanupPreviews($uid): bool { |
|
| 53 | + try { |
|
| 54 | + $userFolder = $this->rootFolder->getUserFolder($uid); |
|
| 55 | + } catch (NotFoundException $e) { |
|
| 56 | + return true; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - $userRoot = $userFolder->getParent(); |
|
| 59 | + $userRoot = $userFolder->getParent(); |
|
| 60 | 60 | |
| 61 | - try { |
|
| 62 | - /** @var Folder $thumbnailFolder */ |
|
| 63 | - $thumbnailFolder = $userRoot->get('thumbnails'); |
|
| 64 | - } catch (NotFoundException $e) { |
|
| 65 | - return true; |
|
| 66 | - } |
|
| 61 | + try { |
|
| 62 | + /** @var Folder $thumbnailFolder */ |
|
| 63 | + $thumbnailFolder = $userRoot->get('thumbnails'); |
|
| 64 | + } catch (NotFoundException $e) { |
|
| 65 | + return true; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - $thumbnails = $thumbnailFolder->getDirectoryListing(); |
|
| 68 | + $thumbnails = $thumbnailFolder->getDirectoryListing(); |
|
| 69 | 69 | |
| 70 | - $start = $this->time->getTime(); |
|
| 71 | - foreach ($thumbnails as $thumbnail) { |
|
| 72 | - try { |
|
| 73 | - $thumbnail->delete(); |
|
| 74 | - } catch (NotPermittedException $e) { |
|
| 75 | - // Ignore |
|
| 76 | - } |
|
| 70 | + $start = $this->time->getTime(); |
|
| 71 | + foreach ($thumbnails as $thumbnail) { |
|
| 72 | + try { |
|
| 73 | + $thumbnail->delete(); |
|
| 74 | + } catch (NotPermittedException $e) { |
|
| 75 | + // Ignore |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - if (($this->time->getTime() - $start) > 15) { |
|
| 79 | - return false; |
|
| 80 | - } |
|
| 81 | - } |
|
| 78 | + if (($this->time->getTime() - $start) > 15) { |
|
| 79 | + return false; |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - try { |
|
| 84 | - $thumbnailFolder->delete(); |
|
| 85 | - } catch (NotPermittedException $e) { |
|
| 86 | - // Ignore |
|
| 87 | - } |
|
| 83 | + try { |
|
| 84 | + $thumbnailFolder->delete(); |
|
| 85 | + } catch (NotPermittedException $e) { |
|
| 86 | + // Ignore |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - return true; |
|
| 90 | - } |
|
| 89 | + return true; |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | ->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($oldCode), IQueryBuilder::PARAM_STR)) |
| 85 | 85 | ->execute(); |
| 86 | 86 | |
| 87 | - $output->info('Changed ' . $affectedRows . ' setting(s) from "' . $oldCode . '" to "' . $newCode . '" in preferences table.'); |
|
| 87 | + $output->info('Changed '.$affectedRows.' setting(s) from "'.$oldCode.'" to "'.$newCode.'" in preferences table.'); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -12,60 +12,60 @@ |
||
| 12 | 12 | use OCP\Migration\IRepairStep; |
| 13 | 13 | |
| 14 | 14 | class UpdateLanguageCodes implements IRepairStep { |
| 15 | - /** @var IDBConnection */ |
|
| 16 | - private $connection; |
|
| 15 | + /** @var IDBConnection */ |
|
| 16 | + private $connection; |
|
| 17 | 17 | |
| 18 | - /** @var IConfig */ |
|
| 19 | - private $config; |
|
| 18 | + /** @var IConfig */ |
|
| 19 | + private $config; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @param IDBConnection $connection |
|
| 23 | - * @param IConfig $config |
|
| 24 | - */ |
|
| 25 | - public function __construct(IDBConnection $connection, |
|
| 26 | - IConfig $config) { |
|
| 27 | - $this->connection = $connection; |
|
| 28 | - $this->config = $config; |
|
| 29 | - } |
|
| 21 | + /** |
|
| 22 | + * @param IDBConnection $connection |
|
| 23 | + * @param IConfig $config |
|
| 24 | + */ |
|
| 25 | + public function __construct(IDBConnection $connection, |
|
| 26 | + IConfig $config) { |
|
| 27 | + $this->connection = $connection; |
|
| 28 | + $this->config = $config; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * {@inheritdoc} |
|
| 33 | - */ |
|
| 34 | - public function getName() { |
|
| 35 | - return 'Repair language codes'; |
|
| 36 | - } |
|
| 31 | + /** |
|
| 32 | + * {@inheritdoc} |
|
| 33 | + */ |
|
| 34 | + public function getName() { |
|
| 35 | + return 'Repair language codes'; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * {@inheritdoc} |
|
| 40 | - */ |
|
| 41 | - public function run(IOutput $output) { |
|
| 42 | - $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); |
|
| 38 | + /** |
|
| 39 | + * {@inheritdoc} |
|
| 40 | + */ |
|
| 41 | + public function run(IOutput $output) { |
|
| 42 | + $versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0'); |
|
| 43 | 43 | |
| 44 | - if (version_compare($versionFromBeforeUpdate, '12.0.0.13', '>')) { |
|
| 45 | - return; |
|
| 46 | - } |
|
| 44 | + if (version_compare($versionFromBeforeUpdate, '12.0.0.13', '>')) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $languages = [ |
|
| 49 | - 'bg_BG' => 'bg', |
|
| 50 | - 'cs_CZ' => 'cs', |
|
| 51 | - 'fi_FI' => 'fi', |
|
| 52 | - 'hu_HU' => 'hu', |
|
| 53 | - 'nb_NO' => 'nb', |
|
| 54 | - 'sk_SK' => 'sk', |
|
| 55 | - 'th_TH' => 'th', |
|
| 56 | - ]; |
|
| 48 | + $languages = [ |
|
| 49 | + 'bg_BG' => 'bg', |
|
| 50 | + 'cs_CZ' => 'cs', |
|
| 51 | + 'fi_FI' => 'fi', |
|
| 52 | + 'hu_HU' => 'hu', |
|
| 53 | + 'nb_NO' => 'nb', |
|
| 54 | + 'sk_SK' => 'sk', |
|
| 55 | + 'th_TH' => 'th', |
|
| 56 | + ]; |
|
| 57 | 57 | |
| 58 | - foreach ($languages as $oldCode => $newCode) { |
|
| 59 | - $qb = $this->connection->getQueryBuilder(); |
|
| 58 | + foreach ($languages as $oldCode => $newCode) { |
|
| 59 | + $qb = $this->connection->getQueryBuilder(); |
|
| 60 | 60 | |
| 61 | - $affectedRows = $qb->update('preferences') |
|
| 62 | - ->set('configvalue', $qb->createNamedParameter($newCode)) |
|
| 63 | - ->where($qb->expr()->eq('appid', $qb->createNamedParameter('core'))) |
|
| 64 | - ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang'))) |
|
| 65 | - ->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($oldCode), IQueryBuilder::PARAM_STR)) |
|
| 66 | - ->execute(); |
|
| 61 | + $affectedRows = $qb->update('preferences') |
|
| 62 | + ->set('configvalue', $qb->createNamedParameter($newCode)) |
|
| 63 | + ->where($qb->expr()->eq('appid', $qb->createNamedParameter('core'))) |
|
| 64 | + ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang'))) |
|
| 65 | + ->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($oldCode), IQueryBuilder::PARAM_STR)) |
|
| 66 | + ->execute(); |
|
| 67 | 67 | |
| 68 | - $output->info('Changed ' . $affectedRows . ' setting(s) from "' . $oldCode . '" to "' . $newCode . '" in preferences table.'); |
|
| 69 | - } |
|
| 70 | - } |
|
| 68 | + $output->info('Changed ' . $affectedRows . ' setting(s) from "' . $oldCode . '" to "' . $newCode . '" in preferences table.'); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -33,55 +33,55 @@ |
||
| 33 | 33 | use OCP\Migration\SimpleMigrationStep; |
| 34 | 34 | |
| 35 | 35 | class Version1010Date20200630192639 extends SimpleMigrationStep { |
| 36 | - /** |
|
| 37 | - * @param IOutput $output |
|
| 38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | - * @param array $options |
|
| 40 | - * @return null|ISchemaWrapper |
|
| 41 | - */ |
|
| 42 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | - /** @var ISchemaWrapper $schema */ |
|
| 44 | - $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 | + */ |
|
| 42 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | + /** @var ISchemaWrapper $schema */ |
|
| 44 | + $schema = $schemaClosure(); |
|
| 45 | 45 | |
| 46 | - if (!$schema->hasTable('files_trash')) { |
|
| 47 | - $table = $schema->createTable('files_trash'); |
|
| 48 | - $table->addColumn('auto_id', Types::BIGINT, [ |
|
| 49 | - 'autoincrement' => true, |
|
| 50 | - 'notnull' => true, |
|
| 51 | - ]); |
|
| 52 | - $table->addColumn('id', Types::STRING, [ |
|
| 53 | - 'notnull' => true, |
|
| 54 | - 'length' => 250, |
|
| 55 | - 'default' => '', |
|
| 56 | - ]); |
|
| 57 | - $table->addColumn('user', Types::STRING, [ |
|
| 58 | - 'notnull' => true, |
|
| 59 | - 'length' => 64, |
|
| 60 | - 'default' => '', |
|
| 61 | - ]); |
|
| 62 | - $table->addColumn('timestamp', Types::STRING, [ |
|
| 63 | - 'notnull' => true, |
|
| 64 | - 'length' => 12, |
|
| 65 | - 'default' => '', |
|
| 66 | - ]); |
|
| 67 | - $table->addColumn('location', Types::STRING, [ |
|
| 68 | - 'notnull' => true, |
|
| 69 | - 'length' => 512, |
|
| 70 | - 'default' => '', |
|
| 71 | - ]); |
|
| 72 | - $table->addColumn('type', Types::STRING, [ |
|
| 73 | - 'notnull' => false, |
|
| 74 | - 'length' => 4, |
|
| 75 | - ]); |
|
| 76 | - $table->addColumn('mime', Types::STRING, [ |
|
| 77 | - 'notnull' => false, |
|
| 78 | - 'length' => 255, |
|
| 79 | - ]); |
|
| 80 | - $table->setPrimaryKey(['auto_id']); |
|
| 81 | - $table->addIndex(['id'], 'id_index'); |
|
| 82 | - $table->addIndex(['timestamp'], 'timestamp_index'); |
|
| 83 | - $table->addIndex(['user'], 'user_index'); |
|
| 84 | - } |
|
| 85 | - return $schema; |
|
| 86 | - } |
|
| 46 | + if (!$schema->hasTable('files_trash')) { |
|
| 47 | + $table = $schema->createTable('files_trash'); |
|
| 48 | + $table->addColumn('auto_id', Types::BIGINT, [ |
|
| 49 | + 'autoincrement' => true, |
|
| 50 | + 'notnull' => true, |
|
| 51 | + ]); |
|
| 52 | + $table->addColumn('id', Types::STRING, [ |
|
| 53 | + 'notnull' => true, |
|
| 54 | + 'length' => 250, |
|
| 55 | + 'default' => '', |
|
| 56 | + ]); |
|
| 57 | + $table->addColumn('user', Types::STRING, [ |
|
| 58 | + 'notnull' => true, |
|
| 59 | + 'length' => 64, |
|
| 60 | + 'default' => '', |
|
| 61 | + ]); |
|
| 62 | + $table->addColumn('timestamp', Types::STRING, [ |
|
| 63 | + 'notnull' => true, |
|
| 64 | + 'length' => 12, |
|
| 65 | + 'default' => '', |
|
| 66 | + ]); |
|
| 67 | + $table->addColumn('location', Types::STRING, [ |
|
| 68 | + 'notnull' => true, |
|
| 69 | + 'length' => 512, |
|
| 70 | + 'default' => '', |
|
| 71 | + ]); |
|
| 72 | + $table->addColumn('type', Types::STRING, [ |
|
| 73 | + 'notnull' => false, |
|
| 74 | + 'length' => 4, |
|
| 75 | + ]); |
|
| 76 | + $table->addColumn('mime', Types::STRING, [ |
|
| 77 | + 'notnull' => false, |
|
| 78 | + 'length' => 255, |
|
| 79 | + ]); |
|
| 80 | + $table->setPrimaryKey(['auto_id']); |
|
| 81 | + $table->addIndex(['id'], 'id_index'); |
|
| 82 | + $table->addIndex(['timestamp'], 'timestamp_index'); |
|
| 83 | + $table->addIndex(['user'], 'user_index'); |
|
| 84 | + } |
|
| 85 | + return $schema; |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -34,37 +34,37 @@ |
||
| 34 | 34 | use OCP\Migration\SimpleMigrationStep; |
| 35 | 35 | |
| 36 | 36 | class Version21000Date20201223143245 extends SimpleMigrationStep { |
| 37 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 38 | - /** @var ISchemaWrapper $schema */ |
|
| 39 | - $schema = $schemaClosure(); |
|
| 37 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 38 | + /** @var ISchemaWrapper $schema */ |
|
| 39 | + $schema = $schemaClosure(); |
|
| 40 | 40 | |
| 41 | - if ($schema->hasTable('share_external')) { |
|
| 42 | - $table = $schema->getTable('share_external'); |
|
| 43 | - $changed = false; |
|
| 44 | - if (!$table->hasColumn('parent')) { |
|
| 45 | - $table->addColumn('parent', Types::BIGINT, [ |
|
| 46 | - 'notnull' => false, |
|
| 47 | - 'default' => -1, |
|
| 48 | - ]); |
|
| 49 | - $changed = true; |
|
| 50 | - } |
|
| 51 | - if (!$table->hasColumn('share_type')) { |
|
| 52 | - $table->addColumn('share_type', Types::INTEGER, [ |
|
| 53 | - 'notnull' => false, |
|
| 54 | - 'length' => 4, |
|
| 55 | - ]); |
|
| 56 | - $changed = true; |
|
| 57 | - } |
|
| 58 | - if ($table->hasColumn('lastscan')) { |
|
| 59 | - $table->dropColumn('lastscan'); |
|
| 60 | - $changed = true; |
|
| 61 | - } |
|
| 41 | + if ($schema->hasTable('share_external')) { |
|
| 42 | + $table = $schema->getTable('share_external'); |
|
| 43 | + $changed = false; |
|
| 44 | + if (!$table->hasColumn('parent')) { |
|
| 45 | + $table->addColumn('parent', Types::BIGINT, [ |
|
| 46 | + 'notnull' => false, |
|
| 47 | + 'default' => -1, |
|
| 48 | + ]); |
|
| 49 | + $changed = true; |
|
| 50 | + } |
|
| 51 | + if (!$table->hasColumn('share_type')) { |
|
| 52 | + $table->addColumn('share_type', Types::INTEGER, [ |
|
| 53 | + 'notnull' => false, |
|
| 54 | + 'length' => 4, |
|
| 55 | + ]); |
|
| 56 | + $changed = true; |
|
| 57 | + } |
|
| 58 | + if ($table->hasColumn('lastscan')) { |
|
| 59 | + $table->dropColumn('lastscan'); |
|
| 60 | + $changed = true; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - if ($changed) { |
|
| 64 | - return $schema; |
|
| 65 | - } |
|
| 66 | - } |
|
| 63 | + if ($changed) { |
|
| 64 | + return $schema; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return null; |
|
| 69 | - } |
|
| 68 | + return null; |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | $query->select($query->func()->max('cardid')) |
| 75 | 75 | ->from('cards_properties') |
| 76 | 76 | ->where($query->expr()->eq('name', $query->createNamedParameter('X-SOCIALPROFILE'))); |
| 77 | - $maxId = (int)$query->execute()->fetchOne(); |
|
| 77 | + $maxId = (int) $query->execute()->fetchOne(); |
|
| 78 | 78 | |
| 79 | 79 | if ($maxId === 0) { |
| 80 | 80 | return; |
@@ -13,52 +13,52 @@ |
||
| 13 | 13 | |
| 14 | 14 | class BuildSocialSearchIndex implements IRepairStep { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @param IDBConnection $db |
|
| 18 | - * @param IJobList $jobList |
|
| 19 | - * @param IConfig $config |
|
| 20 | - */ |
|
| 21 | - public function __construct( |
|
| 22 | - private IDBConnection $db, |
|
| 23 | - private IJobList $jobList, |
|
| 24 | - private IConfig $config, |
|
| 25 | - ) { |
|
| 26 | - } |
|
| 16 | + /** |
|
| 17 | + * @param IDBConnection $db |
|
| 18 | + * @param IJobList $jobList |
|
| 19 | + * @param IConfig $config |
|
| 20 | + */ |
|
| 21 | + public function __construct( |
|
| 22 | + private IDBConnection $db, |
|
| 23 | + private IJobList $jobList, |
|
| 24 | + private IConfig $config, |
|
| 25 | + ) { |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @return string |
|
| 30 | - */ |
|
| 31 | - public function getName() { |
|
| 32 | - return 'Register building of social profile search index as background job'; |
|
| 33 | - } |
|
| 28 | + /** |
|
| 29 | + * @return string |
|
| 30 | + */ |
|
| 31 | + public function getName() { |
|
| 32 | + return 'Register building of social profile search index as background job'; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param IOutput $output |
|
| 37 | - */ |
|
| 38 | - public function run(IOutput $output) { |
|
| 39 | - // only run once |
|
| 40 | - if ($this->config->getAppValue('dav', 'builtSocialSearchIndex') === 'yes') { |
|
| 41 | - $output->info('Repair step already executed'); |
|
| 42 | - return; |
|
| 43 | - } |
|
| 35 | + /** |
|
| 36 | + * @param IOutput $output |
|
| 37 | + */ |
|
| 38 | + public function run(IOutput $output) { |
|
| 39 | + // only run once |
|
| 40 | + if ($this->config->getAppValue('dav', 'builtSocialSearchIndex') === 'yes') { |
|
| 41 | + $output->info('Repair step already executed'); |
|
| 42 | + return; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - $query = $this->db->getQueryBuilder(); |
|
| 46 | - $query->select($query->func()->max('cardid')) |
|
| 47 | - ->from('cards_properties') |
|
| 48 | - ->where($query->expr()->eq('name', $query->createNamedParameter('X-SOCIALPROFILE'))); |
|
| 49 | - $maxId = (int)$query->execute()->fetchOne(); |
|
| 45 | + $query = $this->db->getQueryBuilder(); |
|
| 46 | + $query->select($query->func()->max('cardid')) |
|
| 47 | + ->from('cards_properties') |
|
| 48 | + ->where($query->expr()->eq('name', $query->createNamedParameter('X-SOCIALPROFILE'))); |
|
| 49 | + $maxId = (int)$query->execute()->fetchOne(); |
|
| 50 | 50 | |
| 51 | - if ($maxId === 0) { |
|
| 52 | - return; |
|
| 53 | - } |
|
| 51 | + if ($maxId === 0) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - $output->info('Add background job'); |
|
| 56 | - $this->jobList->add(BuildSocialSearchIndexBackgroundJob::class, [ |
|
| 57 | - 'offset' => 0, |
|
| 58 | - 'stopAt' => $maxId |
|
| 59 | - ]); |
|
| 55 | + $output->info('Add background job'); |
|
| 56 | + $this->jobList->add(BuildSocialSearchIndexBackgroundJob::class, [ |
|
| 57 | + 'offset' => 0, |
|
| 58 | + 'stopAt' => $maxId |
|
| 59 | + ]); |
|
| 60 | 60 | |
| 61 | - // no need to redo the repair during next upgrade |
|
| 62 | - $this->config->setAppValue('dav', 'builtSocialSearchIndex', 'yes'); |
|
| 63 | - } |
|
| 61 | + // no need to redo the repair during next upgrade |
|
| 62 | + $this->config->setAppValue('dav', 'builtSocialSearchIndex', 'yes'); |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -31,42 +31,42 @@ |
||
| 31 | 31 | use Doctrine\DBAL\Events; |
| 32 | 32 | |
| 33 | 33 | class SQLiteSessionInit implements EventSubscriber { |
| 34 | - /** |
|
| 35 | - * @var bool |
|
| 36 | - */ |
|
| 37 | - private $caseSensitiveLike; |
|
| 34 | + /** |
|
| 35 | + * @var bool |
|
| 36 | + */ |
|
| 37 | + private $caseSensitiveLike; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var string |
|
| 41 | - */ |
|
| 42 | - private $journalMode; |
|
| 39 | + /** |
|
| 40 | + * @var string |
|
| 41 | + */ |
|
| 42 | + private $journalMode; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Configure case sensitive like for each connection |
|
| 46 | - * |
|
| 47 | - * @param bool $caseSensitiveLike |
|
| 48 | - * @param string $journalMode |
|
| 49 | - */ |
|
| 50 | - public function __construct($caseSensitiveLike, $journalMode) { |
|
| 51 | - $this->caseSensitiveLike = $caseSensitiveLike; |
|
| 52 | - $this->journalMode = $journalMode; |
|
| 53 | - } |
|
| 44 | + /** |
|
| 45 | + * Configure case sensitive like for each connection |
|
| 46 | + * |
|
| 47 | + * @param bool $caseSensitiveLike |
|
| 48 | + * @param string $journalMode |
|
| 49 | + */ |
|
| 50 | + public function __construct($caseSensitiveLike, $journalMode) { |
|
| 51 | + $this->caseSensitiveLike = $caseSensitiveLike; |
|
| 52 | + $this->journalMode = $journalMode; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @param ConnectionEventArgs $args |
|
| 57 | - * @return void |
|
| 58 | - */ |
|
| 59 | - public function postConnect(ConnectionEventArgs $args) { |
|
| 60 | - $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; |
|
| 61 | - $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); |
|
| 62 | - $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); |
|
| 63 | - /** @var \Doctrine\DBAL\Driver\PDO\Connection $connection */ |
|
| 64 | - $connection = $args->getConnection()->getWrappedConnection(); |
|
| 65 | - $pdo = $connection->getWrappedConnection(); |
|
| 66 | - $pdo->sqliteCreateFunction('md5', 'md5', 1); |
|
| 67 | - } |
|
| 55 | + /** |
|
| 56 | + * @param ConnectionEventArgs $args |
|
| 57 | + * @return void |
|
| 58 | + */ |
|
| 59 | + public function postConnect(ConnectionEventArgs $args) { |
|
| 60 | + $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; |
|
| 61 | + $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); |
|
| 62 | + $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); |
|
| 63 | + /** @var \Doctrine\DBAL\Driver\PDO\Connection $connection */ |
|
| 64 | + $connection = $args->getConnection()->getWrappedConnection(); |
|
| 65 | + $pdo = $connection->getWrappedConnection(); |
|
| 66 | + $pdo->sqliteCreateFunction('md5', 'md5', 1); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - public function getSubscribedEvents() { |
|
| 70 | - return [Events::postConnect]; |
|
| 71 | - } |
|
| 69 | + public function getSubscribedEvents() { |
|
| 70 | + return [Events::postConnect]; |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -58,8 +58,8 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function postConnect(ConnectionEventArgs $args) { |
| 60 | 60 | $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; |
| 61 | - $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); |
|
| 62 | - $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); |
|
| 61 | + $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = '.$sensitive); |
|
| 62 | + $args->getConnection()->executeUpdate('PRAGMA journal_mode = '.$this->journalMode); |
|
| 63 | 63 | /** @var \Doctrine\DBAL\Driver\PDO\Connection $connection */ |
| 64 | 64 | $connection = $args->getConnection()->getWrappedConnection(); |
| 65 | 65 | $pdo = $connection->getWrappedConnection(); |
@@ -35,21 +35,21 @@ |
||
| 35 | 35 | * Auto-generated migration step: Please modify to your needs! |
| 36 | 36 | */ |
| 37 | 37 | class Version21000Date20210119195004 extends SimpleMigrationStep { |
| 38 | - /** |
|
| 39 | - * @param IOutput $output |
|
| 40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | - * @param array $options |
|
| 42 | - * @return null|ISchemaWrapper |
|
| 43 | - */ |
|
| 44 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | - /** @var ISchemaWrapper $schema */ |
|
| 46 | - $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 | + */ |
|
| 44 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | + /** @var ISchemaWrapper $schema */ |
|
| 46 | + $schema = $schemaClosure(); |
|
| 47 | 47 | |
| 48 | - $table = $schema->getTable('authtoken'); |
|
| 49 | - if ($table->hasIndex('authtoken_version_index')) { |
|
| 50 | - $table->dropIndex('authtoken_version_index'); |
|
| 51 | - } |
|
| 48 | + $table = $schema->getTable('authtoken'); |
|
| 49 | + if ($table->hasIndex('authtoken_version_index')) { |
|
| 50 | + $table->dropIndex('authtoken_version_index'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - return $schema; |
|
| 54 | - } |
|
| 53 | + return $schema; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -31,24 +31,24 @@ |
||
| 31 | 31 | use OCP\Migration\SimpleMigrationStep; |
| 32 | 32 | |
| 33 | 33 | class Version14000Date20180518120534 extends SimpleMigrationStep { |
| 34 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 35 | - /** @var ISchemaWrapper $schema */ |
|
| 36 | - $schema = $schemaClosure(); |
|
| 34 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 35 | + /** @var ISchemaWrapper $schema */ |
|
| 36 | + $schema = $schemaClosure(); |
|
| 37 | 37 | |
| 38 | - $table = $schema->getTable('authtoken'); |
|
| 39 | - $table->addColumn('private_key', 'text', [ |
|
| 40 | - 'notnull' => false, |
|
| 41 | - ]); |
|
| 42 | - $table->addColumn('public_key', 'text', [ |
|
| 43 | - 'notnull' => false, |
|
| 44 | - ]); |
|
| 45 | - $table->addColumn('version', 'smallint', [ |
|
| 46 | - 'notnull' => true, |
|
| 47 | - 'default' => 1, |
|
| 48 | - 'unsigned' => true, |
|
| 49 | - ]); |
|
| 50 | - $table->addIndex(['uid'], 'authtoken_uid_index'); |
|
| 38 | + $table = $schema->getTable('authtoken'); |
|
| 39 | + $table->addColumn('private_key', 'text', [ |
|
| 40 | + 'notnull' => false, |
|
| 41 | + ]); |
|
| 42 | + $table->addColumn('public_key', 'text', [ |
|
| 43 | + 'notnull' => false, |
|
| 44 | + ]); |
|
| 45 | + $table->addColumn('version', 'smallint', [ |
|
| 46 | + 'notnull' => true, |
|
| 47 | + 'default' => 1, |
|
| 48 | + 'unsigned' => true, |
|
| 49 | + ]); |
|
| 50 | + $table->addIndex(['uid'], 'authtoken_uid_index'); |
|
| 51 | 51 | |
| 52 | - return $schema; |
|
| 53 | - } |
|
| 52 | + return $schema; |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -35,37 +35,37 @@ |
||
| 35 | 35 | * @see \OCP\AppFramework\Services\IInitialState |
| 36 | 36 | */ |
| 37 | 37 | interface IInitialStateService { |
| 38 | - /** |
|
| 39 | - * Allows an app to provide its initial state to the template system. |
|
| 40 | - * Use this if you know your initial state sill be used for example if |
|
| 41 | - * you are in the render function of you controller. |
|
| 42 | - * |
|
| 43 | - * @since 16.0.0 |
|
| 44 | - * |
|
| 45 | - * @param string $appName |
|
| 46 | - * @param string $key |
|
| 47 | - * @param bool|int|float|string|array|\JsonSerializable $data |
|
| 48 | - * |
|
| 49 | - * @deprecated 21 Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider |
|
| 50 | - * @see \OCP\AppFramework\Services\IInitialState::provideInitialState() |
|
| 51 | - */ |
|
| 52 | - public function provideInitialState(string $appName, string $key, $data): void; |
|
| 38 | + /** |
|
| 39 | + * Allows an app to provide its initial state to the template system. |
|
| 40 | + * Use this if you know your initial state sill be used for example if |
|
| 41 | + * you are in the render function of you controller. |
|
| 42 | + * |
|
| 43 | + * @since 16.0.0 |
|
| 44 | + * |
|
| 45 | + * @param string $appName |
|
| 46 | + * @param string $key |
|
| 47 | + * @param bool|int|float|string|array|\JsonSerializable $data |
|
| 48 | + * |
|
| 49 | + * @deprecated 21 Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider |
|
| 50 | + * @see \OCP\AppFramework\Services\IInitialState::provideInitialState() |
|
| 51 | + */ |
|
| 52 | + public function provideInitialState(string $appName, string $key, $data): void; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Allows an app to provide its initial state via a lazy method. |
|
| 56 | - * This will call the closure when the template is being generated. |
|
| 57 | - * Use this if your app is injected into pages. Since then the render method |
|
| 58 | - * is not called explicitly. But we do not want to load the state on webdav |
|
| 59 | - * requests for example. |
|
| 60 | - * |
|
| 61 | - * @since 16.0.0 |
|
| 62 | - * |
|
| 63 | - * @param string $appName |
|
| 64 | - * @param string $key |
|
| 65 | - * @param Closure $closure returns a primitive or an object that implements JsonSerializable |
|
| 66 | - * |
|
| 67 | - * @deprecated 21 Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider |
|
| 68 | - * @see \OCP\AppFramework\Services\IInitialState::provideLazyInitialState() |
|
| 69 | - */ |
|
| 70 | - public function provideLazyInitialState(string $appName, string $key, Closure $closure): void; |
|
| 54 | + /** |
|
| 55 | + * Allows an app to provide its initial state via a lazy method. |
|
| 56 | + * This will call the closure when the template is being generated. |
|
| 57 | + * Use this if your app is injected into pages. Since then the render method |
|
| 58 | + * is not called explicitly. But we do not want to load the state on webdav |
|
| 59 | + * requests for example. |
|
| 60 | + * |
|
| 61 | + * @since 16.0.0 |
|
| 62 | + * |
|
| 63 | + * @param string $appName |
|
| 64 | + * @param string $key |
|
| 65 | + * @param Closure $closure returns a primitive or an object that implements JsonSerializable |
|
| 66 | + * |
|
| 67 | + * @deprecated 21 Use OCP\AppFramework\Services\IInitialState or OCP\AppFramework\Services\InitialStateProvider |
|
| 68 | + * @see \OCP\AppFramework\Services\IInitialState::provideLazyInitialState() |
|
| 69 | + */ |
|
| 70 | + public function provideLazyInitialState(string $appName, string $key, Closure $closure): void; |
|
| 71 | 71 | } |