@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $mount = $file->getMountPoint(); |
| 247 | - if ($mount and !$mount->getOption('previews', true)){ |
|
| 247 | + if ($mount and !$mount->getOption('previews', true)) { |
|
| 248 | 248 | return false; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | protected function registerCoreProvider($class, $mimeType, $options = []) { |
| 332 | 332 | if (in_array(trim($class, '\\'), $this->getEnabledDefaultProvider())) { |
| 333 | - $this->registerProvider($mimeType, function () use ($class, $options) { |
|
| 333 | + $this->registerProvider($mimeType, function() use ($class, $options) { |
|
| 334 | 334 | return new $class($options); |
| 335 | 335 | }); |
| 336 | 336 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
| 88 | 88 | $path = Filesystem::getPath($params['fileSource']); |
| 89 | 89 | list($owner, $ownerPath) = $this->getOwnerPath($path); |
| 90 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
| 90 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
| 91 | 91 | $this->update($absPath); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
| 104 | 104 | $path = Filesystem::getPath($params['fileSource']); |
| 105 | 105 | list($owner, $ownerPath) = $this->getOwnerPath($path); |
| 106 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
| 106 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
| 107 | 107 | $this->update($absPath); |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function postRestore($params) { |
| 119 | 119 | if ($this->encryptionManager->isEnabled()) { |
| 120 | - $path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']); |
|
| 120 | + $path = Filesystem::normalizePath('/'.$this->uid.'/files/'.$params['filePath']); |
|
| 121 | 121 | $this->update($path); |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | public function postRename($params) { |
| 132 | 132 | $source = $params['oldpath']; |
| 133 | 133 | $target = $params['newpath']; |
| 134 | - if( |
|
| 134 | + if ( |
|
| 135 | 135 | $this->encryptionManager->isEnabled() && |
| 136 | 136 | dirname($source) !== dirname($target) |
| 137 | 137 | ) { |
| 138 | 138 | list($owner, $ownerPath) = $this->getOwnerPath($target); |
| 139 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
| 139 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
| 140 | 140 | $this->update($absPath); |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | protected function getOwnerPath($path) { |
| 152 | 152 | $info = Filesystem::getFileInfo($path); |
| 153 | 153 | $owner = Filesystem::getOwner($path); |
| 154 | - $view = new View('/' . $owner . '/files'); |
|
| 154 | + $view = new View('/'.$owner.'/files'); |
|
| 155 | 155 | $path = $view->getPath($info->getId()); |
| 156 | 156 | if ($path === null) { |
| 157 | - throw new \InvalidArgumentException('No file found for ' . $info->getId()); |
|
| 157 | + throw new \InvalidArgumentException('No file found for '.$info->getId()); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | return array($owner, $path); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * @param string $name |
| 33 | 33 | */ |
| 34 | 34 | public function __construct($id, $name) { |
| 35 | - parent::__construct('Id "' . $id . '" already used by encryption module "' . $name . '"'); |
|
| 35 | + parent::__construct('Id "'.$id.'" already used by encryption module "'.$name.'"'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | } |
@@ -31,6 +31,6 @@ |
||
| 31 | 31 | * @param string $key |
| 32 | 32 | */ |
| 33 | 33 | public function __construct($key) { |
| 34 | - parent::__construct('header key "'. $key . '" already reserved by ownCloud'); |
|
| 34 | + parent::__construct('header key "'.$key.'" already reserved by ownCloud'); |
|
| 35 | 35 | } |
| 36 | 36 | } |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | |
| 27 | 27 | use OCP\Encryption\Exceptions\GenericEncryptionException; |
| 28 | 28 | |
| 29 | -class EncryptionFailedException extends GenericEncryptionException{ |
|
| 29 | +class EncryptionFailedException extends GenericEncryptionException { |
|
| 30 | 30 | |
| 31 | 31 | } |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | |
| 27 | 27 | use OCP\Encryption\Exceptions\GenericEncryptionException; |
| 28 | 28 | |
| 29 | -class EmptyEncryptionDataException extends GenericEncryptionException{ |
|
| 29 | +class EmptyEncryptionDataException extends GenericEncryptionException { |
|
| 30 | 30 | |
| 31 | 31 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $this->output = $output; |
| 86 | 86 | |
| 87 | 87 | if ($user !== '' && $this->userManager->userExists($user) === false) { |
| 88 | - $this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again'); |
|
| 88 | + $this->output->writeln('User "'.$user.'" does not exist. Please check the username and try again'); |
|
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $this->output->writeln('Files for following users couldn\'t be decrypted, '); |
| 104 | 104 | $this->output->writeln('maybe the user is not set up in a way that supports this operation: '); |
| 105 | 105 | foreach ($this->failed as $uid => $paths) { |
| 106 | - $this->output->writeln(' ' . $uid); |
|
| 106 | + $this->output->writeln(' '.$uid); |
|
| 107 | 107 | } |
| 108 | 108 | $this->output->writeln(''); |
| 109 | 109 | } |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | /** @var IEncryptionModule $module */ |
| 125 | 125 | $module = call_user_func($moduleDesc['callback']); |
| 126 | 126 | $this->output->writeln(''); |
| 127 | - $this->output->writeln('Prepare "' . $module->getDisplayName() . '"'); |
|
| 127 | + $this->output->writeln('Prepare "'.$module->getDisplayName().'"'); |
|
| 128 | 128 | $this->output->writeln(''); |
| 129 | 129 | if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) { |
| 130 | - $this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!'); |
|
| 130 | + $this->output->writeln('Module "'.$moduleDesc['displayName'].'" does not support the functionality to decrypt all files again or the initialization of the module failed!'); |
|
| 131 | 131 | return false; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -205,16 +205,16 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | $this->setupUserFS($uid); |
| 207 | 207 | $directories = array(); |
| 208 | - $directories[] = '/' . $uid . '/files'; |
|
| 208 | + $directories[] = '/'.$uid.'/files'; |
|
| 209 | 209 | |
| 210 | 210 | while ($root = array_pop($directories)) { |
| 211 | 211 | $content = $this->rootView->getDirectoryContent($root); |
| 212 | 212 | foreach ($content as $file) { |
| 213 | 213 | // only decrypt files owned by the user |
| 214 | - if($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) { |
|
| 214 | + if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) { |
|
| 215 | 215 | continue; |
| 216 | 216 | } |
| 217 | - $path = $root . '/' . $file['name']; |
|
| 217 | + $path = $root.'/'.$file['name']; |
|
| 218 | 218 | if ($this->rootView->is_dir($path)) { |
| 219 | 219 | $directories[] = $path; |
| 220 | 220 | continue; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | protected function decryptFile($path) { |
| 253 | 253 | |
| 254 | 254 | $source = $path; |
| 255 | - $target = $path . '.decrypted.' . $this->getTimestamp(); |
|
| 255 | + $target = $path.'.decrypted.'.$this->getTimestamp(); |
|
| 256 | 256 | |
| 257 | 257 | try { |
| 258 | 258 | $this->rootView->copy($source, $target); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | // always add owner to the list of users with access to the file |
| 59 | 59 | $userIds = array($owner); |
| 60 | 60 | |
| 61 | - if (!$this->util->isFile($owner . '/' . $ownerPath)) { |
|
| 61 | + if (!$this->util->isFile($owner.'/'.$ownerPath)) { |
|
| 62 | 62 | return array('users' => $userIds, 'public' => false); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -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 | } |