@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | $this->util = $util; |
| 67 | 67 | |
| 68 | 68 | $this->encryption_base_dir = '/files_encryption'; |
| 69 | - $this->keys_base_dir = $this->encryption_base_dir .'/keys'; |
|
| 70 | - $this->backup_base_dir = $this->encryption_base_dir .'/backup'; |
|
| 69 | + $this->keys_base_dir = $this->encryption_base_dir.'/keys'; |
|
| 70 | + $this->backup_base_dir = $this->encryption_base_dir.'/backup'; |
|
| 71 | 71 | $this->root_dir = $this->util->getKeyStorageRoot(); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | public function getFileKey($path, $keyId, $encryptionModuleId) { |
| 86 | 86 | $realFile = $this->util->stripPartialFileExtension($path); |
| 87 | 87 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $realFile); |
| 88 | - $key = $this->getKey($keyDir . $keyId); |
|
| 88 | + $key = $this->getKey($keyDir.$keyId); |
|
| 89 | 89 | |
| 90 | 90 | if ($key === '' && $realFile !== $path) { |
| 91 | 91 | // Check if the part file has keys and use them, if no normal keys |
| 92 | 92 | // exist. This is required to fix copyBetweenStorage() when we |
| 93 | 93 | // rename a .part file over storage borders. |
| 94 | 94 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $path); |
| 95 | - $key = $this->getKey($keyDir . $keyId); |
|
| 95 | + $key = $this->getKey($keyDir.$keyId); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $key; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function setFileKey($path, $keyId, $key, $encryptionModuleId) { |
| 121 | 121 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $path); |
| 122 | - return $this->setKey($keyDir . $keyId, $key); |
|
| 122 | + return $this->setKey($keyDir.$keyId, $key); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function deleteFileKey($path, $keyId, $encryptionModuleId) { |
| 145 | 145 | $keyDir = $this->getFileKeyDir($encryptionModuleId, $path); |
| 146 | - return !$this->view->file_exists($keyDir . $keyId) || $this->view->unlink($keyDir . $keyId); |
|
| 146 | + return !$this->view->file_exists($keyDir.$keyId) || $this->view->unlink($keyDir.$keyId); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | protected function constructUserKeyPath($encryptionModuleId, $keyId, $uid) { |
| 174 | 174 | |
| 175 | 175 | if ($uid === null) { |
| 176 | - $path = $this->root_dir . '/' . $this->encryption_base_dir . '/' . $encryptionModuleId . '/' . $keyId; |
|
| 176 | + $path = $this->root_dir.'/'.$this->encryption_base_dir.'/'.$encryptionModuleId.'/'.$keyId; |
|
| 177 | 177 | } else { |
| 178 | - $path = $this->root_dir . '/' . $uid . $this->encryption_base_dir . '/' |
|
| 179 | - . $encryptionModuleId . '/' . $uid . '.' . $keyId; |
|
| 178 | + $path = $this->root_dir.'/'.$uid.$this->encryption_base_dir.'/' |
|
| 179 | + . $encryptionModuleId.'/'.$uid.'.'.$keyId; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | return \OC\Files\Filesystem::normalizePath($path); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | if ($this->view->file_exists($path)) { |
| 196 | 196 | if (isset($this->keyCache[$path])) { |
| 197 | - $key = $this->keyCache[$path]; |
|
| 197 | + $key = $this->keyCache[$path]; |
|
| 198 | 198 | } else { |
| 199 | 199 | $key = $this->view->file_get_contents($path); |
| 200 | 200 | $this->keyCache[$path] = $key; |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | // in case of system wide mount points the keys are stored directly in the data directory |
| 240 | 240 | if ($this->util->isSystemWideMountPoint($filename, $owner)) { |
| 241 | - $keyPath = $this->root_dir . '/' . $this->keys_base_dir . $filename . '/'; |
|
| 241 | + $keyPath = $this->root_dir.'/'.$this->keys_base_dir.$filename.'/'; |
|
| 242 | 242 | } else { |
| 243 | - $keyPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $filename . '/'; |
|
| 243 | + $keyPath = $this->root_dir.'/'.$owner.$this->keys_base_dir.$filename.'/'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - return Filesystem::normalizePath($keyPath . $encryptionModuleId . '/', false); |
|
| 246 | + return Filesystem::normalizePath($keyPath.$encryptionModuleId.'/', false); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | * @since 12.0.0 |
| 301 | 301 | */ |
| 302 | 302 | public function backupUserKeys($encryptionModuleId, $purpose, $uid) { |
| 303 | - $source = $uid . $this->encryption_base_dir . '/' . $encryptionModuleId; |
|
| 304 | - $backupDir = $uid . $this->backup_base_dir; |
|
| 303 | + $source = $uid.$this->encryption_base_dir.'/'.$encryptionModuleId; |
|
| 304 | + $backupDir = $uid.$this->backup_base_dir; |
|
| 305 | 305 | if (!$this->view->file_exists($backupDir)) { |
| 306 | 306 | $this->view->mkdir($backupDir); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - $backupDir = $backupDir . '/' . $purpose . '.' . $encryptionModuleId . '.' . $this->getTimestamp(); |
|
| 309 | + $backupDir = $backupDir.'/'.$purpose.'.'.$encryptionModuleId.'.'.$this->getTimestamp(); |
|
| 310 | 310 | $this->view->mkdir($backupDir); |
| 311 | 311 | |
| 312 | 312 | return $this->view->copy($source, $backupDir); |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | $systemWideMountPoint = $this->util->isSystemWideMountPoint($relativePath, $owner); |
| 333 | 333 | |
| 334 | 334 | if ($systemWideMountPoint) { |
| 335 | - $systemPath = $this->root_dir . '/' . $this->keys_base_dir . $relativePath . '/'; |
|
| 335 | + $systemPath = $this->root_dir.'/'.$this->keys_base_dir.$relativePath.'/'; |
|
| 336 | 336 | } else { |
| 337 | - $systemPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $relativePath . '/'; |
|
| 337 | + $systemPath = $this->root_dir.'/'.$owner.$this->keys_base_dir.$relativePath.'/'; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | return Filesystem::normalizePath($systemPath, false); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $sub_dirs = explode('/', ltrim($path, '/')); |
| 352 | 352 | $dir = ''; |
| 353 | 353 | foreach ($sub_dirs as $sub_dir) { |
| 354 | - $dir .= '/' . $sub_dir; |
|
| 354 | + $dir .= '/'.$sub_dir; |
|
| 355 | 355 | if (!$this->view->is_dir($dir)) { |
| 356 | 356 | $this->view->mkdir($dir); |
| 357 | 357 | } |
@@ -274,7 +274,7 @@ |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // check if key storage is mounted correctly |
| 277 | - if ($this->rootView->file_exists($rootDir . '/' . Storage::KEY_STORAGE_MARKER)) { |
|
| 277 | + if ($this->rootView->file_exists($rootDir.'/'.Storage::KEY_STORAGE_MARKER)) { |
|
| 278 | 278 | return true; |
| 279 | 279 | } |
| 280 | 280 | |
@@ -117,8 +117,8 @@ |
||
| 117 | 117 | if ($aChunk !== $bChunk) { |
| 118 | 118 | // test first character (character comparison, not number comparison) |
| 119 | 119 | if ($aChunk[0] >= '0' && $aChunk[0] <= '9' && $bChunk[0] >= '0' && $bChunk[0] <= '9') { |
| 120 | - $aNum = (int)$aChunk; |
|
| 121 | - $bNum = (int)$bChunk; |
|
| 120 | + $aNum = (int) $aChunk; |
|
| 121 | + $bNum = (int) $bChunk; |
|
| 122 | 122 | return $aNum - $bNum; |
| 123 | 123 | } |
| 124 | 124 | return self::getCollator()->compare($aChunk, $bChunk); |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getSupportedActions() { |
| 51 | 51 | $actions = 0; |
| 52 | - foreach($this->possibleActions AS $action => $methodName) { |
|
| 53 | - if(method_exists($this, $methodName)) { |
|
| 52 | + foreach ($this->possibleActions AS $action => $methodName) { |
|
| 53 | + if (method_exists($this, $methodName)) { |
|
| 54 | 54 | $actions |= $action; |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * compared with \OC\Group\Backend::CREATE_GROUP etc. |
| 68 | 68 | */ |
| 69 | 69 | public function implementsActions($actions) { |
| 70 | - return (bool)($this->getSupportedActions() & $actions); |
|
| 70 | + return (bool) ($this->getSupportedActions() & $actions); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -20,4 +20,4 @@ |
||
| 20 | 20 | * |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | -require_once __DIR__ . '/v1.php'; |
|
| 23 | +require_once __DIR__.'/v1.php'; |
|
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | -require_once __DIR__ . '/../lib/base.php'; |
|
| 22 | +require_once __DIR__.'/../lib/base.php'; |
|
| 23 | 23 | |
| 24 | 24 | header('Content-Type: application/json'); |
| 25 | 25 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 56 | 56 | $outputType = $input->getOption('output'); |
| 57 | 57 | if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { |
| 58 | - $certificates = array_map(function (ICertificate $certificate) { |
|
| 58 | + $certificates = array_map(function(ICertificate $certificate) { |
|
| 59 | 59 | return [ |
| 60 | 60 | 'name' => $certificate->getName(), |
| 61 | 61 | 'common_name' => $certificate->getCommonName(), |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | 'Issued By' |
| 82 | 82 | ]); |
| 83 | 83 | |
| 84 | - $rows = array_map(function (ICertificate $certificate) { |
|
| 84 | + $rows = array_map(function(ICertificate $certificate) { |
|
| 85 | 85 | return [ |
| 86 | 86 | $certificate->getName(), |
| 87 | 87 | $certificate->getCommonName(), |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $privateKeyPath = $input->getOption('privateKey'); |
| 70 | 70 | $keyBundlePath = $input->getOption('certificate'); |
| 71 | 71 | $path = $input->getOption('path'); |
| 72 | - if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
| 72 | + if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
| 73 | 73 | $output->writeln('--privateKey, --certificate and --path are required.'); |
| 74 | 74 | return null; |
| 75 | 75 | } |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
| 78 | 78 | $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
| 79 | 79 | |
| 80 | - if($privateKey === false) { |
|
| 80 | + if ($privateKey === false) { |
|
| 81 | 81 | $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
| 82 | 82 | return null; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if($keyBundle === false) { |
|
| 85 | + if ($keyBundle === false) { |
|
| 86 | 86 | $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
| 87 | 87 | return null; |
| 88 | 88 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | try { |
| 97 | 97 | $this->checker->writeCoreSignature($x509, $rsa, $path); |
| 98 | 98 | $output->writeln('Successfully signed "core"'); |
| 99 | - } catch (\Exception $e){ |
|
| 100 | - $output->writeln('Error: ' . $e->getMessage()); |
|
| 99 | + } catch (\Exception $e) { |
|
| 100 | + $output->writeln('Error: '.$e->getMessage()); |
|
| 101 | 101 | return 1; |
| 102 | 102 | } |
| 103 | 103 | return 0; |
@@ -75,23 +75,23 @@ discard block |
||
| 75 | 75 | $path = $input->getOption('path'); |
| 76 | 76 | $privateKeyPath = $input->getOption('privateKey'); |
| 77 | 77 | $keyBundlePath = $input->getOption('certificate'); |
| 78 | - if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
| 78 | + if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
| 79 | 79 | $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); |
| 80 | 80 | $output->writeln('This command requires the --path, --privateKey and --certificate.'); |
| 81 | 81 | $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); |
| 82 | - $output->writeln('For more information please consult the documentation: '. $documentationUrl); |
|
| 82 | + $output->writeln('For more information please consult the documentation: '.$documentationUrl); |
|
| 83 | 83 | return null; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
| 87 | 87 | $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
| 88 | 88 | |
| 89 | - if($privateKey === false) { |
|
| 89 | + if ($privateKey === false) { |
|
| 90 | 90 | $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
| 91 | 91 | return null; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if($keyBundle === false) { |
|
| 94 | + if ($keyBundle === false) { |
|
| 95 | 95 | $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
| 96 | 96 | return null; |
| 97 | 97 | } |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | try { |
| 105 | 105 | $this->checker->writeAppSignature($path, $x509, $rsa); |
| 106 | 106 | $output->writeln('Successfully signed "'.$path.'"'); |
| 107 | - } catch (\Exception $e){ |
|
| 108 | - $output->writeln('Error: ' . $e->getMessage()); |
|
| 107 | + } catch (\Exception $e) { |
|
| 108 | + $output->writeln('Error: '.$e->getMessage()); |
|
| 109 | 109 | return 1; |
| 110 | 110 | } |
| 111 | 111 | return 0; |