Passed
Push — master ( 8355f9...6d2471 )
by Blizzz
12:04 queued 10s
created
lib/private/Files/SimpleFS/SimpleFolder.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	public function getDirectoryListing() {
50 50
 		$listing = $this->folder->getDirectoryListing();
51 51
 
52
-		$fileListing = array_map(function (Node $file) {
52
+		$fileListing = array_map(function(Node $file) {
53 53
 			if ($file instanceof File) {
54 54
 				return new SimpleFile($file);
55 55
 			}
Please login to merge, or discard this patch.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -32,62 +32,62 @@
 block discarded – undo
32 32
 
33 33
 class SimpleFolder implements ISimpleFolder {
34 34
 
35
-	/** @var Folder */
36
-	private $folder;
37
-
38
-	/**
39
-	 * Folder constructor.
40
-	 *
41
-	 * @param Folder $folder
42
-	 */
43
-	public function __construct(Folder $folder) {
44
-		$this->folder = $folder;
45
-	}
46
-
47
-	public function getName() {
48
-		return $this->folder->getName();
49
-	}
50
-
51
-	public function getDirectoryListing() {
52
-		$listing = $this->folder->getDirectoryListing();
53
-
54
-		$fileListing = array_map(function (Node $file) {
55
-			if ($file instanceof File) {
56
-				return new SimpleFile($file);
57
-			}
58
-			return null;
59
-		}, $listing);
60
-
61
-		$fileListing = array_filter($fileListing);
62
-
63
-		return array_values($fileListing);
64
-	}
65
-
66
-	public function delete() {
67
-		$this->folder->delete();
68
-	}
69
-
70
-	public function fileExists($name) {
71
-		return $this->folder->nodeExists($name);
72
-	}
73
-
74
-	public function getFile($name) {
75
-		$file = $this->folder->get($name);
76
-
77
-		if (!($file instanceof File)) {
78
-			throw new NotFoundException();
79
-		}
80
-
81
-		return new SimpleFile($file);
82
-	}
83
-
84
-	public function newFile($name, $content = null) {
85
-		if ($content === null) {
86
-			// delay creating the file until it's written to
87
-			return new NewSimpleFile($this->folder, $name);
88
-		} else {
89
-			$file = $this->folder->newFile($name, $content);
90
-			return new SimpleFile($file);
91
-		}
92
-	}
35
+    /** @var Folder */
36
+    private $folder;
37
+
38
+    /**
39
+     * Folder constructor.
40
+     *
41
+     * @param Folder $folder
42
+     */
43
+    public function __construct(Folder $folder) {
44
+        $this->folder = $folder;
45
+    }
46
+
47
+    public function getName() {
48
+        return $this->folder->getName();
49
+    }
50
+
51
+    public function getDirectoryListing() {
52
+        $listing = $this->folder->getDirectoryListing();
53
+
54
+        $fileListing = array_map(function (Node $file) {
55
+            if ($file instanceof File) {
56
+                return new SimpleFile($file);
57
+            }
58
+            return null;
59
+        }, $listing);
60
+
61
+        $fileListing = array_filter($fileListing);
62
+
63
+        return array_values($fileListing);
64
+    }
65
+
66
+    public function delete() {
67
+        $this->folder->delete();
68
+    }
69
+
70
+    public function fileExists($name) {
71
+        return $this->folder->nodeExists($name);
72
+    }
73
+
74
+    public function getFile($name) {
75
+        $file = $this->folder->get($name);
76
+
77
+        if (!($file instanceof File)) {
78
+            throw new NotFoundException();
79
+        }
80
+
81
+        return new SimpleFile($file);
82
+    }
83
+
84
+    public function newFile($name, $content = null) {
85
+        if ($content === null) {
86
+            // delay creating the file until it's written to
87
+            return new NewSimpleFile($this->folder, $name);
88
+        } else {
89
+            $file = $this->folder->newFile($name, $content);
90
+            return new SimpleFile($file);
91
+        }
92
+    }
93 93
 }
Please login to merge, or discard this patch.
lib/private/Files/Stream/Quota.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -33,70 +33,70 @@
 block discarded – undo
33 33
  * usage: resource \OC\Files\Stream\Quota::wrap($stream, $limit)
34 34
  */
35 35
 class Quota extends Wrapper {
36
-	/**
37
-	 * @var int $limit
38
-	 */
39
-	private $limit;
36
+    /**
37
+     * @var int $limit
38
+     */
39
+    private $limit;
40 40
 
41
-	/**
42
-	 * @param resource $stream
43
-	 * @param int $limit
44
-	 * @return resource
45
-	 */
46
-	public static function wrap($stream, $limit) {
47
-		$context = stream_context_create([
48
-			'quota' => [
49
-				'source' => $stream,
50
-				'limit' => $limit
51
-			]
52
-		]);
53
-		return Wrapper::wrapSource($stream, $context, 'quota', self::class);
54
-	}
41
+    /**
42
+     * @param resource $stream
43
+     * @param int $limit
44
+     * @return resource
45
+     */
46
+    public static function wrap($stream, $limit) {
47
+        $context = stream_context_create([
48
+            'quota' => [
49
+                'source' => $stream,
50
+                'limit' => $limit
51
+            ]
52
+        ]);
53
+        return Wrapper::wrapSource($stream, $context, 'quota', self::class);
54
+    }
55 55
 
56
-	public function stream_open($path, $mode, $options, &$opened_path) {
57
-		$context = $this->loadContext('quota');
58
-		$this->source = $context['source'];
59
-		$this->limit = $context['limit'];
56
+    public function stream_open($path, $mode, $options, &$opened_path) {
57
+        $context = $this->loadContext('quota');
58
+        $this->source = $context['source'];
59
+        $this->limit = $context['limit'];
60 60
 
61
-		return true;
62
-	}
61
+        return true;
62
+    }
63 63
 
64
-	public function dir_opendir($path, $options) {
65
-		return false;
66
-	}
64
+    public function dir_opendir($path, $options) {
65
+        return false;
66
+    }
67 67
 
68
-	public function stream_seek($offset, $whence = SEEK_SET) {
69
-		if ($whence === SEEK_END) {
70
-			// go to the end to find out last position's offset
71
-			$oldOffset = $this->stream_tell();
72
-			if (fseek($this->source, 0, $whence) !== 0) {
73
-				return false;
74
-			}
75
-			$whence = SEEK_SET;
76
-			$offset = $this->stream_tell() + $offset;
77
-			$this->limit += $oldOffset - $offset;
78
-		} elseif ($whence === SEEK_SET) {
79
-			$this->limit += $this->stream_tell() - $offset;
80
-		} else {
81
-			$this->limit -= $offset;
82
-		}
83
-		// this wrapper needs to return "true" for success.
84
-		// the fseek call itself returns 0 on succeess
85
-		return fseek($this->source, $offset, $whence) === 0;
86
-	}
68
+    public function stream_seek($offset, $whence = SEEK_SET) {
69
+        if ($whence === SEEK_END) {
70
+            // go to the end to find out last position's offset
71
+            $oldOffset = $this->stream_tell();
72
+            if (fseek($this->source, 0, $whence) !== 0) {
73
+                return false;
74
+            }
75
+            $whence = SEEK_SET;
76
+            $offset = $this->stream_tell() + $offset;
77
+            $this->limit += $oldOffset - $offset;
78
+        } elseif ($whence === SEEK_SET) {
79
+            $this->limit += $this->stream_tell() - $offset;
80
+        } else {
81
+            $this->limit -= $offset;
82
+        }
83
+        // this wrapper needs to return "true" for success.
84
+        // the fseek call itself returns 0 on succeess
85
+        return fseek($this->source, $offset, $whence) === 0;
86
+    }
87 87
 
88
-	public function stream_read($count) {
89
-		$this->limit -= $count;
90
-		return fread($this->source, $count);
91
-	}
88
+    public function stream_read($count) {
89
+        $this->limit -= $count;
90
+        return fread($this->source, $count);
91
+    }
92 92
 
93
-	public function stream_write($data) {
94
-		$size = strlen($data);
95
-		if ($size > $this->limit) {
96
-			$data = substr($data, 0, $this->limit);
97
-			$size = $this->limit;
98
-		}
99
-		$this->limit -= $size;
100
-		return fwrite($this->source, $data);
101
-	}
93
+    public function stream_write($data) {
94
+        $size = strlen($data);
95
+        if ($size > $this->limit) {
96
+            $data = substr($data, 0, $this->limit);
97
+            $size = $this->limit;
98
+        }
99
+        $this->limit -= $size;
100
+        return fwrite($this->source, $data);
101
+    }
102 102
 }
Please login to merge, or discard this patch.
lib/private/Files/ObjectStore/HomeObjectStoreStorage.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,40 +28,40 @@
 block discarded – undo
28 28
 
29 29
 class HomeObjectStoreStorage extends ObjectStoreStorage implements \OCP\Files\IHomeStorage {
30 30
 
31
-	/**
32
-	 * The home user storage requires a user object to create a unique storage id
33
-	 * @param array $params
34
-	 */
35
-	public function __construct($params) {
36
-		if (! isset($params['user']) || ! $params['user'] instanceof User) {
37
-			throw new \Exception('missing user object in parameters');
38
-		}
39
-		$this->user = $params['user'];
40
-		parent::__construct($params);
41
-	}
31
+    /**
32
+     * The home user storage requires a user object to create a unique storage id
33
+     * @param array $params
34
+     */
35
+    public function __construct($params) {
36
+        if (! isset($params['user']) || ! $params['user'] instanceof User) {
37
+            throw new \Exception('missing user object in parameters');
38
+        }
39
+        $this->user = $params['user'];
40
+        parent::__construct($params);
41
+    }
42 42
 
43
-	public function getId() {
44
-		return 'object::user:' . $this->user->getUID();
45
-	}
43
+    public function getId() {
44
+        return 'object::user:' . $this->user->getUID();
45
+    }
46 46
 
47
-	/**
48
-	 * get the owner of a path
49
-	 *
50
-	 * @param string $path The path to get the owner
51
-	 * @return false|string uid
52
-	 */
53
-	public function getOwner($path) {
54
-		if (is_object($this->user)) {
55
-			return $this->user->getUID();
56
-		}
57
-		return false;
58
-	}
47
+    /**
48
+     * get the owner of a path
49
+     *
50
+     * @param string $path The path to get the owner
51
+     * @return false|string uid
52
+     */
53
+    public function getOwner($path) {
54
+        if (is_object($this->user)) {
55
+            return $this->user->getUID();
56
+        }
57
+        return false;
58
+    }
59 59
 
60
-	/**
61
-	 * @param string $path, optional
62
-	 * @return \OC\User\User
63
-	 */
64
-	public function getUser($path = null) {
65
-		return $this->user;
66
-	}
60
+    /**
61
+     * @param string $path, optional
62
+     * @return \OC\User\User
63
+     */
64
+    public function getUser($path = null) {
65
+        return $this->user;
66
+    }
67 67
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param array $params
34 34
 	 */
35 35
 	public function __construct($params) {
36
-		if (! isset($params['user']) || ! $params['user'] instanceof User) {
36
+		if (!isset($params['user']) || !$params['user'] instanceof User) {
37 37
 			throw new \Exception('missing user object in parameters');
38 38
 		}
39 39
 		$this->user = $params['user'];
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 
43 43
 	public function getId() {
44
-		return 'object::user:' . $this->user->getUID();
44
+		return 'object::user:'.$this->user->getUID();
45 45
 	}
46 46
 
47 47
 	/**
Please login to merge, or discard this patch.
lib/private/Files/Cache/HomeCache.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -30,58 +30,58 @@
 block discarded – undo
30 30
 use OCP\Files\Cache\ICacheEntry;
31 31
 
32 32
 class HomeCache extends Cache {
33
-	/**
34
-	 * get the size of a folder and set it in the cache
35
-	 *
36
-	 * @param string $path
37
-	 * @param array $entry (optional) meta data of the folder
38
-	 * @return int
39
-	 */
40
-	public function calculateFolderSize($path, $entry = null) {
41
-		if ($path !== '/' and $path !== '' and $path !== 'files' and $path !== 'files_trashbin' and $path !== 'files_versions') {
42
-			return parent::calculateFolderSize($path, $entry);
43
-		} elseif ($path === '' or $path === '/') {
44
-			// since the size of / isn't used (the size of /files is used instead) there is no use in calculating it
45
-			return 0;
46
-		}
33
+    /**
34
+     * get the size of a folder and set it in the cache
35
+     *
36
+     * @param string $path
37
+     * @param array $entry (optional) meta data of the folder
38
+     * @return int
39
+     */
40
+    public function calculateFolderSize($path, $entry = null) {
41
+        if ($path !== '/' and $path !== '' and $path !== 'files' and $path !== 'files_trashbin' and $path !== 'files_versions') {
42
+            return parent::calculateFolderSize($path, $entry);
43
+        } elseif ($path === '' or $path === '/') {
44
+            // since the size of / isn't used (the size of /files is used instead) there is no use in calculating it
45
+            return 0;
46
+        }
47 47
 
48
-		$totalSize = 0;
49
-		if (is_null($entry)) {
50
-			$entry = $this->get($path);
51
-		}
52
-		if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
53
-			$id = $entry['fileid'];
54
-			$sql = 'SELECT SUM(`size`) AS f1 ' .
55
-			   'FROM `*PREFIX*filecache` ' .
56
-				'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
57
-			$result = \OC_DB::executeAudited($sql, [$id, $this->getNumericStorageId()]);
58
-			if ($row = $result->fetchRow()) {
59
-				$result->closeCursor();
60
-				list($sum) = array_values($row);
61
-				$totalSize = 0 + $sum;
62
-				$entry['size'] += 0;
63
-				if ($entry['size'] !== $totalSize) {
64
-					$this->update($id, ['size' => $totalSize]);
65
-				}
66
-			}
67
-		}
68
-		return $totalSize;
69
-	}
48
+        $totalSize = 0;
49
+        if (is_null($entry)) {
50
+            $entry = $this->get($path);
51
+        }
52
+        if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
53
+            $id = $entry['fileid'];
54
+            $sql = 'SELECT SUM(`size`) AS f1 ' .
55
+                'FROM `*PREFIX*filecache` ' .
56
+                'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
57
+            $result = \OC_DB::executeAudited($sql, [$id, $this->getNumericStorageId()]);
58
+            if ($row = $result->fetchRow()) {
59
+                $result->closeCursor();
60
+                list($sum) = array_values($row);
61
+                $totalSize = 0 + $sum;
62
+                $entry['size'] += 0;
63
+                if ($entry['size'] !== $totalSize) {
64
+                    $this->update($id, ['size' => $totalSize]);
65
+                }
66
+            }
67
+        }
68
+        return $totalSize;
69
+    }
70 70
 
71
-	/**
72
-	 * @param string $path
73
-	 * @return ICacheEntry
74
-	 */
75
-	public function get($path) {
76
-		$data = parent::get($path);
77
-		if ($path === '' or $path === '/') {
78
-			// only the size of the "files" dir counts
79
-			$filesData = parent::get('files');
71
+    /**
72
+     * @param string $path
73
+     * @return ICacheEntry
74
+     */
75
+    public function get($path) {
76
+        $data = parent::get($path);
77
+        if ($path === '' or $path === '/') {
78
+            // only the size of the "files" dir counts
79
+            $filesData = parent::get('files');
80 80
 
81
-			if (isset($filesData['size'])) {
82
-				$data['size'] = $filesData['size'];
83
-			}
84
-		}
85
-		return $data;
86
-	}
81
+            if (isset($filesData['size'])) {
82
+                $data['size'] = $filesData['size'];
83
+            }
84
+        }
85
+        return $data;
86
+    }
87 87
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@
 block discarded – undo
51 51
 		}
52 52
 		if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
53 53
 			$id = $entry['fileid'];
54
-			$sql = 'SELECT SUM(`size`) AS f1 ' .
55
-			   'FROM `*PREFIX*filecache` ' .
54
+			$sql = 'SELECT SUM(`size`) AS f1 '.
55
+			   'FROM `*PREFIX*filecache` '.
56 56
 				'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
57 57
 			$result = \OC_DB::executeAudited($sql, [$id, $this->getNumericStorageId()]);
58 58
 			if ($row = $result->fetchRow()) {
Please login to merge, or discard this patch.
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/DB/PgSqlTools.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -32,41 +32,41 @@
 block discarded – undo
32 32
  */
33 33
 class PgSqlTools {
34 34
 
35
-	/** @var \OCP\IConfig */
36
-	private $config;
35
+    /** @var \OCP\IConfig */
36
+    private $config;
37 37
 
38
-	/**
39
-	 * @param \OCP\IConfig $config
40
-	 */
41
-	public function __construct(IConfig $config) {
42
-		$this->config = $config;
43
-	}
38
+    /**
39
+     * @param \OCP\IConfig $config
40
+     */
41
+    public function __construct(IConfig $config) {
42
+        $this->config = $config;
43
+    }
44 44
 
45
-	/**
46
-	 * @brief Resynchronizes all sequences of a database after using INSERTs
47
-	 *        without leaving out the auto-incremented column.
48
-	 * @param \OC\DB\Connection $conn
49
-	 * @return null
50
-	 */
51
-	public function resynchronizeDatabaseSequences(Connection $conn) {
52
-		$filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
53
-		$databaseName = $conn->getDatabase();
54
-		$conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
45
+    /**
46
+     * @brief Resynchronizes all sequences of a database after using INSERTs
47
+     *        without leaving out the auto-incremented column.
48
+     * @param \OC\DB\Connection $conn
49
+     * @return null
50
+     */
51
+    public function resynchronizeDatabaseSequences(Connection $conn) {
52
+        $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
53
+        $databaseName = $conn->getDatabase();
54
+        $conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
55 55
 
56
-		foreach ($conn->getSchemaManager()->listSequences() as $sequence) {
57
-			$sequenceName = $sequence->getName();
58
-			$sqlInfo = 'SELECT table_schema, table_name, column_name
56
+        foreach ($conn->getSchemaManager()->listSequences() as $sequence) {
57
+            $sequenceName = $sequence->getName();
58
+            $sqlInfo = 'SELECT table_schema, table_name, column_name
59 59
 				FROM information_schema.columns
60 60
 				WHERE column_default = ? AND table_catalog = ?';
61
-			$sequenceInfo = $conn->fetchAssoc($sqlInfo, [
62
-				"nextval('$sequenceName'::regclass)",
63
-				$databaseName
64
-			]);
65
-			$tableName = $sequenceInfo['table_name'];
66
-			$columnName = $sequenceInfo['column_name'];
67
-			$sqlMaxId = "SELECT MAX($columnName) FROM $tableName";
68
-			$sqlSetval = "SELECT setval('$sequenceName', ($sqlMaxId))";
69
-			$conn->executeQuery($sqlSetval);
70
-		}
71
-	}
61
+            $sequenceInfo = $conn->fetchAssoc($sqlInfo, [
62
+                "nextval('$sequenceName'::regclass)",
63
+                $databaseName
64
+            ]);
65
+            $tableName = $sequenceInfo['table_name'];
66
+            $columnName = $sequenceInfo['column_name'];
67
+            $sqlMaxId = "SELECT MAX($columnName) FROM $tableName";
68
+            $sqlSetval = "SELECT setval('$sequenceName', ($sqlMaxId))";
69
+            $conn->executeQuery($sqlSetval);
70
+        }
71
+    }
72 72
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 * @return null
50 50
 	 */
51 51
 	public function resynchronizeDatabaseSequences(Connection $conn) {
52
-		$filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
52
+		$filterExpression = '/^'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/';
53 53
 		$databaseName = $conn->getDatabase();
54 54
 		$conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
55 55
 
Please login to merge, or discard this patch.