@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function get($key) { |
| 100 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
| 100 | + $result = self::$cache->get($this->getNameSpace().$key); |
|
| 101 | 101 | if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
| 102 | 102 | return null; |
| 103 | 103 | } else { |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | public function set($key, $value, $ttl = 0) { |
| 109 | 109 | if ($ttl > 0) { |
| 110 | - $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
| 110 | + $result = self::$cache->set($this->getNameSpace().$key, $value, $ttl); |
|
| 111 | 111 | } else { |
| 112 | - $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
| 112 | + $result = self::$cache->set($this->getNameSpace().$key, $value); |
|
| 113 | 113 | } |
| 114 | 114 | if ($result !== true) { |
| 115 | 115 | $this->verifyReturnCode(); |
@@ -118,12 +118,12 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | public function hasKey($key) { |
| 121 | - self::$cache->get($this->getNameSpace() . $key); |
|
| 121 | + self::$cache->get($this->getNameSpace().$key); |
|
| 122 | 122 | return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function remove($key) { |
| 126 | - $result= self::$cache->delete($this->getNameSpace() . $key); |
|
| 126 | + $result = self::$cache->delete($this->getNameSpace().$key); |
|
| 127 | 127 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
| 128 | 128 | $this->verifyReturnCode(); |
| 129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function clear($prefix = '') { |
| 134 | - $prefix = $this->getNameSpace() . $prefix; |
|
| 134 | + $prefix = $this->getNameSpace().$prefix; |
|
| 135 | 135 | $allKeys = self::$cache->getAllKeys(); |
| 136 | 136 | if ($allKeys === false) { |
| 137 | 137 | // newer Memcached doesn't like getAllKeys(), flush everything |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @throws \Exception |
| 166 | 166 | */ |
| 167 | 167 | public function add($key, $value, $ttl = 0) { |
| 168 | - $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
| 168 | + $result = self::$cache->add($this->getPrefix().$key, $value, $ttl); |
|
| 169 | 169 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
| 170 | 170 | $this->verifyReturnCode(); |
| 171 | 171 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function inc($key, $step = 1) { |
| 183 | 183 | $this->add($key, 0); |
| 184 | - $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
| 184 | + $result = self::$cache->increment($this->getPrefix().$key, $step); |
|
| 185 | 185 | |
| 186 | 186 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
| 187 | 187 | return false; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return int | bool |
| 199 | 199 | */ |
| 200 | 200 | public function dec($key, $step = 1) { |
| 201 | - $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
| 201 | + $result = self::$cache->decrement($this->getPrefix().$key, $step); |
|
| 202 | 202 | |
| 203 | 203 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
| 204 | 204 | return false; |
@@ -36,193 +36,193 @@ |
||
| 36 | 36 | use OCP\IMemcache; |
| 37 | 37 | |
| 38 | 38 | class Memcached extends Cache implements IMemcache { |
| 39 | - use CASTrait; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @var \Memcached $cache |
|
| 43 | - */ |
|
| 44 | - private static $cache = null; |
|
| 45 | - |
|
| 46 | - use CADTrait; |
|
| 47 | - |
|
| 48 | - public function __construct($prefix = '') { |
|
| 49 | - parent::__construct($prefix); |
|
| 50 | - if (is_null(self::$cache)) { |
|
| 51 | - self::$cache = new \Memcached(); |
|
| 52 | - |
|
| 53 | - $defaultOptions = [ |
|
| 54 | - \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
| 55 | - \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
| 56 | - \Memcached::OPT_SEND_TIMEOUT => 50, |
|
| 57 | - \Memcached::OPT_RECV_TIMEOUT => 50, |
|
| 58 | - \Memcached::OPT_POLL_TIMEOUT => 50, |
|
| 59 | - |
|
| 60 | - // Enable compression |
|
| 61 | - \Memcached::OPT_COMPRESSION => true, |
|
| 62 | - |
|
| 63 | - // Turn on consistent hashing |
|
| 64 | - \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
| 65 | - |
|
| 66 | - // Enable Binary Protocol |
|
| 67 | - //\Memcached::OPT_BINARY_PROTOCOL => true, |
|
| 68 | - ]; |
|
| 69 | - // by default enable igbinary serializer if available |
|
| 70 | - if (\Memcached::HAVE_IGBINARY) { |
|
| 71 | - $defaultOptions[\Memcached::OPT_SERIALIZER] = |
|
| 72 | - \Memcached::SERIALIZER_IGBINARY; |
|
| 73 | - } |
|
| 74 | - $options = \OC::$server->getConfig()->getSystemValue('memcached_options', []); |
|
| 75 | - if (is_array($options)) { |
|
| 76 | - $options = $options + $defaultOptions; |
|
| 77 | - self::$cache->setOptions($options); |
|
| 78 | - } else { |
|
| 79 | - throw new HintException("Expected 'memcached_options' config to be an array, got $options"); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers'); |
|
| 83 | - if (!$servers) { |
|
| 84 | - $server = \OC::$server->getSystemConfig()->getValue('memcached_server'); |
|
| 85 | - if ($server) { |
|
| 86 | - $servers = [$server]; |
|
| 87 | - } else { |
|
| 88 | - $servers = [['localhost', 11211]]; |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - self::$cache->addServers($servers); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * entries in XCache gets namespaced to prevent collisions between owncloud instances and users |
|
| 97 | - */ |
|
| 98 | - protected function getNameSpace() { |
|
| 99 | - return $this->prefix; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - public function get($key) { |
|
| 103 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
| 104 | - if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
|
| 105 | - return null; |
|
| 106 | - } else { |
|
| 107 | - return $result; |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - public function set($key, $value, $ttl = 0) { |
|
| 112 | - if ($ttl > 0) { |
|
| 113 | - $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
| 114 | - } else { |
|
| 115 | - $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
| 116 | - } |
|
| 117 | - if ($result !== true) { |
|
| 118 | - $this->verifyReturnCode(); |
|
| 119 | - } |
|
| 120 | - return $result; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - public function hasKey($key) { |
|
| 124 | - self::$cache->get($this->getNameSpace() . $key); |
|
| 125 | - return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - public function remove($key) { |
|
| 129 | - $result= self::$cache->delete($this->getNameSpace() . $key); |
|
| 130 | - if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
|
| 131 | - $this->verifyReturnCode(); |
|
| 132 | - } |
|
| 133 | - return $result; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - public function clear($prefix = '') { |
|
| 137 | - $prefix = $this->getNameSpace() . $prefix; |
|
| 138 | - $allKeys = self::$cache->getAllKeys(); |
|
| 139 | - if ($allKeys === false) { |
|
| 140 | - // newer Memcached doesn't like getAllKeys(), flush everything |
|
| 141 | - self::$cache->flush(); |
|
| 142 | - return true; |
|
| 143 | - } |
|
| 144 | - $keys = []; |
|
| 145 | - $prefixLength = strlen($prefix); |
|
| 146 | - foreach ($allKeys as $key) { |
|
| 147 | - if (substr($key, 0, $prefixLength) === $prefix) { |
|
| 148 | - $keys[] = $key; |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - if (method_exists(self::$cache, 'deleteMulti')) { |
|
| 152 | - self::$cache->deleteMulti($keys); |
|
| 153 | - } else { |
|
| 154 | - foreach ($keys as $key) { |
|
| 155 | - self::$cache->delete($key); |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - return true; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Set a value in the cache if it's not already stored |
|
| 163 | - * |
|
| 164 | - * @param string $key |
|
| 165 | - * @param mixed $value |
|
| 166 | - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
| 167 | - * @return bool |
|
| 168 | - * @throws \Exception |
|
| 169 | - */ |
|
| 170 | - public function add($key, $value, $ttl = 0) { |
|
| 171 | - $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
| 172 | - if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
|
| 173 | - $this->verifyReturnCode(); |
|
| 174 | - } |
|
| 175 | - return $result; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * Increase a stored number |
|
| 180 | - * |
|
| 181 | - * @param string $key |
|
| 182 | - * @param int $step |
|
| 183 | - * @return int | bool |
|
| 184 | - */ |
|
| 185 | - public function inc($key, $step = 1) { |
|
| 186 | - $this->add($key, 0); |
|
| 187 | - $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
| 188 | - |
|
| 189 | - if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 190 | - return false; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - return $result; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Decrease a stored number |
|
| 198 | - * |
|
| 199 | - * @param string $key |
|
| 200 | - * @param int $step |
|
| 201 | - * @return int | bool |
|
| 202 | - */ |
|
| 203 | - public function dec($key, $step = 1) { |
|
| 204 | - $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
| 205 | - |
|
| 206 | - if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 207 | - return false; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - return $result; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - public static function isAvailable() { |
|
| 214 | - return extension_loaded('memcached'); |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * @throws \Exception |
|
| 219 | - */ |
|
| 220 | - private function verifyReturnCode() { |
|
| 221 | - $code = self::$cache->getResultCode(); |
|
| 222 | - if ($code === \Memcached::RES_SUCCESS) { |
|
| 223 | - return; |
|
| 224 | - } |
|
| 225 | - $message = self::$cache->getResultMessage(); |
|
| 226 | - throw new \Exception("Error $code interacting with memcached : $message"); |
|
| 227 | - } |
|
| 39 | + use CASTrait; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @var \Memcached $cache |
|
| 43 | + */ |
|
| 44 | + private static $cache = null; |
|
| 45 | + |
|
| 46 | + use CADTrait; |
|
| 47 | + |
|
| 48 | + public function __construct($prefix = '') { |
|
| 49 | + parent::__construct($prefix); |
|
| 50 | + if (is_null(self::$cache)) { |
|
| 51 | + self::$cache = new \Memcached(); |
|
| 52 | + |
|
| 53 | + $defaultOptions = [ |
|
| 54 | + \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
| 55 | + \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
| 56 | + \Memcached::OPT_SEND_TIMEOUT => 50, |
|
| 57 | + \Memcached::OPT_RECV_TIMEOUT => 50, |
|
| 58 | + \Memcached::OPT_POLL_TIMEOUT => 50, |
|
| 59 | + |
|
| 60 | + // Enable compression |
|
| 61 | + \Memcached::OPT_COMPRESSION => true, |
|
| 62 | + |
|
| 63 | + // Turn on consistent hashing |
|
| 64 | + \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
| 65 | + |
|
| 66 | + // Enable Binary Protocol |
|
| 67 | + //\Memcached::OPT_BINARY_PROTOCOL => true, |
|
| 68 | + ]; |
|
| 69 | + // by default enable igbinary serializer if available |
|
| 70 | + if (\Memcached::HAVE_IGBINARY) { |
|
| 71 | + $defaultOptions[\Memcached::OPT_SERIALIZER] = |
|
| 72 | + \Memcached::SERIALIZER_IGBINARY; |
|
| 73 | + } |
|
| 74 | + $options = \OC::$server->getConfig()->getSystemValue('memcached_options', []); |
|
| 75 | + if (is_array($options)) { |
|
| 76 | + $options = $options + $defaultOptions; |
|
| 77 | + self::$cache->setOptions($options); |
|
| 78 | + } else { |
|
| 79 | + throw new HintException("Expected 'memcached_options' config to be an array, got $options"); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers'); |
|
| 83 | + if (!$servers) { |
|
| 84 | + $server = \OC::$server->getSystemConfig()->getValue('memcached_server'); |
|
| 85 | + if ($server) { |
|
| 86 | + $servers = [$server]; |
|
| 87 | + } else { |
|
| 88 | + $servers = [['localhost', 11211]]; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + self::$cache->addServers($servers); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * entries in XCache gets namespaced to prevent collisions between owncloud instances and users |
|
| 97 | + */ |
|
| 98 | + protected function getNameSpace() { |
|
| 99 | + return $this->prefix; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + public function get($key) { |
|
| 103 | + $result = self::$cache->get($this->getNameSpace() . $key); |
|
| 104 | + if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
|
| 105 | + return null; |
|
| 106 | + } else { |
|
| 107 | + return $result; |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + public function set($key, $value, $ttl = 0) { |
|
| 112 | + if ($ttl > 0) { |
|
| 113 | + $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
| 114 | + } else { |
|
| 115 | + $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
| 116 | + } |
|
| 117 | + if ($result !== true) { |
|
| 118 | + $this->verifyReturnCode(); |
|
| 119 | + } |
|
| 120 | + return $result; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + public function hasKey($key) { |
|
| 124 | + self::$cache->get($this->getNameSpace() . $key); |
|
| 125 | + return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + public function remove($key) { |
|
| 129 | + $result= self::$cache->delete($this->getNameSpace() . $key); |
|
| 130 | + if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
|
| 131 | + $this->verifyReturnCode(); |
|
| 132 | + } |
|
| 133 | + return $result; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + public function clear($prefix = '') { |
|
| 137 | + $prefix = $this->getNameSpace() . $prefix; |
|
| 138 | + $allKeys = self::$cache->getAllKeys(); |
|
| 139 | + if ($allKeys === false) { |
|
| 140 | + // newer Memcached doesn't like getAllKeys(), flush everything |
|
| 141 | + self::$cache->flush(); |
|
| 142 | + return true; |
|
| 143 | + } |
|
| 144 | + $keys = []; |
|
| 145 | + $prefixLength = strlen($prefix); |
|
| 146 | + foreach ($allKeys as $key) { |
|
| 147 | + if (substr($key, 0, $prefixLength) === $prefix) { |
|
| 148 | + $keys[] = $key; |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + if (method_exists(self::$cache, 'deleteMulti')) { |
|
| 152 | + self::$cache->deleteMulti($keys); |
|
| 153 | + } else { |
|
| 154 | + foreach ($keys as $key) { |
|
| 155 | + self::$cache->delete($key); |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + return true; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Set a value in the cache if it's not already stored |
|
| 163 | + * |
|
| 164 | + * @param string $key |
|
| 165 | + * @param mixed $value |
|
| 166 | + * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
| 167 | + * @return bool |
|
| 168 | + * @throws \Exception |
|
| 169 | + */ |
|
| 170 | + public function add($key, $value, $ttl = 0) { |
|
| 171 | + $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
| 172 | + if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
|
| 173 | + $this->verifyReturnCode(); |
|
| 174 | + } |
|
| 175 | + return $result; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * Increase a stored number |
|
| 180 | + * |
|
| 181 | + * @param string $key |
|
| 182 | + * @param int $step |
|
| 183 | + * @return int | bool |
|
| 184 | + */ |
|
| 185 | + public function inc($key, $step = 1) { |
|
| 186 | + $this->add($key, 0); |
|
| 187 | + $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
| 188 | + |
|
| 189 | + if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 190 | + return false; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + return $result; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Decrease a stored number |
|
| 198 | + * |
|
| 199 | + * @param string $key |
|
| 200 | + * @param int $step |
|
| 201 | + * @return int | bool |
|
| 202 | + */ |
|
| 203 | + public function dec($key, $step = 1) { |
|
| 204 | + $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
| 205 | + |
|
| 206 | + if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 207 | + return false; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + return $result; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + public static function isAvailable() { |
|
| 214 | + return extension_loaded('memcached'); |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * @throws \Exception |
|
| 219 | + */ |
|
| 220 | + private function verifyReturnCode() { |
|
| 221 | + $code = self::$cache->getResultCode(); |
|
| 222 | + if ($code === \Memcached::RES_SUCCESS) { |
|
| 223 | + return; |
|
| 224 | + } |
|
| 225 | + $message = self::$cache->getResultMessage(); |
|
| 226 | + throw new \Exception("Error $code interacting with memcached : $message"); |
|
| 227 | + } |
|
| 228 | 228 | } |
@@ -25,16 +25,16 @@ |
||
| 25 | 25 | |
| 26 | 26 | class Exception extends \Exception { |
| 27 | 27 | |
| 28 | - /** @var Result */ |
|
| 29 | - private $result; |
|
| 28 | + /** @var Result */ |
|
| 29 | + private $result; |
|
| 30 | 30 | |
| 31 | - public function __construct(Result $result) { |
|
| 32 | - parent::__construct(); |
|
| 33 | - $this->result = $result; |
|
| 34 | - } |
|
| 31 | + public function __construct(Result $result) { |
|
| 32 | + parent::__construct(); |
|
| 33 | + $this->result = $result; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function getResult() { |
|
| 37 | - return $this->result; |
|
| 38 | - } |
|
| 36 | + public function getResult() { |
|
| 37 | + return $this->result; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
@@ -32,14 +32,14 @@ |
||
| 32 | 32 | * @package OC\BackgroundJob |
| 33 | 33 | */ |
| 34 | 34 | abstract class QueuedJob extends Job { |
| 35 | - /** |
|
| 36 | - * run the job, then remove it from the joblist |
|
| 37 | - * |
|
| 38 | - * @param JobList $jobList |
|
| 39 | - * @param ILogger|null $logger |
|
| 40 | - */ |
|
| 41 | - public function execute($jobList, ILogger $logger = null) { |
|
| 42 | - $jobList->remove($this, $this->argument); |
|
| 43 | - parent::execute($jobList, $logger); |
|
| 44 | - } |
|
| 35 | + /** |
|
| 36 | + * run the job, then remove it from the joblist |
|
| 37 | + * |
|
| 38 | + * @param JobList $jobList |
|
| 39 | + * @param ILogger|null $logger |
|
| 40 | + */ |
|
| 41 | + public function execute($jobList, ILogger $logger = null) { |
|
| 42 | + $jobList->remove($this, $this->argument); |
|
| 43 | + parent::execute($jobList, $logger); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -30,114 +30,114 @@ |
||
| 30 | 30 | * @since 8.0.0 |
| 31 | 31 | */ |
| 32 | 32 | interface IDateTimeFormatter { |
| 33 | - /** |
|
| 34 | - * Formats the date of the given timestamp |
|
| 35 | - * |
|
| 36 | - * @param int|\DateTime $timestamp |
|
| 37 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 38 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 39 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 40 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 41 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 42 | - * The exact format is dependent on the language |
|
| 43 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 44 | - * @param \OCP\IL10N|null $l The locale to use |
|
| 45 | - * @return string Formatted date string |
|
| 46 | - * @since 8.0.0 |
|
| 47 | - */ |
|
| 48 | - public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 33 | + /** |
|
| 34 | + * Formats the date of the given timestamp |
|
| 35 | + * |
|
| 36 | + * @param int|\DateTime $timestamp |
|
| 37 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 38 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 39 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 40 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 41 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 42 | + * The exact format is dependent on the language |
|
| 43 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 44 | + * @param \OCP\IL10N|null $l The locale to use |
|
| 45 | + * @return string Formatted date string |
|
| 46 | + * @since 8.0.0 |
|
| 47 | + */ |
|
| 48 | + public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Formats the date of the given timestamp |
|
| 52 | - * |
|
| 53 | - * @param int|\DateTime $timestamp |
|
| 54 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 55 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 56 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 57 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 58 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 59 | - * The exact format is dependent on the language |
|
| 60 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 61 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 62 | - * @param \OCP\IL10N|null $l The locale to use |
|
| 63 | - * @return string Formatted relative date string |
|
| 64 | - * @since 8.0.0 |
|
| 65 | - */ |
|
| 66 | - public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 50 | + /** |
|
| 51 | + * Formats the date of the given timestamp |
|
| 52 | + * |
|
| 53 | + * @param int|\DateTime $timestamp |
|
| 54 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 55 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 56 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 57 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 58 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 59 | + * The exact format is dependent on the language |
|
| 60 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 61 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 62 | + * @param \OCP\IL10N|null $l The locale to use |
|
| 63 | + * @return string Formatted relative date string |
|
| 64 | + * @since 8.0.0 |
|
| 65 | + */ |
|
| 66 | + public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Gives the relative date of the timestamp |
|
| 70 | - * Only works for past dates |
|
| 71 | - * |
|
| 72 | - * @param int|\DateTime $timestamp |
|
| 73 | - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 74 | - * @param \OCP\IL10N|null $l The locale to use |
|
| 75 | - * @return string Dates returned are: |
|
| 76 | - * < 1 month => Today, Yesterday, n days ago |
|
| 77 | - * < 13 month => last month, n months ago |
|
| 78 | - * >= 13 month => last year, n years ago |
|
| 79 | - * @since 8.0.0 |
|
| 80 | - */ |
|
| 81 | - public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 68 | + /** |
|
| 69 | + * Gives the relative date of the timestamp |
|
| 70 | + * Only works for past dates |
|
| 71 | + * |
|
| 72 | + * @param int|\DateTime $timestamp |
|
| 73 | + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 74 | + * @param \OCP\IL10N|null $l The locale to use |
|
| 75 | + * @return string Dates returned are: |
|
| 76 | + * < 1 month => Today, Yesterday, n days ago |
|
| 77 | + * < 13 month => last month, n months ago |
|
| 78 | + * >= 13 month => last year, n years ago |
|
| 79 | + * @since 8.0.0 |
|
| 80 | + */ |
|
| 81 | + public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Formats the time of the given timestamp |
|
| 85 | - * |
|
| 86 | - * @param int|\DateTime $timestamp |
|
| 87 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 88 | - * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
| 89 | - * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
| 90 | - * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
| 91 | - * short: e.g. 'h:mm a' => '11:42 AM' |
|
| 92 | - * The exact format is dependent on the language |
|
| 93 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 94 | - * @param \OCP\IL10N|null $l The locale to use |
|
| 95 | - * @return string Formatted time string |
|
| 96 | - * @since 8.0.0 |
|
| 97 | - */ |
|
| 98 | - public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 83 | + /** |
|
| 84 | + * Formats the time of the given timestamp |
|
| 85 | + * |
|
| 86 | + * @param int|\DateTime $timestamp |
|
| 87 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 88 | + * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
| 89 | + * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
| 90 | + * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
| 91 | + * short: e.g. 'h:mm a' => '11:42 AM' |
|
| 92 | + * The exact format is dependent on the language |
|
| 93 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 94 | + * @param \OCP\IL10N|null $l The locale to use |
|
| 95 | + * @return string Formatted time string |
|
| 96 | + * @since 8.0.0 |
|
| 97 | + */ |
|
| 98 | + public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Gives the relative past time of the timestamp |
|
| 102 | - * |
|
| 103 | - * @param int|\DateTime $timestamp |
|
| 104 | - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 105 | - * @param \OCP\IL10N|null $l The locale to use |
|
| 106 | - * @return string Dates returned are: |
|
| 107 | - * < 60 sec => seconds ago |
|
| 108 | - * < 1 hour => n minutes ago |
|
| 109 | - * < 1 day => n hours ago |
|
| 110 | - * < 1 month => Yesterday, n days ago |
|
| 111 | - * < 13 month => last month, n months ago |
|
| 112 | - * >= 13 month => last year, n years ago |
|
| 113 | - * @since 8.0.0 |
|
| 114 | - */ |
|
| 115 | - public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 100 | + /** |
|
| 101 | + * Gives the relative past time of the timestamp |
|
| 102 | + * |
|
| 103 | + * @param int|\DateTime $timestamp |
|
| 104 | + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 105 | + * @param \OCP\IL10N|null $l The locale to use |
|
| 106 | + * @return string Dates returned are: |
|
| 107 | + * < 60 sec => seconds ago |
|
| 108 | + * < 1 hour => n minutes ago |
|
| 109 | + * < 1 day => n hours ago |
|
| 110 | + * < 1 month => Yesterday, n days ago |
|
| 111 | + * < 13 month => last month, n months ago |
|
| 112 | + * >= 13 month => last year, n years ago |
|
| 113 | + * @since 8.0.0 |
|
| 114 | + */ |
|
| 115 | + public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Formats the date and time of the given timestamp |
|
| 119 | - * |
|
| 120 | - * @param int|\DateTime $timestamp |
|
| 121 | - * @param string $formatDate See formatDate() for description |
|
| 122 | - * @param string $formatTime See formatTime() for description |
|
| 123 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 124 | - * @param \OCP\IL10N|null $l The locale to use |
|
| 125 | - * @return string Formatted date and time string |
|
| 126 | - * @since 8.0.0 |
|
| 127 | - */ |
|
| 128 | - public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 117 | + /** |
|
| 118 | + * Formats the date and time of the given timestamp |
|
| 119 | + * |
|
| 120 | + * @param int|\DateTime $timestamp |
|
| 121 | + * @param string $formatDate See formatDate() for description |
|
| 122 | + * @param string $formatTime See formatTime() for description |
|
| 123 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 124 | + * @param \OCP\IL10N|null $l The locale to use |
|
| 125 | + * @return string Formatted date and time string |
|
| 126 | + * @since 8.0.0 |
|
| 127 | + */ |
|
| 128 | + public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * Formats the date and time of the given timestamp |
|
| 132 | - * |
|
| 133 | - * @param int|\DateTime $timestamp |
|
| 134 | - * @param string $formatDate See formatDate() for description |
|
| 135 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 136 | - * @param string $formatTime See formatTime() for description |
|
| 137 | - * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 138 | - * @param \OCP\IL10N|null $l The locale to use |
|
| 139 | - * @return string Formatted relative date and time string |
|
| 140 | - * @since 8.0.0 |
|
| 141 | - */ |
|
| 142 | - public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 130 | + /** |
|
| 131 | + * Formats the date and time of the given timestamp |
|
| 132 | + * |
|
| 133 | + * @param int|\DateTime $timestamp |
|
| 134 | + * @param string $formatDate See formatDate() for description |
|
| 135 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 136 | + * @param string $formatTime See formatTime() for description |
|
| 137 | + * @param \DateTimeZone|null $timeZone The timezone to use |
|
| 138 | + * @param \OCP\IL10N|null $l The locale to use |
|
| 139 | + * @return string Formatted relative date and time string |
|
| 140 | + * @since 8.0.0 |
|
| 141 | + */ |
|
| 142 | + public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 143 | 143 | } |
@@ -31,18 +31,18 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class GenericShareException extends HintException { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @param string $message |
|
| 36 | - * @param string $hint |
|
| 37 | - * @param int $code |
|
| 38 | - * @param \Exception|null $previous |
|
| 39 | - * @since 9.0.0 |
|
| 40 | - */ |
|
| 41 | - public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
| 42 | - if (empty($message)) { |
|
| 43 | - $message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.'; |
|
| 44 | - } |
|
| 45 | - parent::__construct($message, $hint, $code, $previous); |
|
| 46 | - } |
|
| 34 | + /** |
|
| 35 | + * @param string $message |
|
| 36 | + * @param string $hint |
|
| 37 | + * @param int $code |
|
| 38 | + * @param \Exception|null $previous |
|
| 39 | + * @since 9.0.0 |
|
| 40 | + */ |
|
| 41 | + public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
| 42 | + if (empty($message)) { |
|
| 43 | + $message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.'; |
|
| 44 | + } |
|
| 45 | + parent::__construct($message, $hint, $code, $previous); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | } |
@@ -35,18 +35,18 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | class GenericEncryptionException extends HintException { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param string $message |
|
| 40 | - * @param string $hint |
|
| 41 | - * @param int $code |
|
| 42 | - * @param \Exception|null $previous |
|
| 43 | - * @since 8.1.0 |
|
| 44 | - */ |
|
| 45 | - public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
| 46 | - if (empty($message)) { |
|
| 47 | - $message = 'Unspecified encryption exception'; |
|
| 48 | - } |
|
| 49 | - parent::__construct($message, $hint, $code, $previous); |
|
| 50 | - } |
|
| 38 | + /** |
|
| 39 | + * @param string $message |
|
| 40 | + * @param string $hint |
|
| 41 | + * @param int $code |
|
| 42 | + * @param \Exception|null $previous |
|
| 43 | + * @since 8.1.0 |
|
| 44 | + */ |
|
| 45 | + public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
| 46 | + if (empty($message)) { |
|
| 47 | + $message = 'Unspecified encryption exception'; |
|
| 48 | + } |
|
| 49 | + parent::__construct($message, $hint, $code, $previous); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | } |
@@ -47,417 +47,417 @@ |
||
| 47 | 47 | * @deprecated 9.0.0 use \OCP\Files\Storage\IStorage instead |
| 48 | 48 | */ |
| 49 | 49 | interface Storage extends IStorage { |
| 50 | - /** |
|
| 51 | - * $parameters is a free form array with the configuration options needed to construct the storage |
|
| 52 | - * |
|
| 53 | - * @param array $parameters |
|
| 54 | - * @since 6.0.0 |
|
| 55 | - */ |
|
| 56 | - public function __construct($parameters); |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Get the identifier for the storage, |
|
| 60 | - * the returned id should be the same for every storage object that is created with the same parameters |
|
| 61 | - * and two storage objects with the same id should refer to two storages that display the same files. |
|
| 62 | - * |
|
| 63 | - * @return string |
|
| 64 | - * @since 6.0.0 |
|
| 65 | - */ |
|
| 66 | - public function getId(); |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * see http://php.net/manual/en/function.mkdir.php |
|
| 70 | - * implementations need to implement a recursive mkdir |
|
| 71 | - * |
|
| 72 | - * @param string $path |
|
| 73 | - * @return bool |
|
| 74 | - * @since 6.0.0 |
|
| 75 | - */ |
|
| 76 | - public function mkdir($path); |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * see http://php.net/manual/en/function.rmdir.php |
|
| 80 | - * |
|
| 81 | - * @param string $path |
|
| 82 | - * @return bool |
|
| 83 | - * @since 6.0.0 |
|
| 84 | - */ |
|
| 85 | - public function rmdir($path); |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * see http://php.net/manual/en/function.opendir.php |
|
| 89 | - * |
|
| 90 | - * @param string $path |
|
| 91 | - * @return resource|false |
|
| 92 | - * @since 6.0.0 |
|
| 93 | - */ |
|
| 94 | - public function opendir($path); |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * see http://php.net/manual/en/function.is-dir.php |
|
| 98 | - * |
|
| 99 | - * @param string $path |
|
| 100 | - * @return bool |
|
| 101 | - * @since 6.0.0 |
|
| 102 | - */ |
|
| 103 | - public function is_dir($path); |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * see http://php.net/manual/en/function.is-file.php |
|
| 107 | - * |
|
| 108 | - * @param string $path |
|
| 109 | - * @return bool |
|
| 110 | - * @since 6.0.0 |
|
| 111 | - */ |
|
| 112 | - public function is_file($path); |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * see http://php.net/manual/en/function.stat.php |
|
| 116 | - * only the following keys are required in the result: size and mtime |
|
| 117 | - * |
|
| 118 | - * @param string $path |
|
| 119 | - * @return array|false |
|
| 120 | - * @since 6.0.0 |
|
| 121 | - */ |
|
| 122 | - public function stat($path); |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * see http://php.net/manual/en/function.filetype.php |
|
| 126 | - * |
|
| 127 | - * @param string $path |
|
| 128 | - * @return string|false |
|
| 129 | - * @since 6.0.0 |
|
| 130 | - */ |
|
| 131 | - public function filetype($path); |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * see http://php.net/manual/en/function.filesize.php |
|
| 135 | - * The result for filesize when called on a folder is required to be 0 |
|
| 136 | - * |
|
| 137 | - * @param string $path |
|
| 138 | - * @return int|false |
|
| 139 | - * @since 6.0.0 |
|
| 140 | - */ |
|
| 141 | - public function filesize($path); |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * check if a file can be created in $path |
|
| 145 | - * |
|
| 146 | - * @param string $path |
|
| 147 | - * @return bool |
|
| 148 | - * @since 6.0.0 |
|
| 149 | - */ |
|
| 150 | - public function isCreatable($path); |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * check if a file can be read |
|
| 154 | - * |
|
| 155 | - * @param string $path |
|
| 156 | - * @return bool |
|
| 157 | - * @since 6.0.0 |
|
| 158 | - */ |
|
| 159 | - public function isReadable($path); |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * check if a file can be written to |
|
| 163 | - * |
|
| 164 | - * @param string $path |
|
| 165 | - * @return bool |
|
| 166 | - * @since 6.0.0 |
|
| 167 | - */ |
|
| 168 | - public function isUpdatable($path); |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * check if a file can be deleted |
|
| 172 | - * |
|
| 173 | - * @param string $path |
|
| 174 | - * @return bool |
|
| 175 | - * @since 6.0.0 |
|
| 176 | - */ |
|
| 177 | - public function isDeletable($path); |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * check if a file can be shared |
|
| 181 | - * |
|
| 182 | - * @param string $path |
|
| 183 | - * @return bool |
|
| 184 | - * @since 6.0.0 |
|
| 185 | - */ |
|
| 186 | - public function isSharable($path); |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * get the full permissions of a path. |
|
| 190 | - * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php |
|
| 191 | - * |
|
| 192 | - * @param string $path |
|
| 193 | - * @return int |
|
| 194 | - * @since 6.0.0 |
|
| 195 | - */ |
|
| 196 | - public function getPermissions($path); |
|
| 197 | - |
|
| 198 | - /** |
|
| 199 | - * see http://php.net/manual/en/function.file_exists.php |
|
| 200 | - * |
|
| 201 | - * @param string $path |
|
| 202 | - * @return bool |
|
| 203 | - * @since 6.0.0 |
|
| 204 | - */ |
|
| 205 | - public function file_exists($path); |
|
| 206 | - |
|
| 207 | - /** |
|
| 208 | - * see http://php.net/manual/en/function.filemtime.php |
|
| 209 | - * |
|
| 210 | - * @param string $path |
|
| 211 | - * @return int|false |
|
| 212 | - * @since 6.0.0 |
|
| 213 | - */ |
|
| 214 | - public function filemtime($path); |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * see http://php.net/manual/en/function.file_get_contents.php |
|
| 218 | - * |
|
| 219 | - * @param string $path |
|
| 220 | - * @return string|false |
|
| 221 | - * @since 6.0.0 |
|
| 222 | - */ |
|
| 223 | - public function file_get_contents($path); |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * see http://php.net/manual/en/function.file_put_contents.php |
|
| 227 | - * |
|
| 228 | - * @param string $path |
|
| 229 | - * @param string $data |
|
| 230 | - * @return bool |
|
| 231 | - * @since 6.0.0 |
|
| 232 | - */ |
|
| 233 | - public function file_put_contents($path, $data); |
|
| 234 | - |
|
| 235 | - /** |
|
| 236 | - * see http://php.net/manual/en/function.unlink.php |
|
| 237 | - * |
|
| 238 | - * @param string $path |
|
| 239 | - * @return bool |
|
| 240 | - * @since 6.0.0 |
|
| 241 | - */ |
|
| 242 | - public function unlink($path); |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * see http://php.net/manual/en/function.rename.php |
|
| 246 | - * |
|
| 247 | - * @param string $path1 |
|
| 248 | - * @param string $path2 |
|
| 249 | - * @return bool |
|
| 250 | - * @since 6.0.0 |
|
| 251 | - */ |
|
| 252 | - public function rename($path1, $path2); |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * see http://php.net/manual/en/function.copy.php |
|
| 256 | - * |
|
| 257 | - * @param string $path1 |
|
| 258 | - * @param string $path2 |
|
| 259 | - * @return bool |
|
| 260 | - * @since 6.0.0 |
|
| 261 | - */ |
|
| 262 | - public function copy($path1, $path2); |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * see http://php.net/manual/en/function.fopen.php |
|
| 266 | - * |
|
| 267 | - * @param string $path |
|
| 268 | - * @param string $mode |
|
| 269 | - * @return resource|false |
|
| 270 | - * @since 6.0.0 |
|
| 271 | - */ |
|
| 272 | - public function fopen($path, $mode); |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * get the mimetype for a file or folder |
|
| 276 | - * The mimetype for a folder is required to be "httpd/unix-directory" |
|
| 277 | - * |
|
| 278 | - * @param string $path |
|
| 279 | - * @return string|false |
|
| 280 | - * @since 6.0.0 |
|
| 281 | - */ |
|
| 282 | - public function getMimeType($path); |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * see http://php.net/manual/en/function.hash-file.php |
|
| 286 | - * |
|
| 287 | - * @param string $type |
|
| 288 | - * @param string $path |
|
| 289 | - * @param bool $raw |
|
| 290 | - * @return string|false |
|
| 291 | - * @since 6.0.0 |
|
| 292 | - */ |
|
| 293 | - public function hash($type, $path, $raw = false); |
|
| 294 | - |
|
| 295 | - /** |
|
| 296 | - * see http://php.net/manual/en/function.free_space.php |
|
| 297 | - * |
|
| 298 | - * @param string $path |
|
| 299 | - * @return int|false |
|
| 300 | - * @since 6.0.0 |
|
| 301 | - */ |
|
| 302 | - public function free_space($path); |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * search for occurrences of $query in file names |
|
| 306 | - * |
|
| 307 | - * @param string $query |
|
| 308 | - * @return array|false |
|
| 309 | - * @since 6.0.0 |
|
| 310 | - */ |
|
| 311 | - public function search($query); |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * see http://php.net/manual/en/function.touch.php |
|
| 315 | - * If the backend does not support the operation, false should be returned |
|
| 316 | - * |
|
| 317 | - * @param string $path |
|
| 318 | - * @param int $mtime |
|
| 319 | - * @return bool |
|
| 320 | - * @since 6.0.0 |
|
| 321 | - */ |
|
| 322 | - public function touch($path, $mtime = null); |
|
| 323 | - |
|
| 324 | - /** |
|
| 325 | - * get the path to a local version of the file. |
|
| 326 | - * The local version of the file can be temporary and doesn't have to be persistent across requests |
|
| 327 | - * |
|
| 328 | - * @param string $path |
|
| 329 | - * @return string|false |
|
| 330 | - * @since 6.0.0 |
|
| 331 | - */ |
|
| 332 | - public function getLocalFile($path); |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * check if a file or folder has been updated since $time |
|
| 336 | - * |
|
| 337 | - * @param string $path |
|
| 338 | - * @param int $time |
|
| 339 | - * @return bool |
|
| 340 | - * @since 6.0.0 |
|
| 341 | - * |
|
| 342 | - * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. |
|
| 343 | - * returning true for other changes in the folder is optional |
|
| 344 | - */ |
|
| 345 | - public function hasUpdated($path, $time); |
|
| 346 | - |
|
| 347 | - /** |
|
| 348 | - * get the ETag for a file or folder |
|
| 349 | - * |
|
| 350 | - * @param string $path |
|
| 351 | - * @return string|false |
|
| 352 | - * @since 6.0.0 |
|
| 353 | - */ |
|
| 354 | - public function getETag($path); |
|
| 355 | - |
|
| 356 | - /** |
|
| 357 | - * Returns whether the storage is local, which means that files |
|
| 358 | - * are stored on the local filesystem instead of remotely. |
|
| 359 | - * Calling getLocalFile() for local storages should always |
|
| 360 | - * return the local files, whereas for non-local storages |
|
| 361 | - * it might return a temporary file. |
|
| 362 | - * |
|
| 363 | - * @return bool true if the files are stored locally, false otherwise |
|
| 364 | - * @since 7.0.0 |
|
| 365 | - */ |
|
| 366 | - public function isLocal(); |
|
| 367 | - |
|
| 368 | - /** |
|
| 369 | - * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class |
|
| 370 | - * |
|
| 371 | - * @param string $class |
|
| 372 | - * @return bool |
|
| 373 | - * @since 7.0.0 |
|
| 374 | - */ |
|
| 375 | - public function instanceOfStorage($class); |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * A custom storage implementation can return an url for direct download of a give file. |
|
| 379 | - * |
|
| 380 | - * For now the returned array can hold the parameter url - in future more attributes might follow. |
|
| 381 | - * |
|
| 382 | - * @param string $path |
|
| 383 | - * @return array|false |
|
| 384 | - * @since 8.0.0 |
|
| 385 | - */ |
|
| 386 | - public function getDirectDownload($path); |
|
| 387 | - |
|
| 388 | - /** |
|
| 389 | - * @param string $path the path of the target folder |
|
| 390 | - * @param string $fileName the name of the file itself |
|
| 391 | - * @return void |
|
| 392 | - * @throws InvalidPathException |
|
| 393 | - * @since 8.1.0 |
|
| 394 | - */ |
|
| 395 | - public function verifyPath($path, $fileName); |
|
| 396 | - |
|
| 397 | - /** |
|
| 398 | - * @param IStorage $sourceStorage |
|
| 399 | - * @param string $sourceInternalPath |
|
| 400 | - * @param string $targetInternalPath |
|
| 401 | - * @return bool |
|
| 402 | - * @since 8.1.0 |
|
| 403 | - */ |
|
| 404 | - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * @param IStorage $sourceStorage |
|
| 408 | - * @param string $sourceInternalPath |
|
| 409 | - * @param string $targetInternalPath |
|
| 410 | - * @return bool |
|
| 411 | - * @since 8.1.0 |
|
| 412 | - */ |
|
| 413 | - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * @param string $path The path of the file to acquire the lock for |
|
| 417 | - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 418 | - * @param \OCP\Lock\ILockingProvider $provider |
|
| 419 | - * @throws \OCP\Lock\LockedException |
|
| 420 | - * @since 8.1.0 |
|
| 421 | - */ |
|
| 422 | - public function acquireLock($path, $type, ILockingProvider $provider); |
|
| 423 | - |
|
| 424 | - /** |
|
| 425 | - * @param string $path The path of the file to acquire the lock for |
|
| 426 | - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 427 | - * @param \OCP\Lock\ILockingProvider $provider |
|
| 428 | - * @throws \OCP\Lock\LockedException |
|
| 429 | - * @since 8.1.0 |
|
| 430 | - */ |
|
| 431 | - public function releaseLock($path, $type, ILockingProvider $provider); |
|
| 432 | - |
|
| 433 | - /** |
|
| 434 | - * @param string $path The path of the file to change the lock for |
|
| 435 | - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 436 | - * @param \OCP\Lock\ILockingProvider $provider |
|
| 437 | - * @throws \OCP\Lock\LockedException |
|
| 438 | - * @since 8.1.0 |
|
| 439 | - */ |
|
| 440 | - public function changeLock($path, $type, ILockingProvider $provider); |
|
| 441 | - |
|
| 442 | - /** |
|
| 443 | - * Test a storage for availability |
|
| 444 | - * |
|
| 445 | - * @since 8.2.0 |
|
| 446 | - * @return bool |
|
| 447 | - */ |
|
| 448 | - public function test(); |
|
| 449 | - |
|
| 450 | - /** |
|
| 451 | - * @since 8.2.0 |
|
| 452 | - * @return array [ available, last_checked ] |
|
| 453 | - */ |
|
| 454 | - public function getAvailability(); |
|
| 455 | - |
|
| 456 | - /** |
|
| 457 | - * @since 8.2.0 |
|
| 458 | - * @param bool $isAvailable |
|
| 459 | - */ |
|
| 460 | - public function setAvailability($isAvailable); |
|
| 461 | - |
|
| 462 | - public function needsPartFile(); |
|
| 50 | + /** |
|
| 51 | + * $parameters is a free form array with the configuration options needed to construct the storage |
|
| 52 | + * |
|
| 53 | + * @param array $parameters |
|
| 54 | + * @since 6.0.0 |
|
| 55 | + */ |
|
| 56 | + public function __construct($parameters); |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Get the identifier for the storage, |
|
| 60 | + * the returned id should be the same for every storage object that is created with the same parameters |
|
| 61 | + * and two storage objects with the same id should refer to two storages that display the same files. |
|
| 62 | + * |
|
| 63 | + * @return string |
|
| 64 | + * @since 6.0.0 |
|
| 65 | + */ |
|
| 66 | + public function getId(); |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * see http://php.net/manual/en/function.mkdir.php |
|
| 70 | + * implementations need to implement a recursive mkdir |
|
| 71 | + * |
|
| 72 | + * @param string $path |
|
| 73 | + * @return bool |
|
| 74 | + * @since 6.0.0 |
|
| 75 | + */ |
|
| 76 | + public function mkdir($path); |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * see http://php.net/manual/en/function.rmdir.php |
|
| 80 | + * |
|
| 81 | + * @param string $path |
|
| 82 | + * @return bool |
|
| 83 | + * @since 6.0.0 |
|
| 84 | + */ |
|
| 85 | + public function rmdir($path); |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * see http://php.net/manual/en/function.opendir.php |
|
| 89 | + * |
|
| 90 | + * @param string $path |
|
| 91 | + * @return resource|false |
|
| 92 | + * @since 6.0.0 |
|
| 93 | + */ |
|
| 94 | + public function opendir($path); |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * see http://php.net/manual/en/function.is-dir.php |
|
| 98 | + * |
|
| 99 | + * @param string $path |
|
| 100 | + * @return bool |
|
| 101 | + * @since 6.0.0 |
|
| 102 | + */ |
|
| 103 | + public function is_dir($path); |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * see http://php.net/manual/en/function.is-file.php |
|
| 107 | + * |
|
| 108 | + * @param string $path |
|
| 109 | + * @return bool |
|
| 110 | + * @since 6.0.0 |
|
| 111 | + */ |
|
| 112 | + public function is_file($path); |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * see http://php.net/manual/en/function.stat.php |
|
| 116 | + * only the following keys are required in the result: size and mtime |
|
| 117 | + * |
|
| 118 | + * @param string $path |
|
| 119 | + * @return array|false |
|
| 120 | + * @since 6.0.0 |
|
| 121 | + */ |
|
| 122 | + public function stat($path); |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * see http://php.net/manual/en/function.filetype.php |
|
| 126 | + * |
|
| 127 | + * @param string $path |
|
| 128 | + * @return string|false |
|
| 129 | + * @since 6.0.0 |
|
| 130 | + */ |
|
| 131 | + public function filetype($path); |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * see http://php.net/manual/en/function.filesize.php |
|
| 135 | + * The result for filesize when called on a folder is required to be 0 |
|
| 136 | + * |
|
| 137 | + * @param string $path |
|
| 138 | + * @return int|false |
|
| 139 | + * @since 6.0.0 |
|
| 140 | + */ |
|
| 141 | + public function filesize($path); |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * check if a file can be created in $path |
|
| 145 | + * |
|
| 146 | + * @param string $path |
|
| 147 | + * @return bool |
|
| 148 | + * @since 6.0.0 |
|
| 149 | + */ |
|
| 150 | + public function isCreatable($path); |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * check if a file can be read |
|
| 154 | + * |
|
| 155 | + * @param string $path |
|
| 156 | + * @return bool |
|
| 157 | + * @since 6.0.0 |
|
| 158 | + */ |
|
| 159 | + public function isReadable($path); |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * check if a file can be written to |
|
| 163 | + * |
|
| 164 | + * @param string $path |
|
| 165 | + * @return bool |
|
| 166 | + * @since 6.0.0 |
|
| 167 | + */ |
|
| 168 | + public function isUpdatable($path); |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * check if a file can be deleted |
|
| 172 | + * |
|
| 173 | + * @param string $path |
|
| 174 | + * @return bool |
|
| 175 | + * @since 6.0.0 |
|
| 176 | + */ |
|
| 177 | + public function isDeletable($path); |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * check if a file can be shared |
|
| 181 | + * |
|
| 182 | + * @param string $path |
|
| 183 | + * @return bool |
|
| 184 | + * @since 6.0.0 |
|
| 185 | + */ |
|
| 186 | + public function isSharable($path); |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * get the full permissions of a path. |
|
| 190 | + * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php |
|
| 191 | + * |
|
| 192 | + * @param string $path |
|
| 193 | + * @return int |
|
| 194 | + * @since 6.0.0 |
|
| 195 | + */ |
|
| 196 | + public function getPermissions($path); |
|
| 197 | + |
|
| 198 | + /** |
|
| 199 | + * see http://php.net/manual/en/function.file_exists.php |
|
| 200 | + * |
|
| 201 | + * @param string $path |
|
| 202 | + * @return bool |
|
| 203 | + * @since 6.0.0 |
|
| 204 | + */ |
|
| 205 | + public function file_exists($path); |
|
| 206 | + |
|
| 207 | + /** |
|
| 208 | + * see http://php.net/manual/en/function.filemtime.php |
|
| 209 | + * |
|
| 210 | + * @param string $path |
|
| 211 | + * @return int|false |
|
| 212 | + * @since 6.0.0 |
|
| 213 | + */ |
|
| 214 | + public function filemtime($path); |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * see http://php.net/manual/en/function.file_get_contents.php |
|
| 218 | + * |
|
| 219 | + * @param string $path |
|
| 220 | + * @return string|false |
|
| 221 | + * @since 6.0.0 |
|
| 222 | + */ |
|
| 223 | + public function file_get_contents($path); |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * see http://php.net/manual/en/function.file_put_contents.php |
|
| 227 | + * |
|
| 228 | + * @param string $path |
|
| 229 | + * @param string $data |
|
| 230 | + * @return bool |
|
| 231 | + * @since 6.0.0 |
|
| 232 | + */ |
|
| 233 | + public function file_put_contents($path, $data); |
|
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * see http://php.net/manual/en/function.unlink.php |
|
| 237 | + * |
|
| 238 | + * @param string $path |
|
| 239 | + * @return bool |
|
| 240 | + * @since 6.0.0 |
|
| 241 | + */ |
|
| 242 | + public function unlink($path); |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * see http://php.net/manual/en/function.rename.php |
|
| 246 | + * |
|
| 247 | + * @param string $path1 |
|
| 248 | + * @param string $path2 |
|
| 249 | + * @return bool |
|
| 250 | + * @since 6.0.0 |
|
| 251 | + */ |
|
| 252 | + public function rename($path1, $path2); |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * see http://php.net/manual/en/function.copy.php |
|
| 256 | + * |
|
| 257 | + * @param string $path1 |
|
| 258 | + * @param string $path2 |
|
| 259 | + * @return bool |
|
| 260 | + * @since 6.0.0 |
|
| 261 | + */ |
|
| 262 | + public function copy($path1, $path2); |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * see http://php.net/manual/en/function.fopen.php |
|
| 266 | + * |
|
| 267 | + * @param string $path |
|
| 268 | + * @param string $mode |
|
| 269 | + * @return resource|false |
|
| 270 | + * @since 6.0.0 |
|
| 271 | + */ |
|
| 272 | + public function fopen($path, $mode); |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * get the mimetype for a file or folder |
|
| 276 | + * The mimetype for a folder is required to be "httpd/unix-directory" |
|
| 277 | + * |
|
| 278 | + * @param string $path |
|
| 279 | + * @return string|false |
|
| 280 | + * @since 6.0.0 |
|
| 281 | + */ |
|
| 282 | + public function getMimeType($path); |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * see http://php.net/manual/en/function.hash-file.php |
|
| 286 | + * |
|
| 287 | + * @param string $type |
|
| 288 | + * @param string $path |
|
| 289 | + * @param bool $raw |
|
| 290 | + * @return string|false |
|
| 291 | + * @since 6.0.0 |
|
| 292 | + */ |
|
| 293 | + public function hash($type, $path, $raw = false); |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | + * see http://php.net/manual/en/function.free_space.php |
|
| 297 | + * |
|
| 298 | + * @param string $path |
|
| 299 | + * @return int|false |
|
| 300 | + * @since 6.0.0 |
|
| 301 | + */ |
|
| 302 | + public function free_space($path); |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * search for occurrences of $query in file names |
|
| 306 | + * |
|
| 307 | + * @param string $query |
|
| 308 | + * @return array|false |
|
| 309 | + * @since 6.0.0 |
|
| 310 | + */ |
|
| 311 | + public function search($query); |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * see http://php.net/manual/en/function.touch.php |
|
| 315 | + * If the backend does not support the operation, false should be returned |
|
| 316 | + * |
|
| 317 | + * @param string $path |
|
| 318 | + * @param int $mtime |
|
| 319 | + * @return bool |
|
| 320 | + * @since 6.0.0 |
|
| 321 | + */ |
|
| 322 | + public function touch($path, $mtime = null); |
|
| 323 | + |
|
| 324 | + /** |
|
| 325 | + * get the path to a local version of the file. |
|
| 326 | + * The local version of the file can be temporary and doesn't have to be persistent across requests |
|
| 327 | + * |
|
| 328 | + * @param string $path |
|
| 329 | + * @return string|false |
|
| 330 | + * @since 6.0.0 |
|
| 331 | + */ |
|
| 332 | + public function getLocalFile($path); |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * check if a file or folder has been updated since $time |
|
| 336 | + * |
|
| 337 | + * @param string $path |
|
| 338 | + * @param int $time |
|
| 339 | + * @return bool |
|
| 340 | + * @since 6.0.0 |
|
| 341 | + * |
|
| 342 | + * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. |
|
| 343 | + * returning true for other changes in the folder is optional |
|
| 344 | + */ |
|
| 345 | + public function hasUpdated($path, $time); |
|
| 346 | + |
|
| 347 | + /** |
|
| 348 | + * get the ETag for a file or folder |
|
| 349 | + * |
|
| 350 | + * @param string $path |
|
| 351 | + * @return string|false |
|
| 352 | + * @since 6.0.0 |
|
| 353 | + */ |
|
| 354 | + public function getETag($path); |
|
| 355 | + |
|
| 356 | + /** |
|
| 357 | + * Returns whether the storage is local, which means that files |
|
| 358 | + * are stored on the local filesystem instead of remotely. |
|
| 359 | + * Calling getLocalFile() for local storages should always |
|
| 360 | + * return the local files, whereas for non-local storages |
|
| 361 | + * it might return a temporary file. |
|
| 362 | + * |
|
| 363 | + * @return bool true if the files are stored locally, false otherwise |
|
| 364 | + * @since 7.0.0 |
|
| 365 | + */ |
|
| 366 | + public function isLocal(); |
|
| 367 | + |
|
| 368 | + /** |
|
| 369 | + * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class |
|
| 370 | + * |
|
| 371 | + * @param string $class |
|
| 372 | + * @return bool |
|
| 373 | + * @since 7.0.0 |
|
| 374 | + */ |
|
| 375 | + public function instanceOfStorage($class); |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * A custom storage implementation can return an url for direct download of a give file. |
|
| 379 | + * |
|
| 380 | + * For now the returned array can hold the parameter url - in future more attributes might follow. |
|
| 381 | + * |
|
| 382 | + * @param string $path |
|
| 383 | + * @return array|false |
|
| 384 | + * @since 8.0.0 |
|
| 385 | + */ |
|
| 386 | + public function getDirectDownload($path); |
|
| 387 | + |
|
| 388 | + /** |
|
| 389 | + * @param string $path the path of the target folder |
|
| 390 | + * @param string $fileName the name of the file itself |
|
| 391 | + * @return void |
|
| 392 | + * @throws InvalidPathException |
|
| 393 | + * @since 8.1.0 |
|
| 394 | + */ |
|
| 395 | + public function verifyPath($path, $fileName); |
|
| 396 | + |
|
| 397 | + /** |
|
| 398 | + * @param IStorage $sourceStorage |
|
| 399 | + * @param string $sourceInternalPath |
|
| 400 | + * @param string $targetInternalPath |
|
| 401 | + * @return bool |
|
| 402 | + * @since 8.1.0 |
|
| 403 | + */ |
|
| 404 | + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * @param IStorage $sourceStorage |
|
| 408 | + * @param string $sourceInternalPath |
|
| 409 | + * @param string $targetInternalPath |
|
| 410 | + * @return bool |
|
| 411 | + * @since 8.1.0 |
|
| 412 | + */ |
|
| 413 | + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath); |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * @param string $path The path of the file to acquire the lock for |
|
| 417 | + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 418 | + * @param \OCP\Lock\ILockingProvider $provider |
|
| 419 | + * @throws \OCP\Lock\LockedException |
|
| 420 | + * @since 8.1.0 |
|
| 421 | + */ |
|
| 422 | + public function acquireLock($path, $type, ILockingProvider $provider); |
|
| 423 | + |
|
| 424 | + /** |
|
| 425 | + * @param string $path The path of the file to acquire the lock for |
|
| 426 | + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 427 | + * @param \OCP\Lock\ILockingProvider $provider |
|
| 428 | + * @throws \OCP\Lock\LockedException |
|
| 429 | + * @since 8.1.0 |
|
| 430 | + */ |
|
| 431 | + public function releaseLock($path, $type, ILockingProvider $provider); |
|
| 432 | + |
|
| 433 | + /** |
|
| 434 | + * @param string $path The path of the file to change the lock for |
|
| 435 | + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 436 | + * @param \OCP\Lock\ILockingProvider $provider |
|
| 437 | + * @throws \OCP\Lock\LockedException |
|
| 438 | + * @since 8.1.0 |
|
| 439 | + */ |
|
| 440 | + public function changeLock($path, $type, ILockingProvider $provider); |
|
| 441 | + |
|
| 442 | + /** |
|
| 443 | + * Test a storage for availability |
|
| 444 | + * |
|
| 445 | + * @since 8.2.0 |
|
| 446 | + * @return bool |
|
| 447 | + */ |
|
| 448 | + public function test(); |
|
| 449 | + |
|
| 450 | + /** |
|
| 451 | + * @since 8.2.0 |
|
| 452 | + * @return array [ available, last_checked ] |
|
| 453 | + */ |
|
| 454 | + public function getAvailability(); |
|
| 455 | + |
|
| 456 | + /** |
|
| 457 | + * @since 8.2.0 |
|
| 458 | + * @param bool $isAvailable |
|
| 459 | + */ |
|
| 460 | + public function setAvailability($isAvailable); |
|
| 461 | + |
|
| 462 | + public function needsPartFile(); |
|
| 463 | 463 | } |
@@ -27,15 +27,15 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class StorageAuthException extends StorageNotAvailableException { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * StorageAuthException constructor. |
|
| 32 | - * |
|
| 33 | - * @param string $message |
|
| 34 | - * @param \Exception|null $previous |
|
| 35 | - * @since 9.0.0 |
|
| 36 | - */ |
|
| 37 | - public function __construct($message = '', \Exception $previous = null) { |
|
| 38 | - $l = \OC::$server->getL10N('core'); |
|
| 39 | - parent::__construct($l->t('Storage unauthorized. %s', [$message]), self::STATUS_UNAUTHORIZED, $previous); |
|
| 40 | - } |
|
| 30 | + /** |
|
| 31 | + * StorageAuthException constructor. |
|
| 32 | + * |
|
| 33 | + * @param string $message |
|
| 34 | + * @param \Exception|null $previous |
|
| 35 | + * @since 9.0.0 |
|
| 36 | + */ |
|
| 37 | + public function __construct($message = '', \Exception $previous = null) { |
|
| 38 | + $l = \OC::$server->getL10N('core'); |
|
| 39 | + parent::__construct($l->t('Storage unauthorized. %s', [$message]), self::STATUS_UNAUTHORIZED, $previous); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -27,16 +27,16 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class StorageBadConfigException extends StorageNotAvailableException { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * ExtStorageBadConfigException constructor. |
|
| 32 | - * |
|
| 33 | - * @param string $message |
|
| 34 | - * @param \Exception|null $previous |
|
| 35 | - * @since 9.0.0 |
|
| 36 | - */ |
|
| 37 | - public function __construct($message = '', \Exception $previous = null) { |
|
| 38 | - $l = \OC::$server->getL10N('core'); |
|
| 39 | - parent::__construct($l->t('Storage incomplete configuration. %s', [$message]), self::STATUS_INCOMPLETE_CONF, $previous); |
|
| 40 | - } |
|
| 30 | + /** |
|
| 31 | + * ExtStorageBadConfigException constructor. |
|
| 32 | + * |
|
| 33 | + * @param string $message |
|
| 34 | + * @param \Exception|null $previous |
|
| 35 | + * @since 9.0.0 |
|
| 36 | + */ |
|
| 37 | + public function __construct($message = '', \Exception $previous = null) { |
|
| 38 | + $l = \OC::$server->getL10N('core'); |
|
| 39 | + parent::__construct($l->t('Storage incomplete configuration. %s', [$message]), self::STATUS_INCOMPLETE_CONF, $previous); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | } |