@@ -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 | - $content = $this->view->file_get_contents($path . $file); |
|
| 86 | + $content = $this->view->file_get_contents($path.$file); |
|
| 87 | 87 | if ($content !== false) { |
| 88 | 88 | $result[] = new Certificate($content, $file); |
| 89 | 89 | } else { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return false; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 106 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 107 | 107 | if (!$this->view->is_dir($path)) { |
| 108 | 108 | return false; |
| 109 | 109 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $this->view->mkdir($path); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 135 | + $defaultCertificates = file_get_contents(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 136 | 136 | if (strlen($defaultCertificates) < 1024) { // sanity check to verify that we have some content for our bundle |
| 137 | 137 | // log as exception so we have a stacktrace |
| 138 | 138 | $e = new \Exception('Shipped ca-bundle is empty, refusing to create certificate bundle'); |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $certPath = $path . 'rootcerts.crt'; |
|
| 144 | - $tmpPath = $certPath . '.tmp' . $this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 143 | + $certPath = $path.'rootcerts.crt'; |
|
| 144 | + $tmpPath = $certPath.'.tmp'.$this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 145 | 145 | $fhCerts = $this->view->fopen($tmpPath, 'w'); |
| 146 | 146 | |
| 147 | 147 | if (!is_resource($fhCerts)) { |
| 148 | - throw new \RuntimeException('Unable to open file handler to create certificate bundle "' . $tmpPath . '".'); |
|
| 148 | + throw new \RuntimeException('Unable to open file handler to create certificate bundle "'.$tmpPath.'".'); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Write user certificates |
| 152 | 152 | foreach ($certs as $cert) { |
| 153 | - $file = $path . '/uploads/' . $cert->getName(); |
|
| 153 | + $file = $path.'/uploads/'.$cert->getName(); |
|
| 154 | 154 | $data = $this->view->file_get_contents($file); |
| 155 | 155 | if (strpos($data, 'BEGIN CERTIFICATE')) { |
| 156 | 156 | fwrite($fhCerts, $data); |
@@ -187,13 +187,13 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | $this->bundlePath = null; |
| 189 | 189 | |
| 190 | - $dir = $this->getPathToCertificates() . 'uploads/'; |
|
| 190 | + $dir = $this->getPathToCertificates().'uploads/'; |
|
| 191 | 191 | if (!$this->view->file_exists($dir)) { |
| 192 | 192 | $this->view->mkdir($dir); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | try { |
| 196 | - $file = $dir . $name; |
|
| 196 | + $file = $dir.$name; |
|
| 197 | 197 | $certificateObject = new Certificate($certificate, $name); |
| 198 | 198 | $this->view->file_put_contents($file, $certificate); |
| 199 | 199 | $this->createCertificateBundle(); |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | $this->bundlePath = null; |
| 217 | 217 | |
| 218 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 219 | - if ($this->view->file_exists($path . $name)) { |
|
| 220 | - $this->view->unlink($path . $name); |
|
| 218 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 219 | + if ($this->view->file_exists($path.$name)) { |
|
| 220 | + $this->view->unlink($path.$name); |
|
| 221 | 221 | $this->createCertificateBundle(); |
| 222 | 222 | } |
| 223 | 223 | return true; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @return string |
| 230 | 230 | */ |
| 231 | 231 | public function getCertificateBundle(): string { |
| 232 | - return $this->getPathToCertificates() . 'rootcerts.crt'; |
|
| 232 | + return $this->getPathToCertificates().'rootcerts.crt'; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | try { |
| 241 | 241 | if ($this->bundlePath === null) { |
| 242 | 242 | if (!$this->hasCertificates()) { |
| 243 | - $this->bundlePath = \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; |
|
| 243 | + $this->bundlePath = \OC::$SERVERROOT.'/resources/config/ca-bundle.crt'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | if ($this->needsRebundling()) { |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | $this->bundlePath = $this->view->getLocalFile($certificateBundle) ?: null; |
| 252 | 252 | |
| 253 | 253 | if ($this->bundlePath === null) { |
| 254 | - throw new \RuntimeException('Unable to get certificate bundle "' . $certificateBundle . '".'); |
|
| 254 | + throw new \RuntimeException('Unable to get certificate bundle "'.$certificateBundle.'".'); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | return $this->bundlePath; |
| 258 | 258 | } catch (\Exception $e) { |
| 259 | 259 | $this->logger->error('Failed to get absolute bundle path. Fallback to default ca-bundle.crt', ['exception' => $e]); |
| 260 | - return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; |
|
| 260 | + return \OC::$SERVERROOT.'/resources/config/ca-bundle.crt'; |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -286,6 +286,6 @@ discard block |
||
| 286 | 286 | * @return int |
| 287 | 287 | */ |
| 288 | 288 | protected function getFilemtimeOfCaBundle(): int { |
| 289 | - return filemtime(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 289 | + return filemtime(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 290 | 290 | } |
| 291 | 291 | } |