@@ -25,17 +25,17 @@ |
||
| 25 | 25 | use OCP\DB\QueryBuilder\ILiteral; |
| 26 | 26 | |
| 27 | 27 | class Literal implements ILiteral { |
| 28 | - /** @var mixed */ |
|
| 29 | - protected $literal; |
|
| 28 | + /** @var mixed */ |
|
| 29 | + protected $literal; |
|
| 30 | 30 | |
| 31 | - public function __construct($literal) { |
|
| 32 | - $this->literal = $literal; |
|
| 33 | - } |
|
| 31 | + public function __construct($literal) { |
|
| 32 | + $this->literal = $literal; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @return string |
|
| 37 | - */ |
|
| 38 | - public function __toString() { |
|
| 39 | - return (string) $this->literal; |
|
| 40 | - } |
|
| 35 | + /** |
|
| 36 | + * @return string |
|
| 37 | + */ |
|
| 38 | + public function __toString() { |
|
| 39 | + return (string) $this->literal; |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -25,12 +25,12 @@ |
||
| 25 | 25 | use OCP\IUser; |
| 26 | 26 | |
| 27 | 27 | trait FileAccess { |
| 28 | - protected function setupFS(IUser $user) { |
|
| 29 | - \OC_Util::setupFS($user->getUID()); |
|
| 30 | - } |
|
| 28 | + protected function setupFS(IUser $user) { |
|
| 29 | + \OC_Util::setupFS($user->getUID()); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - protected function getUserFolder(IUser $user) { |
|
| 33 | - $this->setupFS($user); |
|
| 34 | - return \OC::$server->getUserFolder($user->getUID()); |
|
| 35 | - } |
|
| 32 | + protected function getUserFolder(IUser $user) { |
|
| 33 | + $this->setupFS($user); |
|
| 34 | + return \OC::$server->getUserFolder($user->getUID()); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -33,193 +33,193 @@ |
||
| 33 | 33 | use OCP\IMemcache; |
| 34 | 34 | |
| 35 | 35 | class Memcached extends Cache implements IMemcache { |
| 36 | - use CASTrait; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @var \Memcached $cache |
|
| 40 | - */ |
|
| 41 | - private static $cache = null; |
|
| 42 | - |
|
| 43 | - use CADTrait; |
|
| 44 | - |
|
| 45 | - public function __construct($prefix = '') { |
|
| 46 | - parent::__construct($prefix); |
|
| 47 | - if (is_null(self::$cache)) { |
|
| 48 | - self::$cache = new \Memcached(); |
|
| 49 | - |
|
| 50 | - $defaultOptions = [ |
|
| 51 | - \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
| 52 | - \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
| 53 | - \Memcached::OPT_SEND_TIMEOUT => 50, |
|
| 54 | - \Memcached::OPT_RECV_TIMEOUT => 50, |
|
| 55 | - \Memcached::OPT_POLL_TIMEOUT => 50, |
|
| 56 | - |
|
| 57 | - // Enable compression |
|
| 58 | - \Memcached::OPT_COMPRESSION => true, |
|
| 59 | - |
|
| 60 | - // Turn on consistent hashing |
|
| 61 | - \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
| 62 | - |
|
| 63 | - // Enable Binary Protocol |
|
| 64 | - //\Memcached::OPT_BINARY_PROTOCOL => true, |
|
| 65 | - ]; |
|
| 66 | - // by default enable igbinary serializer if available |
|
| 67 | - if (\Memcached::HAVE_IGBINARY) { |
|
| 68 | - $defaultOptions[\Memcached::OPT_SERIALIZER] = |
|
| 69 | - \Memcached::SERIALIZER_IGBINARY; |
|
| 70 | - } |
|
| 71 | - $options = \OC::$server->getConfig()->getSystemValue('memcached_options', []); |
|
| 72 | - if (is_array($options)) { |
|
| 73 | - $options = $options + $defaultOptions; |
|
| 74 | - self::$cache->setOptions($options); |
|
| 75 | - } else { |
|
| 76 | - throw new HintException("Expected 'memcached_options' config to be an array, got $options"); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers'); |
|
| 80 | - if (!$servers) { |
|
| 81 | - $server = \OC::$server->getSystemConfig()->getValue('memcached_server'); |
|
| 82 | - if ($server) { |
|
| 83 | - $servers = [$server]; |
|
| 84 | - } else { |
|
| 85 | - $servers = [['localhost', 11211]]; |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - self::$cache->addServers($servers); |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * entries in XCache gets namespaced to prevent collisions between owncloud instances and users |
|
| 94 | - */ |
|
| 95 | - protected function getNameSpace() { |
|
| 96 | - return $this->prefix; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - public function get($key) { |
|
| 100 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
| 101 | - if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
|
| 102 | - return null; |
|
| 103 | - } else { |
|
| 104 | - return $result; |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - public function set($key, $value, $ttl = 0) { |
|
| 109 | - if ($ttl > 0) { |
|
| 110 | - $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
| 111 | - } else { |
|
| 112 | - $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
| 113 | - } |
|
| 114 | - if ($result !== true) { |
|
| 115 | - $this->verifyReturnCode(); |
|
| 116 | - } |
|
| 117 | - return $result; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - public function hasKey($key) { |
|
| 121 | - self::$cache->get($this->getNameSpace() . $key); |
|
| 122 | - return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - public function remove($key) { |
|
| 126 | - $result = self::$cache->delete($this->getNameSpace() . $key); |
|
| 127 | - if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
|
| 128 | - $this->verifyReturnCode(); |
|
| 129 | - } |
|
| 130 | - return $result; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - public function clear($prefix = '') { |
|
| 134 | - $prefix = $this->getNameSpace() . $prefix; |
|
| 135 | - $allKeys = self::$cache->getAllKeys(); |
|
| 136 | - if ($allKeys === false) { |
|
| 137 | - // newer Memcached doesn't like getAllKeys(), flush everything |
|
| 138 | - self::$cache->flush(); |
|
| 139 | - return true; |
|
| 140 | - } |
|
| 141 | - $keys = []; |
|
| 142 | - $prefixLength = strlen($prefix); |
|
| 143 | - foreach ($allKeys as $key) { |
|
| 144 | - if (substr($key, 0, $prefixLength) === $prefix) { |
|
| 145 | - $keys[] = $key; |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - if (method_exists(self::$cache, 'deleteMulti')) { |
|
| 149 | - self::$cache->deleteMulti($keys); |
|
| 150 | - } else { |
|
| 151 | - foreach ($keys as $key) { |
|
| 152 | - self::$cache->delete($key); |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - return true; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * Set a value in the cache if it's not already stored |
|
| 160 | - * |
|
| 161 | - * @param string $key |
|
| 162 | - * @param mixed $value |
|
| 163 | - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
| 164 | - * @return bool |
|
| 165 | - * @throws \Exception |
|
| 166 | - */ |
|
| 167 | - public function add($key, $value, $ttl = 0) { |
|
| 168 | - $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
| 169 | - if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
|
| 170 | - $this->verifyReturnCode(); |
|
| 171 | - } |
|
| 172 | - return $result; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Increase a stored number |
|
| 177 | - * |
|
| 178 | - * @param string $key |
|
| 179 | - * @param int $step |
|
| 180 | - * @return int | bool |
|
| 181 | - */ |
|
| 182 | - public function inc($key, $step = 1) { |
|
| 183 | - $this->add($key, 0); |
|
| 184 | - $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
| 185 | - |
|
| 186 | - if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 187 | - return false; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - return $result; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * Decrease a stored number |
|
| 195 | - * |
|
| 196 | - * @param string $key |
|
| 197 | - * @param int $step |
|
| 198 | - * @return int | bool |
|
| 199 | - */ |
|
| 200 | - public function dec($key, $step = 1) { |
|
| 201 | - $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
| 202 | - |
|
| 203 | - if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 204 | - return false; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - return $result; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - public static function isAvailable() { |
|
| 211 | - return extension_loaded('memcached'); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * @throws \Exception |
|
| 216 | - */ |
|
| 217 | - private function verifyReturnCode() { |
|
| 218 | - $code = self::$cache->getResultCode(); |
|
| 219 | - if ($code === \Memcached::RES_SUCCESS) { |
|
| 220 | - return; |
|
| 221 | - } |
|
| 222 | - $message = self::$cache->getResultMessage(); |
|
| 223 | - throw new \Exception("Error $code interacting with memcached : $message"); |
|
| 224 | - } |
|
| 36 | + use CASTrait; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @var \Memcached $cache |
|
| 40 | + */ |
|
| 41 | + private static $cache = null; |
|
| 42 | + |
|
| 43 | + use CADTrait; |
|
| 44 | + |
|
| 45 | + public function __construct($prefix = '') { |
|
| 46 | + parent::__construct($prefix); |
|
| 47 | + if (is_null(self::$cache)) { |
|
| 48 | + self::$cache = new \Memcached(); |
|
| 49 | + |
|
| 50 | + $defaultOptions = [ |
|
| 51 | + \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
| 52 | + \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
| 53 | + \Memcached::OPT_SEND_TIMEOUT => 50, |
|
| 54 | + \Memcached::OPT_RECV_TIMEOUT => 50, |
|
| 55 | + \Memcached::OPT_POLL_TIMEOUT => 50, |
|
| 56 | + |
|
| 57 | + // Enable compression |
|
| 58 | + \Memcached::OPT_COMPRESSION => true, |
|
| 59 | + |
|
| 60 | + // Turn on consistent hashing |
|
| 61 | + \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
| 62 | + |
|
| 63 | + // Enable Binary Protocol |
|
| 64 | + //\Memcached::OPT_BINARY_PROTOCOL => true, |
|
| 65 | + ]; |
|
| 66 | + // by default enable igbinary serializer if available |
|
| 67 | + if (\Memcached::HAVE_IGBINARY) { |
|
| 68 | + $defaultOptions[\Memcached::OPT_SERIALIZER] = |
|
| 69 | + \Memcached::SERIALIZER_IGBINARY; |
|
| 70 | + } |
|
| 71 | + $options = \OC::$server->getConfig()->getSystemValue('memcached_options', []); |
|
| 72 | + if (is_array($options)) { |
|
| 73 | + $options = $options + $defaultOptions; |
|
| 74 | + self::$cache->setOptions($options); |
|
| 75 | + } else { |
|
| 76 | + throw new HintException("Expected 'memcached_options' config to be an array, got $options"); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers'); |
|
| 80 | + if (!$servers) { |
|
| 81 | + $server = \OC::$server->getSystemConfig()->getValue('memcached_server'); |
|
| 82 | + if ($server) { |
|
| 83 | + $servers = [$server]; |
|
| 84 | + } else { |
|
| 85 | + $servers = [['localhost', 11211]]; |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + self::$cache->addServers($servers); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * entries in XCache gets namespaced to prevent collisions between owncloud instances and users |
|
| 94 | + */ |
|
| 95 | + protected function getNameSpace() { |
|
| 96 | + return $this->prefix; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + public function get($key) { |
|
| 100 | + $result = self::$cache->get($this->getNameSpace() . $key); |
|
| 101 | + if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
|
| 102 | + return null; |
|
| 103 | + } else { |
|
| 104 | + return $result; |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + public function set($key, $value, $ttl = 0) { |
|
| 109 | + if ($ttl > 0) { |
|
| 110 | + $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
| 111 | + } else { |
|
| 112 | + $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
| 113 | + } |
|
| 114 | + if ($result !== true) { |
|
| 115 | + $this->verifyReturnCode(); |
|
| 116 | + } |
|
| 117 | + return $result; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + public function hasKey($key) { |
|
| 121 | + self::$cache->get($this->getNameSpace() . $key); |
|
| 122 | + return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + public function remove($key) { |
|
| 126 | + $result = self::$cache->delete($this->getNameSpace() . $key); |
|
| 127 | + if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
|
| 128 | + $this->verifyReturnCode(); |
|
| 129 | + } |
|
| 130 | + return $result; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + public function clear($prefix = '') { |
|
| 134 | + $prefix = $this->getNameSpace() . $prefix; |
|
| 135 | + $allKeys = self::$cache->getAllKeys(); |
|
| 136 | + if ($allKeys === false) { |
|
| 137 | + // newer Memcached doesn't like getAllKeys(), flush everything |
|
| 138 | + self::$cache->flush(); |
|
| 139 | + return true; |
|
| 140 | + } |
|
| 141 | + $keys = []; |
|
| 142 | + $prefixLength = strlen($prefix); |
|
| 143 | + foreach ($allKeys as $key) { |
|
| 144 | + if (substr($key, 0, $prefixLength) === $prefix) { |
|
| 145 | + $keys[] = $key; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + if (method_exists(self::$cache, 'deleteMulti')) { |
|
| 149 | + self::$cache->deleteMulti($keys); |
|
| 150 | + } else { |
|
| 151 | + foreach ($keys as $key) { |
|
| 152 | + self::$cache->delete($key); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + return true; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * Set a value in the cache if it's not already stored |
|
| 160 | + * |
|
| 161 | + * @param string $key |
|
| 162 | + * @param mixed $value |
|
| 163 | + * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
| 164 | + * @return bool |
|
| 165 | + * @throws \Exception |
|
| 166 | + */ |
|
| 167 | + public function add($key, $value, $ttl = 0) { |
|
| 168 | + $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
| 169 | + if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
|
| 170 | + $this->verifyReturnCode(); |
|
| 171 | + } |
|
| 172 | + return $result; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Increase a stored number |
|
| 177 | + * |
|
| 178 | + * @param string $key |
|
| 179 | + * @param int $step |
|
| 180 | + * @return int | bool |
|
| 181 | + */ |
|
| 182 | + public function inc($key, $step = 1) { |
|
| 183 | + $this->add($key, 0); |
|
| 184 | + $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
| 185 | + |
|
| 186 | + if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 187 | + return false; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + return $result; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * Decrease a stored number |
|
| 195 | + * |
|
| 196 | + * @param string $key |
|
| 197 | + * @param int $step |
|
| 198 | + * @return int | bool |
|
| 199 | + */ |
|
| 200 | + public function dec($key, $step = 1) { |
|
| 201 | + $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
| 202 | + |
|
| 203 | + if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
|
| 204 | + return false; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + return $result; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + public static function isAvailable() { |
|
| 211 | + return extension_loaded('memcached'); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * @throws \Exception |
|
| 216 | + */ |
|
| 217 | + private function verifyReturnCode() { |
|
| 218 | + $code = self::$cache->getResultCode(); |
|
| 219 | + if ($code === \Memcached::RES_SUCCESS) { |
|
| 220 | + return; |
|
| 221 | + } |
|
| 222 | + $message = self::$cache->getResultMessage(); |
|
| 223 | + throw new \Exception("Error $code interacting with memcached : $message"); |
|
| 224 | + } |
|
| 225 | 225 | } |
@@ -27,47 +27,47 @@ |
||
| 27 | 27 | namespace OC\Memcache; |
| 28 | 28 | |
| 29 | 29 | class NullCache extends Cache implements \OCP\IMemcache { |
| 30 | - public function get($key) { |
|
| 31 | - return null; |
|
| 32 | - } |
|
| 30 | + public function get($key) { |
|
| 31 | + return null; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function set($key, $value, $ttl = 0) { |
|
| 35 | - return true; |
|
| 36 | - } |
|
| 34 | + public function set($key, $value, $ttl = 0) { |
|
| 35 | + return true; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function hasKey($key) { |
|
| 39 | - return false; |
|
| 40 | - } |
|
| 38 | + public function hasKey($key) { |
|
| 39 | + return false; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function remove($key) { |
|
| 43 | - return true; |
|
| 44 | - } |
|
| 42 | + public function remove($key) { |
|
| 43 | + return true; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public function add($key, $value, $ttl = 0) { |
|
| 47 | - return true; |
|
| 48 | - } |
|
| 46 | + public function add($key, $value, $ttl = 0) { |
|
| 47 | + return true; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function inc($key, $step = 1) { |
|
| 51 | - return true; |
|
| 52 | - } |
|
| 50 | + public function inc($key, $step = 1) { |
|
| 51 | + return true; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function dec($key, $step = 1) { |
|
| 55 | - return true; |
|
| 56 | - } |
|
| 54 | + public function dec($key, $step = 1) { |
|
| 55 | + return true; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function cas($key, $old, $new) { |
|
| 59 | - return true; |
|
| 60 | - } |
|
| 58 | + public function cas($key, $old, $new) { |
|
| 59 | + return true; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function cad($key, $old) { |
|
| 63 | - return true; |
|
| 64 | - } |
|
| 62 | + public function cad($key, $old) { |
|
| 63 | + return true; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function clear($prefix = '') { |
|
| 67 | - return true; |
|
| 68 | - } |
|
| 66 | + public function clear($prefix = '') { |
|
| 67 | + return true; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - public static function isAvailable() { |
|
| 71 | - return true; |
|
| 72 | - } |
|
| 70 | + public static function isAvailable() { |
|
| 71 | + return true; |
|
| 72 | + } |
|
| 73 | 73 | } |
@@ -24,12 +24,12 @@ |
||
| 24 | 24 | namespace OC\BackgroundJob\Legacy; |
| 25 | 25 | |
| 26 | 26 | class QueuedJob extends \OC\BackgroundJob\QueuedJob { |
| 27 | - public function run($argument) { |
|
| 28 | - $class = $argument['klass']; |
|
| 29 | - $method = $argument['method']; |
|
| 30 | - $parameters = $argument['parameters']; |
|
| 31 | - if (is_callable([$class, $method])) { |
|
| 32 | - call_user_func([$class, $method], $parameters); |
|
| 33 | - } |
|
| 34 | - } |
|
| 27 | + public function run($argument) { |
|
| 28 | + $class = $argument['klass']; |
|
| 29 | + $method = $argument['method']; |
|
| 30 | + $parameters = $argument['parameters']; |
|
| 31 | + if (is_callable([$class, $method])) { |
|
| 32 | + call_user_func([$class, $method], $parameters); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -26,37 +26,37 @@ |
||
| 26 | 26 | namespace OC\Template; |
| 27 | 27 | |
| 28 | 28 | class TemplateFileLocator { |
| 29 | - protected $dirs; |
|
| 30 | - private $path; |
|
| 29 | + protected $dirs; |
|
| 30 | + private $path; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @param string[] $dirs |
|
| 34 | - */ |
|
| 35 | - public function __construct($dirs) { |
|
| 36 | - $this->dirs = $dirs; |
|
| 37 | - } |
|
| 32 | + /** |
|
| 33 | + * @param string[] $dirs |
|
| 34 | + */ |
|
| 35 | + public function __construct($dirs) { |
|
| 36 | + $this->dirs = $dirs; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param string $template |
|
| 41 | - * @return string |
|
| 42 | - * @throws \Exception |
|
| 43 | - */ |
|
| 44 | - public function find($template) { |
|
| 45 | - if ($template === '') { |
|
| 46 | - throw new \InvalidArgumentException('Empty template name'); |
|
| 47 | - } |
|
| 39 | + /** |
|
| 40 | + * @param string $template |
|
| 41 | + * @return string |
|
| 42 | + * @throws \Exception |
|
| 43 | + */ |
|
| 44 | + public function find($template) { |
|
| 45 | + if ($template === '') { |
|
| 46 | + throw new \InvalidArgumentException('Empty template name'); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - foreach ($this->dirs as $dir) { |
|
| 50 | - $file = $dir.$template.'.php'; |
|
| 51 | - if (is_file($file)) { |
|
| 52 | - $this->path = $dir; |
|
| 53 | - return $file; |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - throw new \Exception('template file not found: template:'.$template); |
|
| 57 | - } |
|
| 49 | + foreach ($this->dirs as $dir) { |
|
| 50 | + $file = $dir.$template.'.php'; |
|
| 51 | + if (is_file($file)) { |
|
| 52 | + $this->path = $dir; |
|
| 53 | + return $file; |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + throw new \Exception('template file not found: template:'.$template); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function getPath() { |
|
| 60 | - return $this->path; |
|
| 61 | - } |
|
| 59 | + public function getPath() { |
|
| 60 | + return $this->path; |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -28,56 +28,56 @@ |
||
| 28 | 28 | use OCP\Diagnostics\IEventLogger; |
| 29 | 29 | |
| 30 | 30 | class EventLogger implements IEventLogger { |
| 31 | - /** |
|
| 32 | - * @var \OC\Diagnostics\Event[] |
|
| 33 | - */ |
|
| 34 | - private $events = []; |
|
| 31 | + /** |
|
| 32 | + * @var \OC\Diagnostics\Event[] |
|
| 33 | + */ |
|
| 34 | + private $events = []; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var bool - Module needs to be activated by some app |
|
| 38 | - */ |
|
| 39 | - private $activated = false; |
|
| 36 | + /** |
|
| 37 | + * @var bool - Module needs to be activated by some app |
|
| 38 | + */ |
|
| 39 | + private $activated = false; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @inheritdoc |
|
| 43 | - */ |
|
| 44 | - public function start($id, $description) { |
|
| 45 | - if ($this->activated) { |
|
| 46 | - $this->events[$id] = new Event($id, $description, microtime(true)); |
|
| 47 | - } |
|
| 48 | - } |
|
| 41 | + /** |
|
| 42 | + * @inheritdoc |
|
| 43 | + */ |
|
| 44 | + public function start($id, $description) { |
|
| 45 | + if ($this->activated) { |
|
| 46 | + $this->events[$id] = new Event($id, $description, microtime(true)); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @inheritdoc |
|
| 52 | - */ |
|
| 53 | - public function end($id) { |
|
| 54 | - if ($this->activated && isset($this->events[$id])) { |
|
| 55 | - $timing = $this->events[$id]; |
|
| 56 | - $timing->end(microtime(true)); |
|
| 57 | - } |
|
| 58 | - } |
|
| 50 | + /** |
|
| 51 | + * @inheritdoc |
|
| 52 | + */ |
|
| 53 | + public function end($id) { |
|
| 54 | + if ($this->activated && isset($this->events[$id])) { |
|
| 55 | + $timing = $this->events[$id]; |
|
| 56 | + $timing->end(microtime(true)); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @inheritdoc |
|
| 62 | - */ |
|
| 63 | - public function log($id, $description, $start, $end) { |
|
| 64 | - if ($this->activated) { |
|
| 65 | - $this->events[$id] = new Event($id, $description, $start); |
|
| 66 | - $this->events[$id]->end($end); |
|
| 67 | - } |
|
| 68 | - } |
|
| 60 | + /** |
|
| 61 | + * @inheritdoc |
|
| 62 | + */ |
|
| 63 | + public function log($id, $description, $start, $end) { |
|
| 64 | + if ($this->activated) { |
|
| 65 | + $this->events[$id] = new Event($id, $description, $start); |
|
| 66 | + $this->events[$id]->end($end); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @inheritdoc |
|
| 72 | - */ |
|
| 73 | - public function getEvents() { |
|
| 74 | - return $this->events; |
|
| 75 | - } |
|
| 70 | + /** |
|
| 71 | + * @inheritdoc |
|
| 72 | + */ |
|
| 73 | + public function getEvents() { |
|
| 74 | + return $this->events; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @inheritdoc |
|
| 79 | - */ |
|
| 80 | - public function activate() { |
|
| 81 | - $this->activated = true; |
|
| 82 | - } |
|
| 77 | + /** |
|
| 78 | + * @inheritdoc |
|
| 79 | + */ |
|
| 80 | + public function activate() { |
|
| 81 | + $this->activated = true; |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | use OCP\Encryption\Exceptions\GenericEncryptionException; |
| 28 | 28 | |
| 29 | 29 | class EncryptionHeaderToLargeException extends GenericEncryptionException { |
| 30 | - public function __construct() { |
|
| 31 | - parent::__construct('max header size exceeded'); |
|
| 32 | - } |
|
| 30 | + public function __construct() { |
|
| 31 | + parent::__construct('max header size exceeded'); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -36,54 +36,54 @@ |
||
| 36 | 36 | * @method void setName(string $name) |
| 37 | 37 | */ |
| 38 | 38 | class Tag extends Entity { |
| 39 | - protected $owner; |
|
| 40 | - protected $type; |
|
| 41 | - protected $name; |
|
| 39 | + protected $owner; |
|
| 40 | + protected $type; |
|
| 41 | + protected $name; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Constructor. |
|
| 45 | - * |
|
| 46 | - * @param string $owner The tag's owner |
|
| 47 | - * @param string $type The type of item this tag is used for |
|
| 48 | - * @param string $name The tag's name |
|
| 49 | - */ |
|
| 50 | - public function __construct($owner = null, $type = null, $name = null) { |
|
| 51 | - $this->setOwner($owner); |
|
| 52 | - $this->setType($type); |
|
| 53 | - $this->setName($name); |
|
| 54 | - } |
|
| 43 | + /** |
|
| 44 | + * Constructor. |
|
| 45 | + * |
|
| 46 | + * @param string $owner The tag's owner |
|
| 47 | + * @param string $type The type of item this tag is used for |
|
| 48 | + * @param string $name The tag's name |
|
| 49 | + */ |
|
| 50 | + public function __construct($owner = null, $type = null, $name = null) { |
|
| 51 | + $this->setOwner($owner); |
|
| 52 | + $this->setType($type); |
|
| 53 | + $this->setName($name); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Transform a database columnname to a property |
|
| 58 | - * |
|
| 59 | - * @param string $columnName the name of the column |
|
| 60 | - * @return string the property name |
|
| 61 | - * @todo migrate existing database columns to the correct names |
|
| 62 | - * to be able to drop this direct mapping |
|
| 63 | - */ |
|
| 64 | - public function columnToProperty($columnName) { |
|
| 65 | - if ($columnName === 'category') { |
|
| 66 | - return 'name'; |
|
| 67 | - } elseif ($columnName === 'uid') { |
|
| 68 | - return 'owner'; |
|
| 69 | - } else { |
|
| 70 | - return parent::columnToProperty($columnName); |
|
| 71 | - } |
|
| 72 | - } |
|
| 56 | + /** |
|
| 57 | + * Transform a database columnname to a property |
|
| 58 | + * |
|
| 59 | + * @param string $columnName the name of the column |
|
| 60 | + * @return string the property name |
|
| 61 | + * @todo migrate existing database columns to the correct names |
|
| 62 | + * to be able to drop this direct mapping |
|
| 63 | + */ |
|
| 64 | + public function columnToProperty($columnName) { |
|
| 65 | + if ($columnName === 'category') { |
|
| 66 | + return 'name'; |
|
| 67 | + } elseif ($columnName === 'uid') { |
|
| 68 | + return 'owner'; |
|
| 69 | + } else { |
|
| 70 | + return parent::columnToProperty($columnName); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Transform a property to a database column name |
|
| 76 | - * |
|
| 77 | - * @param string $property the name of the property |
|
| 78 | - * @return string the column name |
|
| 79 | - */ |
|
| 80 | - public function propertyToColumn($property) { |
|
| 81 | - if ($property === 'name') { |
|
| 82 | - return 'category'; |
|
| 83 | - } elseif ($property === 'owner') { |
|
| 84 | - return 'uid'; |
|
| 85 | - } else { |
|
| 86 | - return parent::propertyToColumn($property); |
|
| 87 | - } |
|
| 88 | - } |
|
| 74 | + /** |
|
| 75 | + * Transform a property to a database column name |
|
| 76 | + * |
|
| 77 | + * @param string $property the name of the property |
|
| 78 | + * @return string the column name |
|
| 79 | + */ |
|
| 80 | + public function propertyToColumn($property) { |
|
| 81 | + if ($property === 'name') { |
|
| 82 | + return 'category'; |
|
| 83 | + } elseif ($property === 'owner') { |
|
| 84 | + return 'uid'; |
|
| 85 | + } else { |
|
| 86 | + return parent::propertyToColumn($property); |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | 89 | } |