@@ -33,151 +33,151 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | interface IStorage { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * get user specific key |
|
| 38 | - * |
|
| 39 | - * @param string $uid ID if the user for whom we want the key |
|
| 40 | - * @param string $keyId id of the key |
|
| 41 | - * @param string $encryptionModuleId |
|
| 42 | - * |
|
| 43 | - * @return mixed key |
|
| 44 | - * @since 8.1.0 |
|
| 45 | - */ |
|
| 46 | - public function getUserKey($uid, $keyId, $encryptionModuleId); |
|
| 36 | + /** |
|
| 37 | + * get user specific key |
|
| 38 | + * |
|
| 39 | + * @param string $uid ID if the user for whom we want the key |
|
| 40 | + * @param string $keyId id of the key |
|
| 41 | + * @param string $encryptionModuleId |
|
| 42 | + * |
|
| 43 | + * @return mixed key |
|
| 44 | + * @since 8.1.0 |
|
| 45 | + */ |
|
| 46 | + public function getUserKey($uid, $keyId, $encryptionModuleId); |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * get file specific key |
|
| 50 | - * |
|
| 51 | - * @param string $path path to file |
|
| 52 | - * @param string $keyId id of the key |
|
| 53 | - * @param string $encryptionModuleId |
|
| 54 | - * |
|
| 55 | - * @return mixed key |
|
| 56 | - * @since 8.1.0 |
|
| 57 | - */ |
|
| 58 | - public function getFileKey($path, $keyId, $encryptionModuleId); |
|
| 48 | + /** |
|
| 49 | + * get file specific key |
|
| 50 | + * |
|
| 51 | + * @param string $path path to file |
|
| 52 | + * @param string $keyId id of the key |
|
| 53 | + * @param string $encryptionModuleId |
|
| 54 | + * |
|
| 55 | + * @return mixed key |
|
| 56 | + * @since 8.1.0 |
|
| 57 | + */ |
|
| 58 | + public function getFileKey($path, $keyId, $encryptionModuleId); |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * get system-wide encryption keys not related to a specific user, |
|
| 62 | - * e.g something like a key for public link shares |
|
| 63 | - * |
|
| 64 | - * @param string $keyId id of the key |
|
| 65 | - * @param string $encryptionModuleId |
|
| 66 | - * |
|
| 67 | - * @return mixed key |
|
| 68 | - * @since 8.1.0 |
|
| 69 | - */ |
|
| 70 | - public function getSystemUserKey($keyId, $encryptionModuleId); |
|
| 60 | + /** |
|
| 61 | + * get system-wide encryption keys not related to a specific user, |
|
| 62 | + * e.g something like a key for public link shares |
|
| 63 | + * |
|
| 64 | + * @param string $keyId id of the key |
|
| 65 | + * @param string $encryptionModuleId |
|
| 66 | + * |
|
| 67 | + * @return mixed key |
|
| 68 | + * @since 8.1.0 |
|
| 69 | + */ |
|
| 70 | + public function getSystemUserKey($keyId, $encryptionModuleId); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * set user specific key |
|
| 74 | - * |
|
| 75 | - * @param string $uid ID if the user for whom we want the key |
|
| 76 | - * @param string $keyId id of the key |
|
| 77 | - * @param mixed $key |
|
| 78 | - * @param string $encryptionModuleId |
|
| 79 | - * @since 8.1.0 |
|
| 80 | - */ |
|
| 81 | - public function setUserKey($uid, $keyId, $key, $encryptionModuleId); |
|
| 72 | + /** |
|
| 73 | + * set user specific key |
|
| 74 | + * |
|
| 75 | + * @param string $uid ID if the user for whom we want the key |
|
| 76 | + * @param string $keyId id of the key |
|
| 77 | + * @param mixed $key |
|
| 78 | + * @param string $encryptionModuleId |
|
| 79 | + * @since 8.1.0 |
|
| 80 | + */ |
|
| 81 | + public function setUserKey($uid, $keyId, $key, $encryptionModuleId); |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * set file specific key |
|
| 85 | - * |
|
| 86 | - * @param string $path path to file |
|
| 87 | - * @param string $keyId id of the key |
|
| 88 | - * @param mixed $key |
|
| 89 | - * @param string $encryptionModuleId |
|
| 90 | - * @since 8.1.0 |
|
| 91 | - */ |
|
| 92 | - public function setFileKey($path, $keyId, $key, $encryptionModuleId); |
|
| 83 | + /** |
|
| 84 | + * set file specific key |
|
| 85 | + * |
|
| 86 | + * @param string $path path to file |
|
| 87 | + * @param string $keyId id of the key |
|
| 88 | + * @param mixed $key |
|
| 89 | + * @param string $encryptionModuleId |
|
| 90 | + * @since 8.1.0 |
|
| 91 | + */ |
|
| 92 | + public function setFileKey($path, $keyId, $key, $encryptionModuleId); |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * set system-wide encryption keys not related to a specific user, |
|
| 96 | - * e.g something like a key for public link shares |
|
| 97 | - * |
|
| 98 | - * @param string $keyId id of the key |
|
| 99 | - * @param mixed $key |
|
| 100 | - * @param string $encryptionModuleId |
|
| 101 | - * |
|
| 102 | - * @return mixed key |
|
| 103 | - * @since 8.1.0 |
|
| 104 | - */ |
|
| 105 | - public function setSystemUserKey($keyId, $key, $encryptionModuleId); |
|
| 94 | + /** |
|
| 95 | + * set system-wide encryption keys not related to a specific user, |
|
| 96 | + * e.g something like a key for public link shares |
|
| 97 | + * |
|
| 98 | + * @param string $keyId id of the key |
|
| 99 | + * @param mixed $key |
|
| 100 | + * @param string $encryptionModuleId |
|
| 101 | + * |
|
| 102 | + * @return mixed key |
|
| 103 | + * @since 8.1.0 |
|
| 104 | + */ |
|
| 105 | + public function setSystemUserKey($keyId, $key, $encryptionModuleId); |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * delete user specific key |
|
| 109 | - * |
|
| 110 | - * @param string $uid ID if the user for whom we want to delete the key |
|
| 111 | - * @param string $keyId id of the key |
|
| 112 | - * @param string $encryptionModuleId |
|
| 113 | - * |
|
| 114 | - * @return boolean False when the key could not be deleted |
|
| 115 | - * @since 8.1.0 |
|
| 116 | - */ |
|
| 117 | - public function deleteUserKey($uid, $keyId, $encryptionModuleId); |
|
| 107 | + /** |
|
| 108 | + * delete user specific key |
|
| 109 | + * |
|
| 110 | + * @param string $uid ID if the user for whom we want to delete the key |
|
| 111 | + * @param string $keyId id of the key |
|
| 112 | + * @param string $encryptionModuleId |
|
| 113 | + * |
|
| 114 | + * @return boolean False when the key could not be deleted |
|
| 115 | + * @since 8.1.0 |
|
| 116 | + */ |
|
| 117 | + public function deleteUserKey($uid, $keyId, $encryptionModuleId); |
|
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * delete file specific key |
|
| 121 | - * |
|
| 122 | - * @param string $path path to file |
|
| 123 | - * @param string $keyId id of the key |
|
| 124 | - * @param string $encryptionModuleId |
|
| 125 | - * |
|
| 126 | - * @return boolean False when the key could not be deleted |
|
| 127 | - * @since 8.1.0 |
|
| 128 | - */ |
|
| 129 | - public function deleteFileKey($path, $keyId, $encryptionModuleId); |
|
| 119 | + /** |
|
| 120 | + * delete file specific key |
|
| 121 | + * |
|
| 122 | + * @param string $path path to file |
|
| 123 | + * @param string $keyId id of the key |
|
| 124 | + * @param string $encryptionModuleId |
|
| 125 | + * |
|
| 126 | + * @return boolean False when the key could not be deleted |
|
| 127 | + * @since 8.1.0 |
|
| 128 | + */ |
|
| 129 | + public function deleteFileKey($path, $keyId, $encryptionModuleId); |
|
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * delete all file keys for a given file |
|
| 133 | - * |
|
| 134 | - * @param string $path to the file |
|
| 135 | - * |
|
| 136 | - * @return boolean False when the keys could not be deleted |
|
| 137 | - * @since 8.1.0 |
|
| 138 | - */ |
|
| 139 | - public function deleteAllFileKeys($path); |
|
| 131 | + /** |
|
| 132 | + * delete all file keys for a given file |
|
| 133 | + * |
|
| 134 | + * @param string $path to the file |
|
| 135 | + * |
|
| 136 | + * @return boolean False when the keys could not be deleted |
|
| 137 | + * @since 8.1.0 |
|
| 138 | + */ |
|
| 139 | + public function deleteAllFileKeys($path); |
|
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * delete system-wide encryption keys not related to a specific user, |
|
| 143 | - * e.g something like a key for public link shares |
|
| 144 | - * |
|
| 145 | - * @param string $keyId id of the key |
|
| 146 | - * @param string $encryptionModuleId |
|
| 147 | - * |
|
| 148 | - * @return boolean False when the key could not be deleted |
|
| 149 | - * @since 8.1.0 |
|
| 150 | - */ |
|
| 151 | - public function deleteSystemUserKey($keyId, $encryptionModuleId); |
|
| 141 | + /** |
|
| 142 | + * delete system-wide encryption keys not related to a specific user, |
|
| 143 | + * e.g something like a key for public link shares |
|
| 144 | + * |
|
| 145 | + * @param string $keyId id of the key |
|
| 146 | + * @param string $encryptionModuleId |
|
| 147 | + * |
|
| 148 | + * @return boolean False when the key could not be deleted |
|
| 149 | + * @since 8.1.0 |
|
| 150 | + */ |
|
| 151 | + public function deleteSystemUserKey($keyId, $encryptionModuleId); |
|
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * copy keys if a file was renamed |
|
| 155 | - * |
|
| 156 | - * @param string $source |
|
| 157 | - * @param string $target |
|
| 158 | - * @return boolean |
|
| 159 | - * @since 8.1.0 |
|
| 160 | - */ |
|
| 161 | - public function renameKeys($source, $target); |
|
| 153 | + /** |
|
| 154 | + * copy keys if a file was renamed |
|
| 155 | + * |
|
| 156 | + * @param string $source |
|
| 157 | + * @param string $target |
|
| 158 | + * @return boolean |
|
| 159 | + * @since 8.1.0 |
|
| 160 | + */ |
|
| 161 | + public function renameKeys($source, $target); |
|
| 162 | 162 | |
| 163 | - /** |
|
| 164 | - * move keys if a file was renamed |
|
| 165 | - * |
|
| 166 | - * @param string $source |
|
| 167 | - * @param string $target |
|
| 168 | - * @return boolean |
|
| 169 | - * @since 8.1.0 |
|
| 170 | - */ |
|
| 171 | - public function copyKeys($source, $target); |
|
| 163 | + /** |
|
| 164 | + * move keys if a file was renamed |
|
| 165 | + * |
|
| 166 | + * @param string $source |
|
| 167 | + * @param string $target |
|
| 168 | + * @return boolean |
|
| 169 | + * @since 8.1.0 |
|
| 170 | + */ |
|
| 171 | + public function copyKeys($source, $target); |
|
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * backup keys of a given encryption module |
|
| 175 | - * |
|
| 176 | - * @param string $encryptionModuleId |
|
| 177 | - * @param string $purpose |
|
| 178 | - * @param string $uid |
|
| 179 | - * @return bool |
|
| 180 | - * @since 12.0.0 |
|
| 181 | - */ |
|
| 182 | - public function backupUserKeys($encryptionModuleId, $purpose, $uid); |
|
| 173 | + /** |
|
| 174 | + * backup keys of a given encryption module |
|
| 175 | + * |
|
| 176 | + * @param string $encryptionModuleId |
|
| 177 | + * @param string $purpose |
|
| 178 | + * @param string $uid |
|
| 179 | + * @return bool |
|
| 180 | + * @since 12.0.0 |
|
| 181 | + */ |
|
| 182 | + public function backupUserKeys($encryptionModuleId, $purpose, $uid); |
|
| 183 | 183 | } |
@@ -28,45 +28,45 @@ |
||
| 28 | 28 | |
| 29 | 29 | class Credentials implements ICredentials { |
| 30 | 30 | |
| 31 | - /** @var string */ |
|
| 32 | - private $uid; |
|
| 31 | + /** @var string */ |
|
| 32 | + private $uid; |
|
| 33 | 33 | |
| 34 | - /** @var string */ |
|
| 35 | - private $loginName; |
|
| 34 | + /** @var string */ |
|
| 35 | + private $loginName; |
|
| 36 | 36 | |
| 37 | - /** @var string */ |
|
| 38 | - private $password; |
|
| 37 | + /** @var string */ |
|
| 38 | + private $password; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param string $uid |
|
| 42 | - * @param string $loginName |
|
| 43 | - * @param string $password |
|
| 44 | - */ |
|
| 45 | - public function __construct($uid, $loginName, $password) { |
|
| 46 | - $this->uid = $uid; |
|
| 47 | - $this->loginName = $loginName; |
|
| 48 | - $this->password = $password; |
|
| 49 | - } |
|
| 40 | + /** |
|
| 41 | + * @param string $uid |
|
| 42 | + * @param string $loginName |
|
| 43 | + * @param string $password |
|
| 44 | + */ |
|
| 45 | + public function __construct($uid, $loginName, $password) { |
|
| 46 | + $this->uid = $uid; |
|
| 47 | + $this->loginName = $loginName; |
|
| 48 | + $this->password = $password; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 54 | - public function getUID() { |
|
| 55 | - return $this->uid; |
|
| 56 | - } |
|
| 51 | + /** |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | + public function getUID() { |
|
| 55 | + return $this->uid; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 61 | - public function getLoginName() { |
|
| 62 | - return $this->loginName; |
|
| 63 | - } |
|
| 58 | + /** |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | + public function getLoginName() { |
|
| 62 | + return $this->loginName; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @return string |
|
| 67 | - */ |
|
| 68 | - public function getPassword() { |
|
| 69 | - return $this->password; |
|
| 70 | - } |
|
| 65 | + /** |
|
| 66 | + * @return string |
|
| 67 | + */ |
|
| 68 | + public function getPassword() { |
|
| 69 | + return $this->password; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | } |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public function getBody() { |
| 56 | 56 | return $this->stream ? |
| 57 | - $this->response->getBody()->detach(): |
|
| 58 | - $this->response->getBody()->getContents(); |
|
| 57 | + $this->response->getBody()->detach() : $this->response->getBody()->getContents(); |
|
| 59 | 58 | } |
| 60 | 59 | |
| 61 | 60 | /** |
@@ -33,57 +33,57 @@ |
||
| 33 | 33 | * @package OC\Http |
| 34 | 34 | */ |
| 35 | 35 | class Response implements IResponse { |
| 36 | - /** @var ResponseInterface */ |
|
| 37 | - private $response; |
|
| 36 | + /** @var ResponseInterface */ |
|
| 37 | + private $response; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var bool |
|
| 41 | - */ |
|
| 42 | - private $stream; |
|
| 39 | + /** |
|
| 40 | + * @var bool |
|
| 41 | + */ |
|
| 42 | + private $stream; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @param ResponseInterface $response |
|
| 46 | - * @param bool $stream |
|
| 47 | - */ |
|
| 48 | - public function __construct(ResponseInterface $response, $stream = false) { |
|
| 49 | - $this->response = $response; |
|
| 50 | - $this->stream = $stream; |
|
| 51 | - } |
|
| 44 | + /** |
|
| 45 | + * @param ResponseInterface $response |
|
| 46 | + * @param bool $stream |
|
| 47 | + */ |
|
| 48 | + public function __construct(ResponseInterface $response, $stream = false) { |
|
| 49 | + $this->response = $response; |
|
| 50 | + $this->stream = $stream; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @return string|resource |
|
| 55 | - */ |
|
| 56 | - public function getBody() { |
|
| 57 | - return $this->stream ? |
|
| 58 | - $this->response->getBody()->detach(): |
|
| 59 | - $this->response->getBody()->getContents(); |
|
| 60 | - } |
|
| 53 | + /** |
|
| 54 | + * @return string|resource |
|
| 55 | + */ |
|
| 56 | + public function getBody() { |
|
| 57 | + return $this->stream ? |
|
| 58 | + $this->response->getBody()->detach(): |
|
| 59 | + $this->response->getBody()->getContents(); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @return int |
|
| 64 | - */ |
|
| 65 | - public function getStatusCode(): int { |
|
| 66 | - return $this->response->getStatusCode(); |
|
| 67 | - } |
|
| 62 | + /** |
|
| 63 | + * @return int |
|
| 64 | + */ |
|
| 65 | + public function getStatusCode(): int { |
|
| 66 | + return $this->response->getStatusCode(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @param string $key |
|
| 71 | - * @return string |
|
| 72 | - */ |
|
| 73 | - public function getHeader(string $key): string { |
|
| 74 | - $headers = $this->response->getHeader($key); |
|
| 69 | + /** |
|
| 70 | + * @param string $key |
|
| 71 | + * @return string |
|
| 72 | + */ |
|
| 73 | + public function getHeader(string $key): string { |
|
| 74 | + $headers = $this->response->getHeader($key); |
|
| 75 | 75 | |
| 76 | - if (count($headers) === 0) { |
|
| 77 | - return ''; |
|
| 78 | - } |
|
| 76 | + if (count($headers) === 0) { |
|
| 77 | + return ''; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - return $headers[0]; |
|
| 81 | - } |
|
| 80 | + return $headers[0]; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * @return array |
|
| 85 | - */ |
|
| 86 | - public function getHeaders(): array { |
|
| 87 | - return $this->response->getHeaders(); |
|
| 88 | - } |
|
| 83 | + /** |
|
| 84 | + * @return array |
|
| 85 | + */ |
|
| 86 | + public function getHeaders(): array { |
|
| 87 | + return $this->response->getHeaders(); |
|
| 88 | + } |
|
| 89 | 89 | } |
@@ -25,14 +25,14 @@ |
||
| 25 | 25 | namespace OC; |
| 26 | 26 | |
| 27 | 27 | class NaturalSort_DefaultCollator { |
| 28 | - public function compare($a, $b) { |
|
| 29 | - $result = strcasecmp($a, $b); |
|
| 30 | - if ($result === 0) { |
|
| 31 | - if ($a === $b) { |
|
| 32 | - return 0; |
|
| 33 | - } |
|
| 34 | - return ($a > $b) ? -1 : 1; |
|
| 35 | - } |
|
| 36 | - return ($result < 0) ? -1 : 1; |
|
| 37 | - } |
|
| 28 | + public function compare($a, $b) { |
|
| 29 | + $result = strcasecmp($a, $b); |
|
| 30 | + if ($result === 0) { |
|
| 31 | + if ($a === $b) { |
|
| 32 | + return 0; |
|
| 33 | + } |
|
| 34 | + return ($a > $b) ? -1 : 1; |
|
| 35 | + } |
|
| 36 | + return ($result < 0) ? -1 : 1; |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -25,12 +25,12 @@ |
||
| 25 | 25 | use OC\BackgroundJob\QueuedJob; |
| 26 | 26 | |
| 27 | 27 | class CallableJob extends QueuedJob { |
| 28 | - protected function run($serializedCallable) { |
|
| 29 | - $callable = unserialize($serializedCallable); |
|
| 30 | - if (is_callable($callable)) { |
|
| 31 | - $callable(); |
|
| 32 | - } else { |
|
| 33 | - throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 34 | - } |
|
| 35 | - } |
|
| 28 | + protected function run($serializedCallable) { |
|
| 29 | + $callable = unserialize($serializedCallable); |
|
| 30 | + if (is_callable($callable)) { |
|
| 31 | + $callable(); |
|
| 32 | + } else { |
|
| 33 | + throw new \InvalidArgumentException('Invalid serialized callable'); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -29,12 +29,12 @@ |
||
| 29 | 29 | * Wrap a command in the background job interface |
| 30 | 30 | */ |
| 31 | 31 | class CommandJob extends QueuedJob { |
| 32 | - protected function run($serializedCommand) { |
|
| 33 | - $command = unserialize($serializedCommand); |
|
| 34 | - if ($command instanceof ICommand) { |
|
| 35 | - $command->handle(); |
|
| 36 | - } else { |
|
| 37 | - throw new \InvalidArgumentException('Invalid serialized command'); |
|
| 38 | - } |
|
| 39 | - } |
|
| 32 | + protected function run($serializedCommand) { |
|
| 33 | + $command = unserialize($serializedCommand); |
|
| 34 | + if ($command instanceof ICommand) { |
|
| 35 | + $command->handle(); |
|
| 36 | + } else { |
|
| 37 | + throw new \InvalidArgumentException('Invalid serialized command'); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -24,23 +24,23 @@ |
||
| 24 | 24 | namespace OC\Template; |
| 25 | 25 | |
| 26 | 26 | class ResourceNotFoundException extends \LogicException { |
| 27 | - protected $resource; |
|
| 28 | - protected $webPath; |
|
| 27 | + protected $resource; |
|
| 28 | + protected $webPath; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @param string $resource |
|
| 32 | - * @param string $webPath |
|
| 33 | - */ |
|
| 34 | - public function __construct($resource, $webPath) { |
|
| 35 | - parent::__construct('Resource not found'); |
|
| 36 | - $this->resource = $resource; |
|
| 37 | - $this->webPath = $webPath; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * @param string $resource |
|
| 32 | + * @param string $webPath |
|
| 33 | + */ |
|
| 34 | + public function __construct($resource, $webPath) { |
|
| 35 | + parent::__construct('Resource not found'); |
|
| 36 | + $this->resource = $resource; |
|
| 37 | + $this->webPath = $webPath; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function getResourcePath() { |
|
| 44 | - return $this->webPath . '/' . $this->resource; |
|
| 45 | - } |
|
| 40 | + /** |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function getResourcePath() { |
|
| 44 | + return $this->webPath . '/' . $this->resource; |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | 43 | public function getResourcePath() { |
| 44 | - return $this->webPath . '/' . $this->resource; |
|
| 44 | + return $this->webPath.'/'.$this->resource; |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -23,35 +23,35 @@ |
||
| 23 | 23 | namespace OC\Memcache; |
| 24 | 24 | |
| 25 | 25 | trait CASTrait { |
| 26 | - abstract public function get($key); |
|
| 26 | + abstract public function get($key); |
|
| 27 | 27 | |
| 28 | - abstract public function set($key, $value, $ttl = 0); |
|
| 28 | + abstract public function set($key, $value, $ttl = 0); |
|
| 29 | 29 | |
| 30 | - abstract public function remove($key); |
|
| 30 | + abstract public function remove($key); |
|
| 31 | 31 | |
| 32 | - abstract public function add($key, $value, $ttl = 0); |
|
| 32 | + abstract public function add($key, $value, $ttl = 0); |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Compare and set |
|
| 36 | - * |
|
| 37 | - * @param string $key |
|
| 38 | - * @param mixed $old |
|
| 39 | - * @param mixed $new |
|
| 40 | - * @return bool |
|
| 41 | - */ |
|
| 42 | - public function cas($key, $old, $new) { |
|
| 43 | - //no native cas, emulate with locking |
|
| 44 | - if ($this->add($key . '_lock', true)) { |
|
| 45 | - if ($this->get($key) === $old) { |
|
| 46 | - $this->set($key, $new); |
|
| 47 | - $this->remove($key . '_lock'); |
|
| 48 | - return true; |
|
| 49 | - } else { |
|
| 50 | - $this->remove($key . '_lock'); |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 53 | - } else { |
|
| 54 | - return false; |
|
| 55 | - } |
|
| 56 | - } |
|
| 34 | + /** |
|
| 35 | + * Compare and set |
|
| 36 | + * |
|
| 37 | + * @param string $key |
|
| 38 | + * @param mixed $old |
|
| 39 | + * @param mixed $new |
|
| 40 | + * @return bool |
|
| 41 | + */ |
|
| 42 | + public function cas($key, $old, $new) { |
|
| 43 | + //no native cas, emulate with locking |
|
| 44 | + if ($this->add($key . '_lock', true)) { |
|
| 45 | + if ($this->get($key) === $old) { |
|
| 46 | + $this->set($key, $new); |
|
| 47 | + $this->remove($key . '_lock'); |
|
| 48 | + return true; |
|
| 49 | + } else { |
|
| 50 | + $this->remove($key . '_lock'); |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | + } else { |
|
| 54 | + return false; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | 57 | } |
@@ -41,13 +41,13 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function cas($key, $old, $new) { |
| 43 | 43 | //no native cas, emulate with locking |
| 44 | - if ($this->add($key . '_lock', true)) { |
|
| 44 | + if ($this->add($key.'_lock', true)) { |
|
| 45 | 45 | if ($this->get($key) === $old) { |
| 46 | 46 | $this->set($key, $new); |
| 47 | - $this->remove($key . '_lock'); |
|
| 47 | + $this->remove($key.'_lock'); |
|
| 48 | 48 | return true; |
| 49 | 49 | } else { |
| 50 | - $this->remove($key . '_lock'); |
|
| 50 | + $this->remove($key.'_lock'); |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | } else { |
@@ -23,32 +23,32 @@ |
||
| 23 | 23 | namespace OC\Memcache; |
| 24 | 24 | |
| 25 | 25 | trait CADTrait { |
| 26 | - abstract public function get($key); |
|
| 26 | + abstract public function get($key); |
|
| 27 | 27 | |
| 28 | - abstract public function remove($key); |
|
| 28 | + abstract public function remove($key); |
|
| 29 | 29 | |
| 30 | - abstract public function add($key, $value, $ttl = 0); |
|
| 30 | + abstract public function add($key, $value, $ttl = 0); |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Compare and delete |
|
| 34 | - * |
|
| 35 | - * @param string $key |
|
| 36 | - * @param mixed $old |
|
| 37 | - * @return bool |
|
| 38 | - */ |
|
| 39 | - public function cad($key, $old) { |
|
| 40 | - //no native cas, emulate with locking |
|
| 41 | - if ($this->add($key . '_lock', true)) { |
|
| 42 | - if ($this->get($key) === $old) { |
|
| 43 | - $this->remove($key); |
|
| 44 | - $this->remove($key . '_lock'); |
|
| 45 | - return true; |
|
| 46 | - } else { |
|
| 47 | - $this->remove($key . '_lock'); |
|
| 48 | - return false; |
|
| 49 | - } |
|
| 50 | - } else { |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 53 | - } |
|
| 32 | + /** |
|
| 33 | + * Compare and delete |
|
| 34 | + * |
|
| 35 | + * @param string $key |
|
| 36 | + * @param mixed $old |
|
| 37 | + * @return bool |
|
| 38 | + */ |
|
| 39 | + public function cad($key, $old) { |
|
| 40 | + //no native cas, emulate with locking |
|
| 41 | + if ($this->add($key . '_lock', true)) { |
|
| 42 | + if ($this->get($key) === $old) { |
|
| 43 | + $this->remove($key); |
|
| 44 | + $this->remove($key . '_lock'); |
|
| 45 | + return true; |
|
| 46 | + } else { |
|
| 47 | + $this->remove($key . '_lock'); |
|
| 48 | + return false; |
|
| 49 | + } |
|
| 50 | + } else { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -38,13 +38,13 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function cad($key, $old) { |
| 40 | 40 | //no native cas, emulate with locking |
| 41 | - if ($this->add($key . '_lock', true)) { |
|
| 41 | + if ($this->add($key.'_lock', true)) { |
|
| 42 | 42 | if ($this->get($key) === $old) { |
| 43 | 43 | $this->remove($key); |
| 44 | - $this->remove($key . '_lock'); |
|
| 44 | + $this->remove($key.'_lock'); |
|
| 45 | 45 | return true; |
| 46 | 46 | } else { |
| 47 | - $this->remove($key . '_lock'); |
|
| 47 | + $this->remove($key.'_lock'); |
|
| 48 | 48 | return false; |
| 49 | 49 | } |
| 50 | 50 | } else { |