Completed
Push — master ( 247b25...4111bd )
by Thomas
26:36 queued 10s
created
lib/private/Files/AppData/AppData.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			throw new \RuntimeException('no instance id!');
77 77
 		}
78 78
 
79
-		return 'appdata_' . $instanceId;
79
+		return 'appdata_'.$instanceId;
80 80
 	}
81 81
 
82 82
 	protected function getAppDataRootFolder(): Folder {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			$name = $this->getAppDataFolderName();
105 105
 
106 106
 			try {
107
-				$this->folder = $this->rootFolder->get($name . '/' . $this->appId);
107
+				$this->folder = $this->rootFolder->get($name.'/'.$this->appId);
108 108
 			} catch (NotFoundException $e) {
109 109
 				$appDataRootFolder = $this->getAppDataRootFolder();
110 110
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 					try {
115 115
 						$this->folder = $appDataRootFolder->newFolder($this->appId);
116 116
 					} catch (NotPermittedException $e) {
117
-						throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
117
+						throw new \RuntimeException('Could not get appdata folder for '.$this->appId);
118 118
 					}
119 119
 				}
120 120
 			}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	}
125 125
 
126 126
 	public function getFolder(string $name): ISimpleFolder {
127
-		$key = $this->appId . '/' . $name;
127
+		$key = $this->appId.'/'.$name;
128 128
 		if ($cachedFolder = $this->folders->get($key)) {
129 129
 			if ($cachedFolder instanceof \Exception) {
130 130
 				throw $cachedFolder;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			if ($name === '/') {
138 138
 				$node = $this->getAppDataFolder();
139 139
 			} else {
140
-				$path = $this->getAppDataFolderName() . '/' . $this->appId . '/' . $name;
140
+				$path = $this->getAppDataFolderName().'/'.$this->appId.'/'.$name;
141 141
 				$node = $this->rootFolder->get($path);
142 142
 			}
143 143
 		} catch (NotFoundException $e) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	}
153 153
 
154 154
 	public function newFolder(string $name): ISimpleFolder {
155
-		$key = $this->appId . '/' . $name;
155
+		$key = $this->appId.'/'.$name;
156 156
 		$folder = $this->getAppDataFolder()->newFolder($name);
157 157
 
158 158
 		$simpleFolder = new SimpleFolder($folder);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	public function getDirectoryListing(): array {
164 164
 		$listing = $this->getAppDataFolder()->getDirectoryListing();
165 165
 
166
-		$fileListing = array_map(function (Node $folder) {
166
+		$fileListing = array_map(function(Node $folder) {
167 167
 			if ($folder instanceof Folder) {
168 168
 				return new SimpleFolder($folder);
169 169
 			}
Please login to merge, or discard this patch.
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -20,135 +20,135 @@
 block discarded – undo
20 20
 use OCP\Files\SimpleFS\ISimpleFolder;
21 21
 
22 22
 class AppData implements IAppData {
23
-	private IRootFolder $rootFolder;
24
-	private SystemConfig $config;
25
-	private string $appId;
26
-	private ?Folder $folder = null;
27
-	/** @var CappedMemoryCache<ISimpleFolder|NotFoundException> */
28
-	private CappedMemoryCache $folders;
29
-
30
-	/**
31
-	 * AppData constructor.
32
-	 *
33
-	 * @param IRootFolder $rootFolder
34
-	 * @param SystemConfig $systemConfig
35
-	 * @param string $appId
36
-	 */
37
-	public function __construct(IRootFolder $rootFolder,
38
-		SystemConfig $systemConfig,
39
-		string $appId) {
40
-		$this->rootFolder = $rootFolder;
41
-		$this->config = $systemConfig;
42
-		$this->appId = $appId;
43
-		$this->folders = new CappedMemoryCache();
44
-	}
45
-
46
-	private function getAppDataFolderName() {
47
-		$instanceId = $this->config->getValue('instanceid', null);
48
-		if ($instanceId === null) {
49
-			throw new \RuntimeException('no instance id!');
50
-		}
51
-
52
-		return 'appdata_' . $instanceId;
53
-	}
54
-
55
-	protected function getAppDataRootFolder(): Folder {
56
-		$name = $this->getAppDataFolderName();
57
-
58
-		try {
59
-			/** @var Folder $node */
60
-			$node = $this->rootFolder->get($name);
61
-			return $node;
62
-		} catch (NotFoundException $e) {
63
-			try {
64
-				return $this->rootFolder->newFolder($name);
65
-			} catch (NotPermittedException $e) {
66
-				throw new \RuntimeException('Could not get appdata folder');
67
-			}
68
-		}
69
-	}
70
-
71
-	/**
72
-	 * @return Folder
73
-	 * @throws \RuntimeException
74
-	 */
75
-	private function getAppDataFolder(): Folder {
76
-		if ($this->folder === null) {
77
-			$name = $this->getAppDataFolderName();
78
-
79
-			try {
80
-				$this->folder = $this->rootFolder->get($name . '/' . $this->appId);
81
-			} catch (NotFoundException $e) {
82
-				$appDataRootFolder = $this->getAppDataRootFolder();
83
-
84
-				try {
85
-					$this->folder = $appDataRootFolder->get($this->appId);
86
-				} catch (NotFoundException $e) {
87
-					try {
88
-						$this->folder = $appDataRootFolder->newFolder($this->appId);
89
-					} catch (NotPermittedException $e) {
90
-						throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
91
-					}
92
-				}
93
-			}
94
-		}
95
-
96
-		return $this->folder;
97
-	}
98
-
99
-	public function getFolder(string $name): ISimpleFolder {
100
-		$key = $this->appId . '/' . $name;
101
-		if ($cachedFolder = $this->folders->get($key)) {
102
-			if ($cachedFolder instanceof \Exception) {
103
-				throw $cachedFolder;
104
-			} else {
105
-				return $cachedFolder;
106
-			}
107
-		}
108
-		try {
109
-			// Hardening if somebody wants to retrieve '/'
110
-			if ($name === '/') {
111
-				$node = $this->getAppDataFolder();
112
-			} else {
113
-				$path = $this->getAppDataFolderName() . '/' . $this->appId . '/' . $name;
114
-				$node = $this->rootFolder->get($path);
115
-			}
116
-		} catch (NotFoundException $e) {
117
-			$this->folders->set($key, $e);
118
-			throw $e;
119
-		}
120
-
121
-		/** @var Folder $node */
122
-		$folder = new SimpleFolder($node);
123
-		$this->folders->set($key, $folder);
124
-		return $folder;
125
-	}
126
-
127
-	public function newFolder(string $name): ISimpleFolder {
128
-		$key = $this->appId . '/' . $name;
129
-		$folder = $this->getAppDataFolder()->newFolder($name);
130
-
131
-		$simpleFolder = new SimpleFolder($folder);
132
-		$this->folders->set($key, $simpleFolder);
133
-		return $simpleFolder;
134
-	}
135
-
136
-	public function getDirectoryListing(): array {
137
-		$listing = $this->getAppDataFolder()->getDirectoryListing();
138
-
139
-		$fileListing = array_map(function (Node $folder) {
140
-			if ($folder instanceof Folder) {
141
-				return new SimpleFolder($folder);
142
-			}
143
-			return null;
144
-		}, $listing);
145
-
146
-		$fileListing = array_filter($fileListing);
147
-
148
-		return array_values($fileListing);
149
-	}
150
-
151
-	public function getId(): int {
152
-		return $this->getAppDataFolder()->getId();
153
-	}
23
+    private IRootFolder $rootFolder;
24
+    private SystemConfig $config;
25
+    private string $appId;
26
+    private ?Folder $folder = null;
27
+    /** @var CappedMemoryCache<ISimpleFolder|NotFoundException> */
28
+    private CappedMemoryCache $folders;
29
+
30
+    /**
31
+     * AppData constructor.
32
+     *
33
+     * @param IRootFolder $rootFolder
34
+     * @param SystemConfig $systemConfig
35
+     * @param string $appId
36
+     */
37
+    public function __construct(IRootFolder $rootFolder,
38
+        SystemConfig $systemConfig,
39
+        string $appId) {
40
+        $this->rootFolder = $rootFolder;
41
+        $this->config = $systemConfig;
42
+        $this->appId = $appId;
43
+        $this->folders = new CappedMemoryCache();
44
+    }
45
+
46
+    private function getAppDataFolderName() {
47
+        $instanceId = $this->config->getValue('instanceid', null);
48
+        if ($instanceId === null) {
49
+            throw new \RuntimeException('no instance id!');
50
+        }
51
+
52
+        return 'appdata_' . $instanceId;
53
+    }
54
+
55
+    protected function getAppDataRootFolder(): Folder {
56
+        $name = $this->getAppDataFolderName();
57
+
58
+        try {
59
+            /** @var Folder $node */
60
+            $node = $this->rootFolder->get($name);
61
+            return $node;
62
+        } catch (NotFoundException $e) {
63
+            try {
64
+                return $this->rootFolder->newFolder($name);
65
+            } catch (NotPermittedException $e) {
66
+                throw new \RuntimeException('Could not get appdata folder');
67
+            }
68
+        }
69
+    }
70
+
71
+    /**
72
+     * @return Folder
73
+     * @throws \RuntimeException
74
+     */
75
+    private function getAppDataFolder(): Folder {
76
+        if ($this->folder === null) {
77
+            $name = $this->getAppDataFolderName();
78
+
79
+            try {
80
+                $this->folder = $this->rootFolder->get($name . '/' . $this->appId);
81
+            } catch (NotFoundException $e) {
82
+                $appDataRootFolder = $this->getAppDataRootFolder();
83
+
84
+                try {
85
+                    $this->folder = $appDataRootFolder->get($this->appId);
86
+                } catch (NotFoundException $e) {
87
+                    try {
88
+                        $this->folder = $appDataRootFolder->newFolder($this->appId);
89
+                    } catch (NotPermittedException $e) {
90
+                        throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
91
+                    }
92
+                }
93
+            }
94
+        }
95
+
96
+        return $this->folder;
97
+    }
98
+
99
+    public function getFolder(string $name): ISimpleFolder {
100
+        $key = $this->appId . '/' . $name;
101
+        if ($cachedFolder = $this->folders->get($key)) {
102
+            if ($cachedFolder instanceof \Exception) {
103
+                throw $cachedFolder;
104
+            } else {
105
+                return $cachedFolder;
106
+            }
107
+        }
108
+        try {
109
+            // Hardening if somebody wants to retrieve '/'
110
+            if ($name === '/') {
111
+                $node = $this->getAppDataFolder();
112
+            } else {
113
+                $path = $this->getAppDataFolderName() . '/' . $this->appId . '/' . $name;
114
+                $node = $this->rootFolder->get($path);
115
+            }
116
+        } catch (NotFoundException $e) {
117
+            $this->folders->set($key, $e);
118
+            throw $e;
119
+        }
120
+
121
+        /** @var Folder $node */
122
+        $folder = new SimpleFolder($node);
123
+        $this->folders->set($key, $folder);
124
+        return $folder;
125
+    }
126
+
127
+    public function newFolder(string $name): ISimpleFolder {
128
+        $key = $this->appId . '/' . $name;
129
+        $folder = $this->getAppDataFolder()->newFolder($name);
130
+
131
+        $simpleFolder = new SimpleFolder($folder);
132
+        $this->folders->set($key, $simpleFolder);
133
+        return $simpleFolder;
134
+    }
135
+
136
+    public function getDirectoryListing(): array {
137
+        $listing = $this->getAppDataFolder()->getDirectoryListing();
138
+
139
+        $fileListing = array_map(function (Node $folder) {
140
+            if ($folder instanceof Folder) {
141
+                return new SimpleFolder($folder);
142
+            }
143
+            return null;
144
+        }, $listing);
145
+
146
+        $fileListing = array_filter($fileListing);
147
+
148
+        return array_values($fileListing);
149
+    }
150
+
151
+    public function getId(): int {
152
+        return $this->getAppDataFolder()->getId();
153
+    }
154 154
 }
Please login to merge, or discard this patch.
lib/private/Updater/ChangesCheck.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -146,12 +146,12 @@
 block discarded – undo
146 146
 				$xml = @simplexml_load_string($body);
147 147
 			}
148 148
 			if ($xml !== false) {
149
-				$data['changelogURL'] = (string)$xml->changelog['href'];
149
+				$data['changelogURL'] = (string) $xml->changelog['href'];
150 150
 				$data['whatsNew'] = [];
151 151
 				foreach ($xml->whatsNew as $infoSet) {
152
-					$data['whatsNew'][(string)$infoSet['lang']] = [
153
-						'regular' => (array)$infoSet->regular->item,
154
-						'admin' => (array)$infoSet->admin->item,
152
+					$data['whatsNew'][(string) $infoSet['lang']] = [
153
+						'regular' => (array) $infoSet->regular->item,
154
+						'admin' => (array) $infoSet->admin->item,
155 155
 					];
156 156
 				}
157 157
 			} else {
Please login to merge, or discard this patch.
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -14,145 +14,145 @@
 block discarded – undo
14 14
 use Psr\Log\LoggerInterface;
15 15
 
16 16
 class ChangesCheck {
17
-	/** @var IClientService */
18
-	protected $clientService;
19
-	/** @var ChangesMapper */
20
-	private $mapper;
21
-	private LoggerInterface $logger;
22
-
23
-	public const RESPONSE_NO_CONTENT = 0;
24
-	public const RESPONSE_USE_CACHE = 1;
25
-	public const RESPONSE_HAS_CONTENT = 2;
26
-
27
-	public function __construct(IClientService $clientService, ChangesMapper $mapper, LoggerInterface $logger) {
28
-		$this->clientService = $clientService;
29
-		$this->mapper = $mapper;
30
-		$this->logger = $logger;
31
-	}
32
-
33
-	/**
34
-	 * @throws DoesNotExistException
35
-	 * @return array{changelogURL: string, whatsNew: array<string, array{admin: list<string>, regular: list<string>}>}
36
-	 */
37
-	public function getChangesForVersion(string $version): array {
38
-		$version = $this->normalizeVersion($version);
39
-		$changesInfo = $this->mapper->getChanges($version);
40
-		$changesData = json_decode($changesInfo->getData(), true);
41
-		if (empty($changesData)) {
42
-			throw new DoesNotExistException('Unable to decode changes info');
43
-		}
44
-		return $changesData;
45
-	}
46
-
47
-	/**
48
-	 * @throws \Exception
49
-	 */
50
-	public function check(string $uri, string $version): array {
51
-		try {
52
-			$version = $this->normalizeVersion($version);
53
-			$changesInfo = $this->mapper->getChanges($version);
54
-			if ($changesInfo->getLastCheck() + 1800 > time()) {
55
-				return json_decode($changesInfo->getData(), true);
56
-			}
57
-		} catch (DoesNotExistException $e) {
58
-			$changesInfo = new Changes();
59
-		}
60
-
61
-		$response = $this->queryChangesServer($uri, $changesInfo);
62
-
63
-		switch ($this->evaluateResponse($response)) {
64
-			case self::RESPONSE_NO_CONTENT:
65
-				return [];
66
-			case self::RESPONSE_USE_CACHE:
67
-				return json_decode($changesInfo->getData(), true);
68
-			case self::RESPONSE_HAS_CONTENT:
69
-			default:
70
-				$data = $this->extractData($response->getBody());
71
-				$changesInfo->setData(json_encode($data));
72
-				$changesInfo->setEtag($response->getHeader('Etag'));
73
-				$this->cacheResult($changesInfo, $version);
74
-
75
-				return $data;
76
-		}
77
-	}
78
-
79
-	protected function evaluateResponse(IResponse $response): int {
80
-		if ($response->getStatusCode() === 304) {
81
-			return self::RESPONSE_USE_CACHE;
82
-		} elseif ($response->getStatusCode() === 404) {
83
-			return self::RESPONSE_NO_CONTENT;
84
-		} elseif ($response->getStatusCode() === 200) {
85
-			return self::RESPONSE_HAS_CONTENT;
86
-		}
87
-		$this->logger->debug('Unexpected return code {code} from changelog server', [
88
-			'app' => 'core',
89
-			'code' => $response->getStatusCode(),
90
-		]);
91
-		return self::RESPONSE_NO_CONTENT;
92
-	}
93
-
94
-	protected function cacheResult(Changes $entry, string $version) {
95
-		if ($entry->getVersion() === $version) {
96
-			$this->mapper->update($entry);
97
-		} else {
98
-			$entry->setVersion($version);
99
-			$this->mapper->insert($entry);
100
-		}
101
-	}
102
-
103
-	/**
104
-	 * @throws \Exception
105
-	 */
106
-	protected function queryChangesServer(string $uri, Changes $entry): IResponse {
107
-		$headers = [];
108
-		if ($entry->getEtag() !== '') {
109
-			$headers['If-None-Match'] = [$entry->getEtag()];
110
-		}
111
-
112
-		$entry->setLastCheck(time());
113
-		$client = $this->clientService->newClient();
114
-		return $client->get($uri, [
115
-			'headers' => $headers,
116
-		]);
117
-	}
118
-
119
-	protected function extractData($body):array {
120
-		$data = [];
121
-		if ($body) {
122
-			if (\LIBXML_VERSION < 20900) {
123
-				$loadEntities = libxml_disable_entity_loader(true);
124
-				$xml = @simplexml_load_string($body);
125
-				libxml_disable_entity_loader($loadEntities);
126
-			} else {
127
-				$xml = @simplexml_load_string($body);
128
-			}
129
-			if ($xml !== false) {
130
-				$data['changelogURL'] = (string)$xml->changelog['href'];
131
-				$data['whatsNew'] = [];
132
-				foreach ($xml->whatsNew as $infoSet) {
133
-					$data['whatsNew'][(string)$infoSet['lang']] = [
134
-						'regular' => (array)$infoSet->regular->item,
135
-						'admin' => (array)$infoSet->admin->item,
136
-					];
137
-				}
138
-			} else {
139
-				libxml_clear_errors();
140
-			}
141
-		}
142
-		return $data;
143
-	}
144
-
145
-	/**
146
-	 * returns a x.y.z form of the provided version. Extra numbers will be
147
-	 * omitted, missing ones added as zeros.
148
-	 */
149
-	public function normalizeVersion(string $version): string {
150
-		$versionNumbers = array_slice(explode('.', $version), 0, 3);
151
-		$versionNumbers[0] = $versionNumbers[0] ?: '0'; // deal with empty input
152
-		while (count($versionNumbers) < 3) {
153
-			// changelog server expects x.y.z, pad 0 if it is too short
154
-			$versionNumbers[] = 0;
155
-		}
156
-		return implode('.', $versionNumbers);
157
-	}
17
+    /** @var IClientService */
18
+    protected $clientService;
19
+    /** @var ChangesMapper */
20
+    private $mapper;
21
+    private LoggerInterface $logger;
22
+
23
+    public const RESPONSE_NO_CONTENT = 0;
24
+    public const RESPONSE_USE_CACHE = 1;
25
+    public const RESPONSE_HAS_CONTENT = 2;
26
+
27
+    public function __construct(IClientService $clientService, ChangesMapper $mapper, LoggerInterface $logger) {
28
+        $this->clientService = $clientService;
29
+        $this->mapper = $mapper;
30
+        $this->logger = $logger;
31
+    }
32
+
33
+    /**
34
+     * @throws DoesNotExistException
35
+     * @return array{changelogURL: string, whatsNew: array<string, array{admin: list<string>, regular: list<string>}>}
36
+     */
37
+    public function getChangesForVersion(string $version): array {
38
+        $version = $this->normalizeVersion($version);
39
+        $changesInfo = $this->mapper->getChanges($version);
40
+        $changesData = json_decode($changesInfo->getData(), true);
41
+        if (empty($changesData)) {
42
+            throw new DoesNotExistException('Unable to decode changes info');
43
+        }
44
+        return $changesData;
45
+    }
46
+
47
+    /**
48
+     * @throws \Exception
49
+     */
50
+    public function check(string $uri, string $version): array {
51
+        try {
52
+            $version = $this->normalizeVersion($version);
53
+            $changesInfo = $this->mapper->getChanges($version);
54
+            if ($changesInfo->getLastCheck() + 1800 > time()) {
55
+                return json_decode($changesInfo->getData(), true);
56
+            }
57
+        } catch (DoesNotExistException $e) {
58
+            $changesInfo = new Changes();
59
+        }
60
+
61
+        $response = $this->queryChangesServer($uri, $changesInfo);
62
+
63
+        switch ($this->evaluateResponse($response)) {
64
+            case self::RESPONSE_NO_CONTENT:
65
+                return [];
66
+            case self::RESPONSE_USE_CACHE:
67
+                return json_decode($changesInfo->getData(), true);
68
+            case self::RESPONSE_HAS_CONTENT:
69
+            default:
70
+                $data = $this->extractData($response->getBody());
71
+                $changesInfo->setData(json_encode($data));
72
+                $changesInfo->setEtag($response->getHeader('Etag'));
73
+                $this->cacheResult($changesInfo, $version);
74
+
75
+                return $data;
76
+        }
77
+    }
78
+
79
+    protected function evaluateResponse(IResponse $response): int {
80
+        if ($response->getStatusCode() === 304) {
81
+            return self::RESPONSE_USE_CACHE;
82
+        } elseif ($response->getStatusCode() === 404) {
83
+            return self::RESPONSE_NO_CONTENT;
84
+        } elseif ($response->getStatusCode() === 200) {
85
+            return self::RESPONSE_HAS_CONTENT;
86
+        }
87
+        $this->logger->debug('Unexpected return code {code} from changelog server', [
88
+            'app' => 'core',
89
+            'code' => $response->getStatusCode(),
90
+        ]);
91
+        return self::RESPONSE_NO_CONTENT;
92
+    }
93
+
94
+    protected function cacheResult(Changes $entry, string $version) {
95
+        if ($entry->getVersion() === $version) {
96
+            $this->mapper->update($entry);
97
+        } else {
98
+            $entry->setVersion($version);
99
+            $this->mapper->insert($entry);
100
+        }
101
+    }
102
+
103
+    /**
104
+     * @throws \Exception
105
+     */
106
+    protected function queryChangesServer(string $uri, Changes $entry): IResponse {
107
+        $headers = [];
108
+        if ($entry->getEtag() !== '') {
109
+            $headers['If-None-Match'] = [$entry->getEtag()];
110
+        }
111
+
112
+        $entry->setLastCheck(time());
113
+        $client = $this->clientService->newClient();
114
+        return $client->get($uri, [
115
+            'headers' => $headers,
116
+        ]);
117
+    }
118
+
119
+    protected function extractData($body):array {
120
+        $data = [];
121
+        if ($body) {
122
+            if (\LIBXML_VERSION < 20900) {
123
+                $loadEntities = libxml_disable_entity_loader(true);
124
+                $xml = @simplexml_load_string($body);
125
+                libxml_disable_entity_loader($loadEntities);
126
+            } else {
127
+                $xml = @simplexml_load_string($body);
128
+            }
129
+            if ($xml !== false) {
130
+                $data['changelogURL'] = (string)$xml->changelog['href'];
131
+                $data['whatsNew'] = [];
132
+                foreach ($xml->whatsNew as $infoSet) {
133
+                    $data['whatsNew'][(string)$infoSet['lang']] = [
134
+                        'regular' => (array)$infoSet->regular->item,
135
+                        'admin' => (array)$infoSet->admin->item,
136
+                    ];
137
+                }
138
+            } else {
139
+                libxml_clear_errors();
140
+            }
141
+        }
142
+        return $data;
143
+    }
144
+
145
+    /**
146
+     * returns a x.y.z form of the provided version. Extra numbers will be
147
+     * omitted, missing ones added as zeros.
148
+     */
149
+    public function normalizeVersion(string $version): string {
150
+        $versionNumbers = array_slice(explode('.', $version), 0, 3);
151
+        $versionNumbers[0] = $versionNumbers[0] ?: '0'; // deal with empty input
152
+        while (count($versionNumbers) < 3) {
153
+            // changelog server expects x.y.z, pad 0 if it is too short
154
+            $versionNumbers[] = 0;
155
+        }
156
+        return implode('.', $versionNumbers);
157
+    }
158 158
 }
Please login to merge, or discard this patch.
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.