Passed
Push — master ( d005ce...2d856c )
by Roeland
18:37 queued 03:15
created
lib/private/DB/MigrationException.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,17 +24,17 @@
 block discarded – undo
24 24
 namespace OC\DB;
25 25
 
26 26
 class MigrationException extends \Exception {
27
-	private $table;
27
+    private $table;
28 28
 
29
-	public function __construct($table, $message) {
30
-		$this->table = $table;
31
-		parent::__construct($message);
32
-	}
29
+    public function __construct($table, $message) {
30
+        $this->table = $table;
31
+        parent::__construct($message);
32
+    }
33 33
 
34
-	/**
35
-	 * @return string
36
-	 */
37
-	public function getTable() {
38
-		return $this->table;
39
-	}
34
+    /**
35
+     * @return string
36
+     */
37
+    public function getTable() {
38
+        return $this->table;
39
+    }
40 40
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/CompositeExpression.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -25,68 +25,68 @@
 block discarded – undo
25 25
 use OCP\DB\QueryBuilder\ICompositeExpression;
26 26
 
27 27
 class CompositeExpression implements ICompositeExpression, \Countable {
28
-	/** @var \Doctrine\DBAL\Query\Expression\CompositeExpression */
29
-	protected $compositeExpression;
28
+    /** @var \Doctrine\DBAL\Query\Expression\CompositeExpression */
29
+    protected $compositeExpression;
30 30
 
31
-	/**
32
-	 * Constructor.
33
-	 *
34
-	 * @param \Doctrine\DBAL\Query\Expression\CompositeExpression $compositeExpression
35
-	 */
36
-	public function __construct(\Doctrine\DBAL\Query\Expression\CompositeExpression $compositeExpression) {
37
-		$this->compositeExpression = $compositeExpression;
38
-	}
31
+    /**
32
+     * Constructor.
33
+     *
34
+     * @param \Doctrine\DBAL\Query\Expression\CompositeExpression $compositeExpression
35
+     */
36
+    public function __construct(\Doctrine\DBAL\Query\Expression\CompositeExpression $compositeExpression) {
37
+        $this->compositeExpression = $compositeExpression;
38
+    }
39 39
 
40
-	/**
41
-	 * Adds multiple parts to composite expression.
42
-	 *
43
-	 * @param array $parts
44
-	 *
45
-	 * @return \OCP\DB\QueryBuilder\ICompositeExpression
46
-	 */
47
-	public function addMultiple(array $parts = []) {
48
-		$this->compositeExpression->addMultiple($parts);
40
+    /**
41
+     * Adds multiple parts to composite expression.
42
+     *
43
+     * @param array $parts
44
+     *
45
+     * @return \OCP\DB\QueryBuilder\ICompositeExpression
46
+     */
47
+    public function addMultiple(array $parts = []) {
48
+        $this->compositeExpression->addMultiple($parts);
49 49
 
50
-		return $this;
51
-	}
50
+        return $this;
51
+    }
52 52
 
53
-	/**
54
-	 * Adds an expression to composite expression.
55
-	 *
56
-	 * @param mixed $part
57
-	 *
58
-	 * @return \OCP\DB\QueryBuilder\ICompositeExpression
59
-	 */
60
-	public function add($part) {
61
-		$this->compositeExpression->add($part);
53
+    /**
54
+     * Adds an expression to composite expression.
55
+     *
56
+     * @param mixed $part
57
+     *
58
+     * @return \OCP\DB\QueryBuilder\ICompositeExpression
59
+     */
60
+    public function add($part) {
61
+        $this->compositeExpression->add($part);
62 62
 
63
-		return $this;
64
-	}
63
+        return $this;
64
+    }
65 65
 
66
-	/**
67
-	 * Retrieves the amount of expressions on composite expression.
68
-	 *
69
-	 * @return integer
70
-	 */
71
-	public function count() {
72
-		return $this->compositeExpression->count();
73
-	}
66
+    /**
67
+     * Retrieves the amount of expressions on composite expression.
68
+     *
69
+     * @return integer
70
+     */
71
+    public function count() {
72
+        return $this->compositeExpression->count();
73
+    }
74 74
 
75
-	/**
76
-	 * Returns the type of this composite expression (AND/OR).
77
-	 *
78
-	 * @return string
79
-	 */
80
-	public function getType() {
81
-		return $this->compositeExpression->getType();
82
-	}
75
+    /**
76
+     * Returns the type of this composite expression (AND/OR).
77
+     *
78
+     * @return string
79
+     */
80
+    public function getType() {
81
+        return $this->compositeExpression->getType();
82
+    }
83 83
 
84
-	/**
85
-	 * Retrieves the string representation of this composite expression.
86
-	 *
87
-	 * @return string
88
-	 */
89
-	public function __toString() {
90
-		return (string) $this->compositeExpression;
91
-	}
84
+    /**
85
+     * Retrieves the string representation of this composite expression.
86
+     *
87
+     * @return string
88
+     */
89
+    public function __toString() {
90
+        return (string) $this->compositeExpression;
91
+    }
92 92
 }
Please login to merge, or discard this patch.
lib/private/DB/QueryBuilder/Literal.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/private/DB/MySQLMigrator.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -29,47 +29,47 @@
 block discarded – undo
29 29
 use Doctrine\DBAL\Schema\Table;
30 30
 
31 31
 class MySQLMigrator extends Migrator {
32
-	/**
33
-	 * @param Schema $targetSchema
34
-	 * @param \Doctrine\DBAL\Connection $connection
35
-	 * @return \Doctrine\DBAL\Schema\SchemaDiff
36
-	 */
37
-	protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
38
-		$platform = $connection->getDatabasePlatform();
39
-		$platform->registerDoctrineTypeMapping('enum', 'string');
40
-		$platform->registerDoctrineTypeMapping('bit', 'string');
32
+    /**
33
+     * @param Schema $targetSchema
34
+     * @param \Doctrine\DBAL\Connection $connection
35
+     * @return \Doctrine\DBAL\Schema\SchemaDiff
36
+     */
37
+    protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
38
+        $platform = $connection->getDatabasePlatform();
39
+        $platform->registerDoctrineTypeMapping('enum', 'string');
40
+        $platform->registerDoctrineTypeMapping('bit', 'string');
41 41
 
42
-		$schemaDiff = parent::getDiff($targetSchema, $connection);
42
+        $schemaDiff = parent::getDiff($targetSchema, $connection);
43 43
 
44
-		// identifiers need to be quoted for mysql
45
-		foreach ($schemaDiff->changedTables as $tableDiff) {
46
-			$tableDiff->name = $this->connection->quoteIdentifier($tableDiff->name);
47
-			foreach ($tableDiff->changedColumns as $column) {
48
-				$column->oldColumnName = $this->connection->quoteIdentifier($column->oldColumnName);
49
-			}
50
-		}
44
+        // identifiers need to be quoted for mysql
45
+        foreach ($schemaDiff->changedTables as $tableDiff) {
46
+            $tableDiff->name = $this->connection->quoteIdentifier($tableDiff->name);
47
+            foreach ($tableDiff->changedColumns as $column) {
48
+                $column->oldColumnName = $this->connection->quoteIdentifier($column->oldColumnName);
49
+            }
50
+        }
51 51
 
52
-		return $schemaDiff;
53
-	}
52
+        return $schemaDiff;
53
+    }
54 54
 	
55
-	/**
56
-	 * Speed up migration test by disabling autocommit and unique indexes check
57
-	 *
58
-	 * @param \Doctrine\DBAL\Schema\Table $table
59
-	 * @throws \OC\DB\MigrationException
60
-	 */
61
-	protected function checkTableMigrate(Table $table) {
62
-		$this->connection->exec('SET autocommit=0');
63
-		$this->connection->exec('SET unique_checks=0');
55
+    /**
56
+     * Speed up migration test by disabling autocommit and unique indexes check
57
+     *
58
+     * @param \Doctrine\DBAL\Schema\Table $table
59
+     * @throws \OC\DB\MigrationException
60
+     */
61
+    protected function checkTableMigrate(Table $table) {
62
+        $this->connection->exec('SET autocommit=0');
63
+        $this->connection->exec('SET unique_checks=0');
64 64
 
65
-		try {
66
-			parent::checkTableMigrate($table);
67
-		} catch (\Exception $e) {
68
-			$this->connection->exec('SET unique_checks=1');
69
-			$this->connection->exec('SET autocommit=1');
70
-			throw new MigrationException($table->getName(), $e->getMessage());
71
-		}
72
-		$this->connection->exec('SET unique_checks=1');
73
-		$this->connection->exec('SET autocommit=1');
74
-	}
65
+        try {
66
+            parent::checkTableMigrate($table);
67
+        } catch (\Exception $e) {
68
+            $this->connection->exec('SET unique_checks=1');
69
+            $this->connection->exec('SET autocommit=1');
70
+            throw new MigrationException($table->getName(), $e->getMessage());
71
+        }
72
+        $this->connection->exec('SET unique_checks=1');
73
+        $this->connection->exec('SET autocommit=1');
74
+    }
75 75
 }
Please login to merge, or discard this patch.
lib/private/Command/FileAccess.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/private/Memcache/Memcached.php 1 patch
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -33,193 +33,193 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/private/Memcache/NullCache.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -27,47 +27,47 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/Entry.php 1 patch
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -29,140 +29,140 @@
 block discarded – undo
29 29
 
30 30
 class Entry implements IEntry {
31 31
 
32
-	/** @var string|int|null */
33
-	private $id = null;
34
-
35
-	/** @var string */
36
-	private $fullName = '';
37
-
38
-	/** @var string[] */
39
-	private $emailAddresses = [];
40
-
41
-	/** @var string|null */
42
-	private $avatar;
43
-
44
-	/** @var IAction[] */
45
-	private $actions = [];
46
-
47
-	/** @var array */
48
-	private $properties = [];
49
-
50
-	/**
51
-	 * @param string $id
52
-	 */
53
-	public function setId($id) {
54
-		$this->id = $id;
55
-	}
56
-
57
-	/**
58
-	 * @param string $displayName
59
-	 */
60
-	public function setFullName($displayName) {
61
-		$this->fullName = $displayName;
62
-	}
63
-
64
-	/**
65
-	 * @return string
66
-	 */
67
-	public function getFullName() {
68
-		return $this->fullName;
69
-	}
70
-
71
-	/**
72
-	 * @param string $address
73
-	 */
74
-	public function addEMailAddress($address) {
75
-		$this->emailAddresses[] = $address;
76
-	}
77
-
78
-	/**
79
-	 * @return string
80
-	 */
81
-	public function getEMailAddresses() {
82
-		return $this->emailAddresses;
83
-	}
84
-
85
-	/**
86
-	 * @param string $avatar
87
-	 */
88
-	public function setAvatar($avatar) {
89
-		$this->avatar = $avatar;
90
-	}
91
-
92
-	/**
93
-	 * @return string
94
-	 */
95
-	public function getAvatar() {
96
-		return $this->avatar;
97
-	}
98
-
99
-	/**
100
-	 * @param IAction $action
101
-	 */
102
-	public function addAction(IAction $action) {
103
-		$this->actions[] = $action;
104
-		$this->sortActions();
105
-	}
106
-
107
-	/**
108
-	 * @return IAction[]
109
-	 */
110
-	public function getActions() {
111
-		return $this->actions;
112
-	}
113
-
114
-	/**
115
-	 * sort the actions by priority and name
116
-	 */
117
-	private function sortActions() {
118
-		usort($this->actions, function (IAction $action1, IAction $action2) {
119
-			$prio1 = $action1->getPriority();
120
-			$prio2 = $action2->getPriority();
121
-
122
-			if ($prio1 === $prio2) {
123
-				// Ascending order for same priority
124
-				return strcasecmp($action1->getName(), $action2->getName());
125
-			}
126
-
127
-			// Descending order when priority differs
128
-			return $prio2 - $prio1;
129
-		});
130
-	}
131
-
132
-	/**
133
-	 * @param array $contact key-value array containing additional properties
134
-	 */
135
-	public function setProperties(array $contact) {
136
-		$this->properties = $contact;
137
-	}
138
-
139
-	/**
140
-	 * @param string $key
141
-	 * @return mixed
142
-	 */
143
-	public function getProperty($key) {
144
-		if (!isset($this->properties[$key])) {
145
-			return null;
146
-		}
147
-		return $this->properties[$key];
148
-	}
149
-
150
-	/**
151
-	 * @return array
152
-	 */
153
-	public function jsonSerialize() {
154
-		$topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
155
-		$otherActions = array_map(function (IAction $action) {
156
-			return $action->jsonSerialize();
157
-		}, array_slice($this->actions, 1));
158
-
159
-		return [
160
-			'id' => $this->id,
161
-			'fullName' => $this->fullName,
162
-			'avatar' => $this->getAvatar(),
163
-			'topAction' => $topAction,
164
-			'actions' => $otherActions,
165
-			'lastMessage' => '',
166
-		];
167
-	}
32
+    /** @var string|int|null */
33
+    private $id = null;
34
+
35
+    /** @var string */
36
+    private $fullName = '';
37
+
38
+    /** @var string[] */
39
+    private $emailAddresses = [];
40
+
41
+    /** @var string|null */
42
+    private $avatar;
43
+
44
+    /** @var IAction[] */
45
+    private $actions = [];
46
+
47
+    /** @var array */
48
+    private $properties = [];
49
+
50
+    /**
51
+     * @param string $id
52
+     */
53
+    public function setId($id) {
54
+        $this->id = $id;
55
+    }
56
+
57
+    /**
58
+     * @param string $displayName
59
+     */
60
+    public function setFullName($displayName) {
61
+        $this->fullName = $displayName;
62
+    }
63
+
64
+    /**
65
+     * @return string
66
+     */
67
+    public function getFullName() {
68
+        return $this->fullName;
69
+    }
70
+
71
+    /**
72
+     * @param string $address
73
+     */
74
+    public function addEMailAddress($address) {
75
+        $this->emailAddresses[] = $address;
76
+    }
77
+
78
+    /**
79
+     * @return string
80
+     */
81
+    public function getEMailAddresses() {
82
+        return $this->emailAddresses;
83
+    }
84
+
85
+    /**
86
+     * @param string $avatar
87
+     */
88
+    public function setAvatar($avatar) {
89
+        $this->avatar = $avatar;
90
+    }
91
+
92
+    /**
93
+     * @return string
94
+     */
95
+    public function getAvatar() {
96
+        return $this->avatar;
97
+    }
98
+
99
+    /**
100
+     * @param IAction $action
101
+     */
102
+    public function addAction(IAction $action) {
103
+        $this->actions[] = $action;
104
+        $this->sortActions();
105
+    }
106
+
107
+    /**
108
+     * @return IAction[]
109
+     */
110
+    public function getActions() {
111
+        return $this->actions;
112
+    }
113
+
114
+    /**
115
+     * sort the actions by priority and name
116
+     */
117
+    private function sortActions() {
118
+        usort($this->actions, function (IAction $action1, IAction $action2) {
119
+            $prio1 = $action1->getPriority();
120
+            $prio2 = $action2->getPriority();
121
+
122
+            if ($prio1 === $prio2) {
123
+                // Ascending order for same priority
124
+                return strcasecmp($action1->getName(), $action2->getName());
125
+            }
126
+
127
+            // Descending order when priority differs
128
+            return $prio2 - $prio1;
129
+        });
130
+    }
131
+
132
+    /**
133
+     * @param array $contact key-value array containing additional properties
134
+     */
135
+    public function setProperties(array $contact) {
136
+        $this->properties = $contact;
137
+    }
138
+
139
+    /**
140
+     * @param string $key
141
+     * @return mixed
142
+     */
143
+    public function getProperty($key) {
144
+        if (!isset($this->properties[$key])) {
145
+            return null;
146
+        }
147
+        return $this->properties[$key];
148
+    }
149
+
150
+    /**
151
+     * @return array
152
+     */
153
+    public function jsonSerialize() {
154
+        $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
155
+        $otherActions = array_map(function (IAction $action) {
156
+            return $action->jsonSerialize();
157
+        }, array_slice($this->actions, 1));
158
+
159
+        return [
160
+            'id' => $this->id,
161
+            'fullName' => $this->fullName,
162
+            'avatar' => $this->getAvatar(),
163
+            'topAction' => $topAction,
164
+            'actions' => $otherActions,
165
+            'lastMessage' => '',
166
+        ];
167
+    }
168 168
 }
Please login to merge, or discard this patch.
lib/private/BackgroundJob/Legacy/QueuedJob.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.