@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | return []; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 74 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 75 | 75 | if (!$this->view->is_dir($path)) { |
| 76 | 76 | return []; |
| 77 | 77 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | while (false !== ($file = readdir($handle))) { |
| 84 | 84 | if ($file != '.' && $file != '..') { |
| 85 | 85 | try { |
| 86 | - $result[] = new Certificate($this->view->file_get_contents($path . $file), $file); |
|
| 86 | + $result[] = new Certificate($this->view->file_get_contents($path.$file), $file); |
|
| 87 | 87 | } catch (\Exception $e) { |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 100 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 101 | 101 | if (!$this->view->is_dir($path)) { |
| 102 | 102 | return false; |
| 103 | 103 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $this->view->mkdir($path); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 129 | + $defaultCertificates = file_get_contents(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 130 | 130 | if (strlen($defaultCertificates) < 1024) { // sanity check to verify that we have some content for our bundle |
| 131 | 131 | // log as exception so we have a stacktrace |
| 132 | 132 | $e = new \Exception('Shipped ca-bundle is empty, refusing to create certificate bundle'); |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $certPath = $path . 'rootcerts.crt'; |
|
| 138 | - $tmpPath = $certPath . '.tmp' . $this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 137 | + $certPath = $path.'rootcerts.crt'; |
|
| 138 | + $tmpPath = $certPath.'.tmp'.$this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 139 | 139 | $fhCerts = $this->view->fopen($tmpPath, 'w'); |
| 140 | 140 | |
| 141 | 141 | if (!is_resource($fhCerts)) { |
| 142 | - throw new \RuntimeException('Unable to open file handler to create certificate bundle "' . $tmpPath . '".'); |
|
| 142 | + throw new \RuntimeException('Unable to open file handler to create certificate bundle "'.$tmpPath.'".'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | // Write user certificates |
| 146 | 146 | foreach ($certs as $cert) { |
| 147 | - $file = $path . '/uploads/' . $cert->getName(); |
|
| 147 | + $file = $path.'/uploads/'.$cert->getName(); |
|
| 148 | 148 | $data = $this->view->file_get_contents($file); |
| 149 | 149 | if (strpos($data, 'BEGIN CERTIFICATE')) { |
| 150 | 150 | fwrite($fhCerts, $data); |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | $this->bundlePath = null; |
| 183 | 183 | |
| 184 | - $dir = $this->getPathToCertificates() . 'uploads/'; |
|
| 184 | + $dir = $this->getPathToCertificates().'uploads/'; |
|
| 185 | 185 | if (!$this->view->file_exists($dir)) { |
| 186 | 186 | $this->view->mkdir($dir); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | try { |
| 190 | - $file = $dir . $name; |
|
| 190 | + $file = $dir.$name; |
|
| 191 | 191 | $certificateObject = new Certificate($certificate, $name); |
| 192 | 192 | $this->view->file_put_contents($file, $certificate); |
| 193 | 193 | $this->createCertificateBundle(); |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | $this->bundlePath = null; |
| 211 | 211 | |
| 212 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 213 | - if ($this->view->file_exists($path . $name)) { |
|
| 214 | - $this->view->unlink($path . $name); |
|
| 212 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 213 | + if ($this->view->file_exists($path.$name)) { |
|
| 214 | + $this->view->unlink($path.$name); |
|
| 215 | 215 | $this->createCertificateBundle(); |
| 216 | 216 | } |
| 217 | 217 | return true; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * @return string |
| 224 | 224 | */ |
| 225 | 225 | public function getCertificateBundle(): string { |
| 226 | - return $this->getPathToCertificates() . 'rootcerts.crt'; |
|
| 226 | + return $this->getPathToCertificates().'rootcerts.crt'; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | try { |
| 235 | 235 | if ($this->bundlePath === null) { |
| 236 | 236 | if (!$this->hasCertificates()) { |
| 237 | - $this->bundlePath = \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; |
|
| 237 | + $this->bundlePath = \OC::$SERVERROOT.'/resources/config/ca-bundle.crt'; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if ($this->needsRebundling()) { |
@@ -245,13 +245,13 @@ discard block |
||
| 245 | 245 | $this->bundlePath = $this->view->getLocalFile($certificateBundle) ?: null; |
| 246 | 246 | |
| 247 | 247 | if ($this->bundlePath === null) { |
| 248 | - throw new \RuntimeException('Unable to get certificate bundle "' . $certificateBundle . '".'); |
|
| 248 | + throw new \RuntimeException('Unable to get certificate bundle "'.$certificateBundle.'".'); |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | return $this->bundlePath; |
| 252 | 252 | } catch (\Exception $e) { |
| 253 | 253 | $this->logger->error('Failed to get absolute bundle path. Fallback to default ca-bundle.crt', ['exception' => $e]); |
| 254 | - return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; |
|
| 254 | + return \OC::$SERVERROOT.'/resources/config/ca-bundle.crt'; |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
@@ -280,6 +280,6 @@ discard block |
||
| 280 | 280 | * @return int |
| 281 | 281 | */ |
| 282 | 282 | protected function getFilemtimeOfCaBundle(): int { |
| 283 | - return filemtime(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 283 | + return filemtime(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 284 | 284 | } |
| 285 | 285 | } |