Completed
Push — master ( 738385...cbc573 )
by Blizzz
33:01 queued 15s
created
lib/private/Settings/AuthorizedGroupMapper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 
53 53
 		$result = $qb->select('class')
54 54
 			->from($this->getTableName(), 'auth')
55
-			->where($qb->expr()->in('group_id', array_map(function (IGroup $group) use ($qb) {
55
+			->where($qb->expr()->in('group_id', array_map(function(IGroup $group) use ($qb) {
56 56
 				return $qb->createNamedParameter($group->getGID());
57 57
 			}, $groups), IQueryBuilder::PARAM_STR))
58 58
 			->executeQuery();
Please login to merge, or discard this patch.
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -36,93 +36,93 @@
 block discarded – undo
36 36
  * @template-extends QBMapper<AuthorizedGroup>
37 37
  */
38 38
 class AuthorizedGroupMapper extends QBMapper {
39
-	public function __construct(IDBConnection $db) {
40
-		parent::__construct($db, 'authorized_groups', AuthorizedGroup::class);
41
-	}
39
+    public function __construct(IDBConnection $db) {
40
+        parent::__construct($db, 'authorized_groups', AuthorizedGroup::class);
41
+    }
42 42
 
43
-	/**
44
-	 * @throws Exception
45
-	 */
46
-	public function findAllClassesForUser(IUser $user): array {
47
-		$qb = $this->db->getQueryBuilder();
43
+    /**
44
+     * @throws Exception
45
+     */
46
+    public function findAllClassesForUser(IUser $user): array {
47
+        $qb = $this->db->getQueryBuilder();
48 48
 
49
-		/** @var IGroupManager $groupManager */
50
-		$groupManager = \OC::$server->get(IGroupManager::class);
51
-		$groups = $groupManager->getUserGroups($user);
52
-		if (count($groups) === 0) {
53
-			return [];
54
-		}
49
+        /** @var IGroupManager $groupManager */
50
+        $groupManager = \OC::$server->get(IGroupManager::class);
51
+        $groups = $groupManager->getUserGroups($user);
52
+        if (count($groups) === 0) {
53
+            return [];
54
+        }
55 55
 
56
-		$result = $qb->select('class')
57
-			->from($this->getTableName(), 'auth')
58
-			->where($qb->expr()->in('group_id', array_map(function (IGroup $group) use ($qb) {
59
-				return $qb->createNamedParameter($group->getGID());
60
-			}, $groups), IQueryBuilder::PARAM_STR))
61
-			->executeQuery();
56
+        $result = $qb->select('class')
57
+            ->from($this->getTableName(), 'auth')
58
+            ->where($qb->expr()->in('group_id', array_map(function (IGroup $group) use ($qb) {
59
+                return $qb->createNamedParameter($group->getGID());
60
+            }, $groups), IQueryBuilder::PARAM_STR))
61
+            ->executeQuery();
62 62
 
63
-		$classes = [];
64
-		while ($row = $result->fetch()) {
65
-			$classes[] = $row['class'];
66
-		}
67
-		$result->closeCursor();
68
-		return $classes;
69
-	}
63
+        $classes = [];
64
+        while ($row = $result->fetch()) {
65
+            $classes[] = $row['class'];
66
+        }
67
+        $result->closeCursor();
68
+        return $classes;
69
+    }
70 70
 
71
-	/**
72
-	 * @throws \OCP\AppFramework\Db\DoesNotExistException
73
-	 * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
74
-	 * @throws \OCP\DB\Exception
75
-	 */
76
-	public function find(int $id): AuthorizedGroup {
77
-		$queryBuilder = $this->db->getQueryBuilder();
78
-		$queryBuilder->select('*')
79
-			->from($this->getTableName())
80
-			->where($queryBuilder->expr()->eq('id', $queryBuilder->createNamedParameter($id)));
81
-		/** @var AuthorizedGroup $authorizedGroup */
82
-		$authorizedGroup = $this->findEntity($queryBuilder);
83
-		return $authorizedGroup;
84
-	}
71
+    /**
72
+     * @throws \OCP\AppFramework\Db\DoesNotExistException
73
+     * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
74
+     * @throws \OCP\DB\Exception
75
+     */
76
+    public function find(int $id): AuthorizedGroup {
77
+        $queryBuilder = $this->db->getQueryBuilder();
78
+        $queryBuilder->select('*')
79
+            ->from($this->getTableName())
80
+            ->where($queryBuilder->expr()->eq('id', $queryBuilder->createNamedParameter($id)));
81
+        /** @var AuthorizedGroup $authorizedGroup */
82
+        $authorizedGroup = $this->findEntity($queryBuilder);
83
+        return $authorizedGroup;
84
+    }
85 85
 
86
-	/**
87
-	 * Get all the authorizations stored in the database.
88
-	 *
89
-	 * @return AuthorizedGroup[]
90
-	 * @throws \OCP\DB\Exception
91
-	 */
92
-	public function findAll(): array {
93
-		$qb = $this->db->getQueryBuilder();
94
-		$qb->select('*')->from($this->getTableName());
95
-		return $this->findEntities($qb);
96
-	}
86
+    /**
87
+     * Get all the authorizations stored in the database.
88
+     *
89
+     * @return AuthorizedGroup[]
90
+     * @throws \OCP\DB\Exception
91
+     */
92
+    public function findAll(): array {
93
+        $qb = $this->db->getQueryBuilder();
94
+        $qb->select('*')->from($this->getTableName());
95
+        return $this->findEntities($qb);
96
+    }
97 97
 
98
-	public function findByGroupIdAndClass(string $groupId, string $class) {
99
-		$qb = $this->db->getQueryBuilder();
100
-		$qb->select('*')
101
-			->from($this->getTableName())
102
-			->where($qb->expr()->eq('group_id', $qb->createNamedParameter($groupId)))
103
-			->andWhere($qb->expr()->eq('class', $qb->createNamedParameter($class)));
104
-		return $this->findEntity($qb);
105
-	}
98
+    public function findByGroupIdAndClass(string $groupId, string $class) {
99
+        $qb = $this->db->getQueryBuilder();
100
+        $qb->select('*')
101
+            ->from($this->getTableName())
102
+            ->where($qb->expr()->eq('group_id', $qb->createNamedParameter($groupId)))
103
+            ->andWhere($qb->expr()->eq('class', $qb->createNamedParameter($class)));
104
+        return $this->findEntity($qb);
105
+    }
106 106
 
107
-	/**
108
-	 * @return Entity[]
109
-	 * @throws \OCP\DB\Exception
110
-	 */
111
-	public function findExistingGroupsForClass(string $class): array {
112
-		$qb = $this->db->getQueryBuilder();
113
-		$qb->select('*')
114
-			->from($this->getTableName())
115
-			->where($qb->expr()->eq('class', $qb->createNamedParameter($class)));
116
-		return $this->findEntities($qb);
117
-	}
107
+    /**
108
+     * @return Entity[]
109
+     * @throws \OCP\DB\Exception
110
+     */
111
+    public function findExistingGroupsForClass(string $class): array {
112
+        $qb = $this->db->getQueryBuilder();
113
+        $qb->select('*')
114
+            ->from($this->getTableName())
115
+            ->where($qb->expr()->eq('class', $qb->createNamedParameter($class)));
116
+        return $this->findEntities($qb);
117
+    }
118 118
 
119
-	/**
120
-	 * @throws Exception
121
-	 */
122
-	public function removeGroup(string $gid) {
123
-		$qb = $this->db->getQueryBuilder();
124
-		$qb->delete($this->getTableName())
125
-			->where($qb->expr()->eq('group_id', $qb->createNamedParameter($gid)))
126
-			->executeStatement();
127
-	}
119
+    /**
120
+     * @throws Exception
121
+     */
122
+    public function removeGroup(string $gid) {
123
+        $qb = $this->db->getQueryBuilder();
124
+        $qb->delete($this->getTableName())
125
+            ->where($qb->expr()->eq('group_id', $qb->createNamedParameter($gid)))
126
+            ->executeStatement();
127
+    }
128 128
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/ActionFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,6 +44,6 @@
 block discarded – undo
44 44
 	 * {@inheritDoc}
45 45
 	 */
46 46
 	public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction {
47
-		return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId);
47
+		return $this->newLinkAction($icon, $name, 'mailto:'.$email, $appId);
48 48
 	}
49 49
 }
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -27,22 +27,22 @@
 block discarded – undo
27 27
 use OCP\Contacts\ContactsMenu\ILinkAction;
28 28
 
29 29
 class ActionFactory implements IActionFactory {
30
-	/**
31
-	 * {@inheritDoc}
32
-	 */
33
-	public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction {
34
-		$action = new LinkAction();
35
-		$action->setName($name);
36
-		$action->setIcon($icon);
37
-		$action->setHref($href);
38
-		$action->setAppId($appId);
39
-		return $action;
40
-	}
30
+    /**
31
+     * {@inheritDoc}
32
+     */
33
+    public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction {
34
+        $action = new LinkAction();
35
+        $action->setName($name);
36
+        $action->setIcon($icon);
37
+        $action->setHref($href);
38
+        $action->setAppId($appId);
39
+        return $action;
40
+    }
41 41
 
42
-	/**
43
-	 * {@inheritDoc}
44
-	 */
45
-	public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction {
46
-		return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId);
47
-	}
42
+    /**
43
+     * {@inheritDoc}
44
+     */
45
+    public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction {
46
+        return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId);
47
+    }
48 48
 }
Please login to merge, or discard this patch.
lib/private/Preview/Storage/Root.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -33,60 +33,60 @@
 block discarded – undo
33 33
 use OCP\Files\SimpleFS\ISimpleFolder;
34 34
 
35 35
 class Root extends AppData {
36
-	private $isMultibucketPreviewDistributionEnabled = false;
37
-	public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) {
38
-		parent::__construct($rootFolder, $systemConfig, 'preview');
36
+    private $isMultibucketPreviewDistributionEnabled = false;
37
+    public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) {
38
+        parent::__construct($rootFolder, $systemConfig, 'preview');
39 39
 
40
-		$this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true;
41
-	}
40
+        $this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true;
41
+    }
42 42
 
43 43
 
44
-	public function getFolder(string $name): ISimpleFolder {
45
-		$internalFolder = self::getInternalFolder($name);
44
+    public function getFolder(string $name): ISimpleFolder {
45
+        $internalFolder = self::getInternalFolder($name);
46 46
 
47
-		try {
48
-			return parent::getFolder($internalFolder);
49
-		} catch (NotFoundException $e) {
50
-			/*
47
+        try {
48
+            return parent::getFolder($internalFolder);
49
+        } catch (NotFoundException $e) {
50
+            /*
51 51
 			 * The new folder structure is not found.
52 52
 			 * Lets try the old one
53 53
 			 */
54
-		}
54
+        }
55 55
 
56
-		try {
57
-			return parent::getFolder($name);
58
-		} catch (NotFoundException $e) {
59
-			/*
56
+        try {
57
+            return parent::getFolder($name);
58
+        } catch (NotFoundException $e) {
59
+            /*
60 60
 			 * The old folder structure is not found.
61 61
 			 * Lets try the multibucket fallback if available
62 62
 			 */
63
-			if ($this->isMultibucketPreviewDistributionEnabled) {
64
-				return parent::getFolder('old-multibucket/' . $internalFolder);
65
-			}
63
+            if ($this->isMultibucketPreviewDistributionEnabled) {
64
+                return parent::getFolder('old-multibucket/' . $internalFolder);
65
+            }
66 66
 
67
-			// when there is no further fallback just throw the exception
68
-			throw $e;
69
-		}
70
-	}
67
+            // when there is no further fallback just throw the exception
68
+            throw $e;
69
+        }
70
+    }
71 71
 
72
-	public function newFolder(string $name): ISimpleFolder {
73
-		$internalFolder = self::getInternalFolder($name);
74
-		return parent::newFolder($internalFolder);
75
-	}
72
+    public function newFolder(string $name): ISimpleFolder {
73
+        $internalFolder = self::getInternalFolder($name);
74
+        return parent::newFolder($internalFolder);
75
+    }
76 76
 
77
-	/*
77
+    /*
78 78
 	 * Do not allow directory listing on this special root
79 79
 	 * since it gets to big and time consuming
80 80
 	 */
81
-	public function getDirectoryListing(): array {
82
-		return [];
83
-	}
81
+    public function getDirectoryListing(): array {
82
+        return [];
83
+    }
84 84
 
85
-	public static function getInternalFolder(string $name): string {
86
-		return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name;
87
-	}
85
+    public static function getInternalFolder(string $name): string {
86
+        return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name;
87
+    }
88 88
 
89
-	public function getStorageId(): int {
90
-		return $this->getAppDataRootFolder()->getStorage()->getCache()->getNumericStorageId();
91
-	}
89
+    public function getStorageId(): int {
90
+        return $this->getAppDataRootFolder()->getStorage()->getCache()->getNumericStorageId();
91
+    }
92 92
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			 * Lets try the multibucket fallback if available
62 62
 			 */
63 63
 			if ($this->isMultibucketPreviewDistributionEnabled) {
64
-				return parent::getFolder('old-multibucket/' . $internalFolder);
64
+				return parent::getFolder('old-multibucket/'.$internalFolder);
65 65
 			}
66 66
 
67 67
 			// when there is no further fallback just throw the exception
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	public static function getInternalFolder(string $name): string {
86
-		return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name;
86
+		return implode('/', str_split(substr(md5($name), 0, 7))).'/'.$name;
87 87
 	}
88 88
 
89 89
 	public function getStorageId(): int {
Please login to merge, or discard this patch.
core/Command/User/Info.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 		$data = [
77 77
 			'user_id' => $user->getUID(),
78 78
 			'display_name' => $user->getDisplayName(),
79
-			'email' => (string)$user->getSystemEMailAddress(),
79
+			'email' => (string) $user->getSystemEMailAddress(),
80 80
 			'cloud_id' => $user->getCloudId(),
81 81
 			'enabled' => $user->isEnabled(),
82 82
 			'groups' => $groups,
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -17,95 +17,95 @@
 block discarded – undo
17 17
 use Symfony\Component\Console\Output\OutputInterface;
18 18
 
19 19
 class Info extends Base {
20
-	public function __construct(
21
-		protected IUserManager $userManager,
22
-		protected IGroupManager $groupManager,
23
-	) {
24
-		parent::__construct();
25
-	}
20
+    public function __construct(
21
+        protected IUserManager $userManager,
22
+        protected IGroupManager $groupManager,
23
+    ) {
24
+        parent::__construct();
25
+    }
26 26
 
27
-	protected function configure() {
28
-		$this
29
-			->setName('user:info')
30
-			->setDescription('show user info')
31
-			->addArgument(
32
-				'user',
33
-				InputArgument::REQUIRED,
34
-				'user to show'
35
-			)->addOption(
36
-				'output',
37
-				null,
38
-				InputOption::VALUE_OPTIONAL,
39
-				'Output format (plain, json or json_pretty, default is plain)',
40
-				$this->defaultOutputFormat
41
-			);
42
-	}
27
+    protected function configure() {
28
+        $this
29
+            ->setName('user:info')
30
+            ->setDescription('show user info')
31
+            ->addArgument(
32
+                'user',
33
+                InputArgument::REQUIRED,
34
+                'user to show'
35
+            )->addOption(
36
+                'output',
37
+                null,
38
+                InputOption::VALUE_OPTIONAL,
39
+                'Output format (plain, json or json_pretty, default is plain)',
40
+                $this->defaultOutputFormat
41
+            );
42
+    }
43 43
 
44
-	protected function execute(InputInterface $input, OutputInterface $output): int {
45
-		$user = $this->userManager->get($input->getArgument('user'));
46
-		if (is_null($user)) {
47
-			$output->writeln('<error>user not found</error>');
48
-			return 1;
49
-		}
50
-		$groups = $this->groupManager->getUserGroupIds($user);
51
-		$data = [
52
-			'user_id' => $user->getUID(),
53
-			'display_name' => $user->getDisplayName(),
54
-			'email' => (string)$user->getSystemEMailAddress(),
55
-			'cloud_id' => $user->getCloudId(),
56
-			'enabled' => $user->isEnabled(),
57
-			'groups' => $groups,
58
-			'quota' => $user->getQuota(),
59
-			'storage' => $this->getStorageInfo($user),
60
-			'first_seen' => $this->formatLoginDate($user->getFirstLogin()),
61
-			'last_seen' => $this->formatLoginDate($user->getLastLogin()),
62
-			'user_directory' => $user->getHome(),
63
-			'backend' => $user->getBackendClassName()
64
-		];
65
-		$this->writeArrayInOutputFormat($input, $output, $data);
66
-		return 0;
67
-	}
44
+    protected function execute(InputInterface $input, OutputInterface $output): int {
45
+        $user = $this->userManager->get($input->getArgument('user'));
46
+        if (is_null($user)) {
47
+            $output->writeln('<error>user not found</error>');
48
+            return 1;
49
+        }
50
+        $groups = $this->groupManager->getUserGroupIds($user);
51
+        $data = [
52
+            'user_id' => $user->getUID(),
53
+            'display_name' => $user->getDisplayName(),
54
+            'email' => (string)$user->getSystemEMailAddress(),
55
+            'cloud_id' => $user->getCloudId(),
56
+            'enabled' => $user->isEnabled(),
57
+            'groups' => $groups,
58
+            'quota' => $user->getQuota(),
59
+            'storage' => $this->getStorageInfo($user),
60
+            'first_seen' => $this->formatLoginDate($user->getFirstLogin()),
61
+            'last_seen' => $this->formatLoginDate($user->getLastLogin()),
62
+            'user_directory' => $user->getHome(),
63
+            'backend' => $user->getBackendClassName()
64
+        ];
65
+        $this->writeArrayInOutputFormat($input, $output, $data);
66
+        return 0;
67
+    }
68 68
 
69
-	private function formatLoginDate(int $timestamp): string {
70
-		if ($timestamp < 0) {
71
-			return 'unknown';
72
-		} elseif ($timestamp === 0) {
73
-			return 'never';
74
-		} else {
75
-			return date(\DateTimeInterface::ATOM, $timestamp); // ISO-8601
76
-		}
77
-	}
69
+    private function formatLoginDate(int $timestamp): string {
70
+        if ($timestamp < 0) {
71
+            return 'unknown';
72
+        } elseif ($timestamp === 0) {
73
+            return 'never';
74
+        } else {
75
+            return date(\DateTimeInterface::ATOM, $timestamp); // ISO-8601
76
+        }
77
+    }
78 78
 
79
-	/**
80
-	 * @param IUser $user
81
-	 * @return array
82
-	 */
83
-	protected function getStorageInfo(IUser $user): array {
84
-		\OC_Util::tearDownFS();
85
-		\OC_Util::setupFS($user->getUID());
86
-		try {
87
-			$storage = \OC_Helper::getStorageInfo('/');
88
-		} catch (NotFoundException $e) {
89
-			return [];
90
-		}
91
-		return [
92
-			'free' => $storage['free'],
93
-			'used' => $storage['used'],
94
-			'total' => $storage['total'],
95
-			'relative' => $storage['relative'],
96
-			'quota' => $storage['quota'],
97
-		];
98
-	}
79
+    /**
80
+     * @param IUser $user
81
+     * @return array
82
+     */
83
+    protected function getStorageInfo(IUser $user): array {
84
+        \OC_Util::tearDownFS();
85
+        \OC_Util::setupFS($user->getUID());
86
+        try {
87
+            $storage = \OC_Helper::getStorageInfo('/');
88
+        } catch (NotFoundException $e) {
89
+            return [];
90
+        }
91
+        return [
92
+            'free' => $storage['free'],
93
+            'used' => $storage['used'],
94
+            'total' => $storage['total'],
95
+            'relative' => $storage['relative'],
96
+            'quota' => $storage['quota'],
97
+        ];
98
+    }
99 99
 
100
-	/**
101
-	 * @param string $argumentName
102
-	 * @param CompletionContext $context
103
-	 * @return string[]
104
-	 */
105
-	public function completeArgumentValues($argumentName, CompletionContext $context) {
106
-		if ($argumentName === 'user') {
107
-			return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
108
-		}
109
-		return [];
110
-	}
100
+    /**
101
+     * @param string $argumentName
102
+     * @param CompletionContext $context
103
+     * @return string[]
104
+     */
105
+    public function completeArgumentValues($argumentName, CompletionContext $context) {
106
+        if ($argumentName === 'user') {
107
+            return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord()));
108
+        }
109
+        return [];
110
+    }
111 111
 }
Please login to merge, or discard this patch.
core/Migrations/Version23000Date20210930122352.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 				'notnull' => true,
61 61
 			]);
62 62
 			$table->setPrimaryKey(['id']);
63
-			$table->addUniqueIndex(['user_id'], self::TABLE_NAME . '_user_id_idx');
63
+			$table->addUniqueIndex(['user_id'], self::TABLE_NAME.'_user_id_idx');
64 64
 			return $schema;
65 65
 		}
66 66
 
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,37 +16,37 @@
 block discarded – undo
16 16
 use OCP\Migration\SimpleMigrationStep;
17 17
 
18 18
 class Version23000Date20210930122352 extends SimpleMigrationStep {
19
-	private const TABLE_NAME = 'profile_config';
20
-
21
-	/**
22
-	 * @param IOutput $output
23
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
24
-	 * @param array $options
25
-	 * @return null|ISchemaWrapper
26
-	 */
27
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
28
-		/** @var ISchemaWrapper $schema */
29
-		$schema = $schemaClosure();
30
-
31
-		$hasTable = $schema->hasTable(self::TABLE_NAME);
32
-		if (!$hasTable) {
33
-			$table = $schema->createTable(self::TABLE_NAME);
34
-			$table->addColumn('id', Types::BIGINT, [
35
-				'autoincrement' => true,
36
-				'notnull' => true,
37
-			]);
38
-			$table->addColumn('user_id', Types::STRING, [
39
-				'notnull' => true,
40
-				'length' => 64,
41
-			]);
42
-			$table->addColumn('config', Types::TEXT, [
43
-				'notnull' => true,
44
-			]);
45
-			$table->setPrimaryKey(['id']);
46
-			$table->addUniqueIndex(['user_id'], self::TABLE_NAME . '_user_id_idx');
47
-			return $schema;
48
-		}
49
-
50
-		return null;
51
-	}
19
+    private const TABLE_NAME = 'profile_config';
20
+
21
+    /**
22
+     * @param IOutput $output
23
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
24
+     * @param array $options
25
+     * @return null|ISchemaWrapper
26
+     */
27
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
28
+        /** @var ISchemaWrapper $schema */
29
+        $schema = $schemaClosure();
30
+
31
+        $hasTable = $schema->hasTable(self::TABLE_NAME);
32
+        if (!$hasTable) {
33
+            $table = $schema->createTable(self::TABLE_NAME);
34
+            $table->addColumn('id', Types::BIGINT, [
35
+                'autoincrement' => true,
36
+                'notnull' => true,
37
+            ]);
38
+            $table->addColumn('user_id', Types::STRING, [
39
+                'notnull' => true,
40
+                'length' => 64,
41
+            ]);
42
+            $table->addColumn('config', Types::TEXT, [
43
+                'notnull' => true,
44
+            ]);
45
+            $table->setPrimaryKey(['id']);
46
+            $table->addUniqueIndex(['user_id'], self::TABLE_NAME . '_user_id_idx');
47
+            return $schema;
48
+        }
49
+
50
+        return null;
51
+    }
52 52
 }
Please login to merge, or discard this patch.
core/Migrations/Version23000Date20211203110726.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@
 block discarded – undo
32 32
 use OCP\Migration\SimpleMigrationStep;
33 33
 
34 34
 class Version23000Date20211203110726 extends SimpleMigrationStep {
35
-	private const TABLE_NAME = 'profile_config';
35
+    private const TABLE_NAME = 'profile_config';
36 36
 
37
-	/**
38
-	 * @param IOutput $output
39
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
40
-	 * @param array $options
41
-	 * @return null|ISchemaWrapper
42
-	 */
43
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
44
-		/** @var ISchemaWrapper $schema */
45
-		$schema = $schemaClosure();
37
+    /**
38
+     * @param IOutput $output
39
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
40
+     * @param array $options
41
+     * @return null|ISchemaWrapper
42
+     */
43
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
44
+        /** @var ISchemaWrapper $schema */
45
+        $schema = $schemaClosure();
46 46
 
47
-		$table = $schema->getTable(self::TABLE_NAME);
48
-		if ($table->hasIndex('user_id')) {
49
-			$table->renameIndex('user_id', self::TABLE_NAME . '_user_id_idx');
50
-			return $schema;
51
-		}
52
-		return null;
53
-	}
47
+        $table = $schema->getTable(self::TABLE_NAME);
48
+        if ($table->hasIndex('user_id')) {
49
+            $table->renameIndex('user_id', self::TABLE_NAME . '_user_id_idx');
50
+            return $schema;
51
+        }
52
+        return null;
53
+    }
54 54
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
 		$table = $schema->getTable(self::TABLE_NAME);
48 48
 		if ($table->hasIndex('user_id')) {
49
-			$table->renameIndex('user_id', self::TABLE_NAME . '_user_id_idx');
49
+			$table->renameIndex('user_id', self::TABLE_NAME.'_user_id_idx');
50 50
 			return $schema;
51 51
 		}
52 52
 		return null;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Auth/PublicPrincipalPlugin.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
  * Defines the public facing principal option
32 32
  */
33 33
 class PublicPrincipalPlugin extends Plugin {
34
-	public function getCurrentPrincipal(): ?string {
35
-		return 'principals/system/public';
36
-	}
34
+    public function getCurrentPrincipal(): ?string {
35
+        return 'principals/system/public';
36
+    }
37 37
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Auth/CustomPrincipalPlugin.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
  * Set a custom principal uri to allow public requests to its calendar
33 33
  */
34 34
 class CustomPrincipalPlugin extends Plugin {
35
-	public function setCurrentPrincipal(?string $currentPrincipal): void {
36
-		$this->currentPrincipal = $currentPrincipal;
37
-	}
35
+    public function setCurrentPrincipal(?string $currentPrincipal): void {
36
+        $this->currentPrincipal = $currentPrincipal;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
apps/dav/lib/Upload/AssemblyStream.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 		$this->loadContext('assembly');
74 74
 
75 75
 		$nodes = $this->nodes;
76
-		usort($nodes, function (IFile $a, IFile $b) {
76
+		usort($nodes, function(IFile $a, IFile $b) {
77 77
 			return strnatcmp($a->getName(), $b->getName());
78 78
 		});
79 79
 		$this->nodes = array_values($nodes);
80
-		$this->size = array_reduce($this->nodes, function ($size, IFile $file) {
80
+		$this->size = array_reduce($this->nodes, function($size, IFile $file) {
81 81
 			return $size + $file->getSize();
82 82
 		}, 0);
83 83
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				fclose($this->currentStream);
157 157
 				$currentNodeSize = $this->nodes[$this->currentNode]->getSize();
158 158
 				if ($this->currentNodeRead < $currentNodeSize) {
159
-					throw new \Exception('Stream from assembly node shorter than expected, got ' . $this->currentNodeRead . ' bytes, expected ' . $currentNodeSize);
159
+					throw new \Exception('Stream from assembly node shorter than expected, got '.$this->currentNodeRead.' bytes, expected '.$currentNodeSize);
160 160
 				}
161 161
 				$this->currentNode++;
162 162
 				$this->currentNodeRead = 0;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		if (isset($context[$name])) {
254 254
 			$context = $context[$name];
255 255
 		} else {
256
-			throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set');
256
+			throw new \BadMethodCallException('Invalid context, "'.$name.'" options not set');
257 257
 		}
258 258
 		if (isset($context['nodes']) and is_array($context['nodes'])) {
259 259
 			$this->nodes = $context['nodes'];
Please login to merge, or discard this patch.
Indentation   +266 added lines, -266 removed lines patch added patch discarded remove patch
@@ -20,270 +20,270 @@
 block discarded – undo
20 20
  */
21 21
 class AssemblyStream implements \Icewind\Streams\File {
22 22
 
23
-	/** @var resource */
24
-	private $context;
25
-
26
-	/** @var IFile[] */
27
-	private $nodes;
28
-
29
-	/** @var int */
30
-	private $pos = 0;
31
-
32
-	/** @var int */
33
-	private $size = 0;
34
-
35
-	/** @var resource */
36
-	private $currentStream = null;
37
-
38
-	/** @var int */
39
-	private $currentNode = 0;
40
-
41
-	/** @var int */
42
-	private $currentNodeRead = 0;
43
-
44
-	/**
45
-	 * @param string $path
46
-	 * @param string $mode
47
-	 * @param int $options
48
-	 * @param string &$opened_path
49
-	 * @return bool
50
-	 */
51
-	public function stream_open($path, $mode, $options, &$opened_path) {
52
-		$this->loadContext('assembly');
53
-
54
-		$nodes = $this->nodes;
55
-		usort($nodes, function (IFile $a, IFile $b) {
56
-			return strnatcmp($a->getName(), $b->getName());
57
-		});
58
-		$this->nodes = array_values($nodes);
59
-		$this->size = array_reduce($this->nodes, function ($size, IFile $file) {
60
-			return $size + $file->getSize();
61
-		}, 0);
62
-
63
-		return true;
64
-	}
65
-
66
-	/**
67
-	 * @param int $offset
68
-	 * @param int $whence
69
-	 * @return bool
70
-	 */
71
-	public function stream_seek($offset, $whence = SEEK_SET) {
72
-		if ($whence === SEEK_CUR) {
73
-			$offset = $this->stream_tell() + $offset;
74
-		} elseif ($whence === SEEK_END) {
75
-			$offset = $this->size + $offset;
76
-		}
77
-
78
-		if ($offset === $this->pos) {
79
-			return true;
80
-		}
81
-
82
-		if ($offset > $this->size) {
83
-			return false;
84
-		}
85
-
86
-		$nodeIndex = 0;
87
-		$nodeStart = 0;
88
-		while (true) {
89
-			if (!isset($this->nodes[$nodeIndex + 1])) {
90
-				break;
91
-			}
92
-			$node = $this->nodes[$nodeIndex];
93
-			if ($nodeStart + $node->getSize() > $offset) {
94
-				break;
95
-			}
96
-			$nodeIndex++;
97
-			$nodeStart += $node->getSize();
98
-		}
99
-
100
-		$stream = $this->getStream($this->nodes[$nodeIndex]);
101
-		$nodeOffset = $offset - $nodeStart;
102
-		if ($nodeOffset > 0 && fseek($stream, $nodeOffset) === -1) {
103
-			return false;
104
-		}
105
-		$this->currentNode = $nodeIndex;
106
-		$this->currentNodeRead = $nodeOffset;
107
-		$this->currentStream = $stream;
108
-		$this->pos = $offset;
109
-
110
-		return true;
111
-	}
112
-
113
-	/**
114
-	 * @return int
115
-	 */
116
-	public function stream_tell() {
117
-		return $this->pos;
118
-	}
119
-
120
-	/**
121
-	 * @param int $count
122
-	 * @return string
123
-	 */
124
-	public function stream_read($count) {
125
-		if (is_null($this->currentStream)) {
126
-			if ($this->currentNode < count($this->nodes)) {
127
-				$this->currentStream = $this->getStream($this->nodes[$this->currentNode]);
128
-			} else {
129
-				return '';
130
-			}
131
-		}
132
-
133
-		$collectedData = '';
134
-		// read data until we either got all the data requested or there is no more stream left
135
-		while ($count > 0 && !is_null($this->currentStream)) {
136
-			$data = fread($this->currentStream, $count);
137
-			$read = strlen($data);
138
-
139
-			$count -= $read;
140
-			$collectedData .= $data;
141
-			$this->currentNodeRead += $read;
142
-
143
-			if (feof($this->currentStream)) {
144
-				fclose($this->currentStream);
145
-				$currentNodeSize = $this->nodes[$this->currentNode]->getSize();
146
-				if ($this->currentNodeRead < $currentNodeSize) {
147
-					throw new \Exception('Stream from assembly node shorter than expected, got ' . $this->currentNodeRead . ' bytes, expected ' . $currentNodeSize);
148
-				}
149
-				$this->currentNode++;
150
-				$this->currentNodeRead = 0;
151
-				if ($this->currentNode < count($this->nodes)) {
152
-					$this->currentStream = $this->getStream($this->nodes[$this->currentNode]);
153
-				} else {
154
-					$this->currentStream = null;
155
-				}
156
-			}
157
-		}
158
-
159
-		// update position
160
-		$this->pos += strlen($collectedData);
161
-		return $collectedData;
162
-	}
163
-
164
-	/**
165
-	 * @param string $data
166
-	 * @return int
167
-	 */
168
-	public function stream_write($data) {
169
-		return false;
170
-	}
171
-
172
-	/**
173
-	 * @param int $option
174
-	 * @param int $arg1
175
-	 * @param int $arg2
176
-	 * @return bool
177
-	 */
178
-	public function stream_set_option($option, $arg1, $arg2) {
179
-		return false;
180
-	}
181
-
182
-	/**
183
-	 * @param int $size
184
-	 * @return bool
185
-	 */
186
-	public function stream_truncate($size) {
187
-		return false;
188
-	}
189
-
190
-	/**
191
-	 * @return array
192
-	 */
193
-	public function stream_stat() {
194
-		return [
195
-			'size' => $this->size,
196
-		];
197
-	}
198
-
199
-	/**
200
-	 * @param int $operation
201
-	 * @return bool
202
-	 */
203
-	public function stream_lock($operation) {
204
-		return false;
205
-	}
206
-
207
-	/**
208
-	 * @return bool
209
-	 */
210
-	public function stream_flush() {
211
-		return false;
212
-	}
213
-
214
-	/**
215
-	 * @return bool
216
-	 */
217
-	public function stream_eof() {
218
-		return $this->pos >= $this->size || ($this->currentNode >= count($this->nodes) && $this->currentNode === null);
219
-	}
220
-
221
-	/**
222
-	 * @return bool
223
-	 */
224
-	public function stream_close() {
225
-		return true;
226
-	}
227
-
228
-
229
-	/**
230
-	 * Load the source from the stream context and return the context options
231
-	 *
232
-	 * @param string $name
233
-	 * @return array
234
-	 * @throws \BadMethodCallException
235
-	 */
236
-	protected function loadContext($name) {
237
-		$context = stream_context_get_options($this->context);
238
-		if (isset($context[$name])) {
239
-			$context = $context[$name];
240
-		} else {
241
-			throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set');
242
-		}
243
-		if (isset($context['nodes']) and is_array($context['nodes'])) {
244
-			$this->nodes = $context['nodes'];
245
-		} else {
246
-			throw new \BadMethodCallException('Invalid context, nodes not set');
247
-		}
248
-		return $context;
249
-	}
250
-
251
-	/**
252
-	 * @param IFile[] $nodes
253
-	 * @return resource
254
-	 *
255
-	 * @throws \BadMethodCallException
256
-	 */
257
-	public static function wrap(array $nodes) {
258
-		$context = stream_context_create([
259
-			'assembly' => [
260
-				'nodes' => $nodes
261
-			]
262
-		]);
263
-		stream_wrapper_register('assembly', self::class);
264
-		try {
265
-			$wrapped = fopen('assembly://', 'r', false, $context);
266
-		} catch (\BadMethodCallException $e) {
267
-			stream_wrapper_unregister('assembly');
268
-			throw $e;
269
-		}
270
-		stream_wrapper_unregister('assembly');
271
-		return $wrapped;
272
-	}
273
-
274
-	/**
275
-	 * @param IFile $node
276
-	 * @return resource
277
-	 */
278
-	private function getStream(IFile $node) {
279
-		$data = $node->get();
280
-		if (is_resource($data)) {
281
-			return $data;
282
-		} else {
283
-			$tmp = fopen('php://temp', 'w+');
284
-			fwrite($tmp, $data);
285
-			rewind($tmp);
286
-			return $tmp;
287
-		}
288
-	}
23
+    /** @var resource */
24
+    private $context;
25
+
26
+    /** @var IFile[] */
27
+    private $nodes;
28
+
29
+    /** @var int */
30
+    private $pos = 0;
31
+
32
+    /** @var int */
33
+    private $size = 0;
34
+
35
+    /** @var resource */
36
+    private $currentStream = null;
37
+
38
+    /** @var int */
39
+    private $currentNode = 0;
40
+
41
+    /** @var int */
42
+    private $currentNodeRead = 0;
43
+
44
+    /**
45
+     * @param string $path
46
+     * @param string $mode
47
+     * @param int $options
48
+     * @param string &$opened_path
49
+     * @return bool
50
+     */
51
+    public function stream_open($path, $mode, $options, &$opened_path) {
52
+        $this->loadContext('assembly');
53
+
54
+        $nodes = $this->nodes;
55
+        usort($nodes, function (IFile $a, IFile $b) {
56
+            return strnatcmp($a->getName(), $b->getName());
57
+        });
58
+        $this->nodes = array_values($nodes);
59
+        $this->size = array_reduce($this->nodes, function ($size, IFile $file) {
60
+            return $size + $file->getSize();
61
+        }, 0);
62
+
63
+        return true;
64
+    }
65
+
66
+    /**
67
+     * @param int $offset
68
+     * @param int $whence
69
+     * @return bool
70
+     */
71
+    public function stream_seek($offset, $whence = SEEK_SET) {
72
+        if ($whence === SEEK_CUR) {
73
+            $offset = $this->stream_tell() + $offset;
74
+        } elseif ($whence === SEEK_END) {
75
+            $offset = $this->size + $offset;
76
+        }
77
+
78
+        if ($offset === $this->pos) {
79
+            return true;
80
+        }
81
+
82
+        if ($offset > $this->size) {
83
+            return false;
84
+        }
85
+
86
+        $nodeIndex = 0;
87
+        $nodeStart = 0;
88
+        while (true) {
89
+            if (!isset($this->nodes[$nodeIndex + 1])) {
90
+                break;
91
+            }
92
+            $node = $this->nodes[$nodeIndex];
93
+            if ($nodeStart + $node->getSize() > $offset) {
94
+                break;
95
+            }
96
+            $nodeIndex++;
97
+            $nodeStart += $node->getSize();
98
+        }
99
+
100
+        $stream = $this->getStream($this->nodes[$nodeIndex]);
101
+        $nodeOffset = $offset - $nodeStart;
102
+        if ($nodeOffset > 0 && fseek($stream, $nodeOffset) === -1) {
103
+            return false;
104
+        }
105
+        $this->currentNode = $nodeIndex;
106
+        $this->currentNodeRead = $nodeOffset;
107
+        $this->currentStream = $stream;
108
+        $this->pos = $offset;
109
+
110
+        return true;
111
+    }
112
+
113
+    /**
114
+     * @return int
115
+     */
116
+    public function stream_tell() {
117
+        return $this->pos;
118
+    }
119
+
120
+    /**
121
+     * @param int $count
122
+     * @return string
123
+     */
124
+    public function stream_read($count) {
125
+        if (is_null($this->currentStream)) {
126
+            if ($this->currentNode < count($this->nodes)) {
127
+                $this->currentStream = $this->getStream($this->nodes[$this->currentNode]);
128
+            } else {
129
+                return '';
130
+            }
131
+        }
132
+
133
+        $collectedData = '';
134
+        // read data until we either got all the data requested or there is no more stream left
135
+        while ($count > 0 && !is_null($this->currentStream)) {
136
+            $data = fread($this->currentStream, $count);
137
+            $read = strlen($data);
138
+
139
+            $count -= $read;
140
+            $collectedData .= $data;
141
+            $this->currentNodeRead += $read;
142
+
143
+            if (feof($this->currentStream)) {
144
+                fclose($this->currentStream);
145
+                $currentNodeSize = $this->nodes[$this->currentNode]->getSize();
146
+                if ($this->currentNodeRead < $currentNodeSize) {
147
+                    throw new \Exception('Stream from assembly node shorter than expected, got ' . $this->currentNodeRead . ' bytes, expected ' . $currentNodeSize);
148
+                }
149
+                $this->currentNode++;
150
+                $this->currentNodeRead = 0;
151
+                if ($this->currentNode < count($this->nodes)) {
152
+                    $this->currentStream = $this->getStream($this->nodes[$this->currentNode]);
153
+                } else {
154
+                    $this->currentStream = null;
155
+                }
156
+            }
157
+        }
158
+
159
+        // update position
160
+        $this->pos += strlen($collectedData);
161
+        return $collectedData;
162
+    }
163
+
164
+    /**
165
+     * @param string $data
166
+     * @return int
167
+     */
168
+    public function stream_write($data) {
169
+        return false;
170
+    }
171
+
172
+    /**
173
+     * @param int $option
174
+     * @param int $arg1
175
+     * @param int $arg2
176
+     * @return bool
177
+     */
178
+    public function stream_set_option($option, $arg1, $arg2) {
179
+        return false;
180
+    }
181
+
182
+    /**
183
+     * @param int $size
184
+     * @return bool
185
+     */
186
+    public function stream_truncate($size) {
187
+        return false;
188
+    }
189
+
190
+    /**
191
+     * @return array
192
+     */
193
+    public function stream_stat() {
194
+        return [
195
+            'size' => $this->size,
196
+        ];
197
+    }
198
+
199
+    /**
200
+     * @param int $operation
201
+     * @return bool
202
+     */
203
+    public function stream_lock($operation) {
204
+        return false;
205
+    }
206
+
207
+    /**
208
+     * @return bool
209
+     */
210
+    public function stream_flush() {
211
+        return false;
212
+    }
213
+
214
+    /**
215
+     * @return bool
216
+     */
217
+    public function stream_eof() {
218
+        return $this->pos >= $this->size || ($this->currentNode >= count($this->nodes) && $this->currentNode === null);
219
+    }
220
+
221
+    /**
222
+     * @return bool
223
+     */
224
+    public function stream_close() {
225
+        return true;
226
+    }
227
+
228
+
229
+    /**
230
+     * Load the source from the stream context and return the context options
231
+     *
232
+     * @param string $name
233
+     * @return array
234
+     * @throws \BadMethodCallException
235
+     */
236
+    protected function loadContext($name) {
237
+        $context = stream_context_get_options($this->context);
238
+        if (isset($context[$name])) {
239
+            $context = $context[$name];
240
+        } else {
241
+            throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set');
242
+        }
243
+        if (isset($context['nodes']) and is_array($context['nodes'])) {
244
+            $this->nodes = $context['nodes'];
245
+        } else {
246
+            throw new \BadMethodCallException('Invalid context, nodes not set');
247
+        }
248
+        return $context;
249
+    }
250
+
251
+    /**
252
+     * @param IFile[] $nodes
253
+     * @return resource
254
+     *
255
+     * @throws \BadMethodCallException
256
+     */
257
+    public static function wrap(array $nodes) {
258
+        $context = stream_context_create([
259
+            'assembly' => [
260
+                'nodes' => $nodes
261
+            ]
262
+        ]);
263
+        stream_wrapper_register('assembly', self::class);
264
+        try {
265
+            $wrapped = fopen('assembly://', 'r', false, $context);
266
+        } catch (\BadMethodCallException $e) {
267
+            stream_wrapper_unregister('assembly');
268
+            throw $e;
269
+        }
270
+        stream_wrapper_unregister('assembly');
271
+        return $wrapped;
272
+    }
273
+
274
+    /**
275
+     * @param IFile $node
276
+     * @return resource
277
+     */
278
+    private function getStream(IFile $node) {
279
+        $data = $node->get();
280
+        if (is_resource($data)) {
281
+            return $data;
282
+        } else {
283
+            $tmp = fopen('php://temp', 'w+');
284
+            fwrite($tmp, $data);
285
+            rewind($tmp);
286
+            return $tmp;
287
+        }
288
+    }
289 289
 }
Please login to merge, or discard this patch.