Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php 1 patch
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -33,87 +33,87 @@
 block discarded – undo
33 33
 
34 34
 class CalDAVRemoveEmptyValue implements IRepairStep {
35 35
 
36
-	/** @var IDBConnection */
37
-	private $db;
38
-
39
-	/** @var CalDavBackend */
40
-	private $calDavBackend;
41
-
42
-	/** @var ILogger */
43
-	private $logger;
44
-
45
-	/**
46
-	 * @param IDBConnection $db
47
-	 * @param CalDavBackend $calDavBackend
48
-	 * @param ILogger $logger
49
-	 */
50
-	public function __construct(IDBConnection $db, CalDavBackend $calDavBackend, ILogger $logger) {
51
-		$this->db = $db;
52
-		$this->calDavBackend = $calDavBackend;
53
-		$this->logger = $logger;
54
-	}
55
-
56
-	public function getName() {
57
-		return 'Fix broken values of calendar objects';
58
-	}
59
-
60
-	public function run(IOutput $output) {
61
-		$pattern = ';VALUE=:';
62
-		$count = $warnings = 0;
63
-
64
-		$objects = $this->getInvalidObjects($pattern);
65
-
66
-		$output->startProgress(count($objects));
67
-		foreach ($objects as $row) {
68
-			$calObject = $this->calDavBackend->getCalendarObject((int)$row['calendarid'], $row['uri']);
69
-			$data = preg_replace('/' . $pattern . '/', ':', $calObject['calendardata']);
70
-
71
-			if ($data !== $calObject['calendardata']) {
72
-				$output->advance();
73
-
74
-				try {
75
-					$this->calDavBackend->getDenormalizedData($data);
76
-				} catch (InvalidDataException $e) {
77
-					$this->logger->info('Calendar object for calendar {cal} with uri {uri} still invalid', [
78
-						'app' => 'dav',
79
-						'cal' => (int)$row['calendarid'],
80
-						'uri' => $row['uri'],
81
-					]);
82
-					$warnings++;
83
-					continue;
84
-				}
85
-
86
-				$this->calDavBackend->updateCalendarObject((int)$row['calendarid'], $row['uri'], $data);
87
-				$count++;
88
-			}
89
-		}
90
-		$output->finishProgress();
91
-
92
-		if ($warnings > 0) {
93
-			$output->warning(sprintf('%d events could not be updated, see log file for more information', $warnings));
94
-		}
95
-		if ($count > 0) {
96
-			$output->info(sprintf('Updated %d events', $count));
97
-		}
98
-	}
99
-
100
-	protected function getInvalidObjects($pattern) {
101
-		$query = $this->db->getQueryBuilder();
102
-		$query->select(['calendarid', 'uri'])
103
-			->from('calendarobjects')
104
-			->where($query->expr()->like(
105
-				'calendardata',
106
-				$query->createNamedParameter(
107
-					'%' . $this->db->escapeLikeParameter($pattern) . '%',
108
-					IQueryBuilder::PARAM_STR
109
-				),
110
-				IQueryBuilder::PARAM_STR
111
-			));
112
-
113
-		$result = $query->execute();
114
-		$rows = $result->fetchAll();
115
-		$result->closeCursor();
116
-
117
-		return $rows;
118
-	}
36
+    /** @var IDBConnection */
37
+    private $db;
38
+
39
+    /** @var CalDavBackend */
40
+    private $calDavBackend;
41
+
42
+    /** @var ILogger */
43
+    private $logger;
44
+
45
+    /**
46
+     * @param IDBConnection $db
47
+     * @param CalDavBackend $calDavBackend
48
+     * @param ILogger $logger
49
+     */
50
+    public function __construct(IDBConnection $db, CalDavBackend $calDavBackend, ILogger $logger) {
51
+        $this->db = $db;
52
+        $this->calDavBackend = $calDavBackend;
53
+        $this->logger = $logger;
54
+    }
55
+
56
+    public function getName() {
57
+        return 'Fix broken values of calendar objects';
58
+    }
59
+
60
+    public function run(IOutput $output) {
61
+        $pattern = ';VALUE=:';
62
+        $count = $warnings = 0;
63
+
64
+        $objects = $this->getInvalidObjects($pattern);
65
+
66
+        $output->startProgress(count($objects));
67
+        foreach ($objects as $row) {
68
+            $calObject = $this->calDavBackend->getCalendarObject((int)$row['calendarid'], $row['uri']);
69
+            $data = preg_replace('/' . $pattern . '/', ':', $calObject['calendardata']);
70
+
71
+            if ($data !== $calObject['calendardata']) {
72
+                $output->advance();
73
+
74
+                try {
75
+                    $this->calDavBackend->getDenormalizedData($data);
76
+                } catch (InvalidDataException $e) {
77
+                    $this->logger->info('Calendar object for calendar {cal} with uri {uri} still invalid', [
78
+                        'app' => 'dav',
79
+                        'cal' => (int)$row['calendarid'],
80
+                        'uri' => $row['uri'],
81
+                    ]);
82
+                    $warnings++;
83
+                    continue;
84
+                }
85
+
86
+                $this->calDavBackend->updateCalendarObject((int)$row['calendarid'], $row['uri'], $data);
87
+                $count++;
88
+            }
89
+        }
90
+        $output->finishProgress();
91
+
92
+        if ($warnings > 0) {
93
+            $output->warning(sprintf('%d events could not be updated, see log file for more information', $warnings));
94
+        }
95
+        if ($count > 0) {
96
+            $output->info(sprintf('Updated %d events', $count));
97
+        }
98
+    }
99
+
100
+    protected function getInvalidObjects($pattern) {
101
+        $query = $this->db->getQueryBuilder();
102
+        $query->select(['calendarid', 'uri'])
103
+            ->from('calendarobjects')
104
+            ->where($query->expr()->like(
105
+                'calendardata',
106
+                $query->createNamedParameter(
107
+                    '%' . $this->db->escapeLikeParameter($pattern) . '%',
108
+                    IQueryBuilder::PARAM_STR
109
+                ),
110
+                IQueryBuilder::PARAM_STR
111
+            ));
112
+
113
+        $result = $query->execute();
114
+        $rows = $result->fetchAll();
115
+        $result->closeCursor();
116
+
117
+        return $rows;
118
+    }
119 119
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 
28 28
 class CompFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$att = $reader->parseAttributes();
37
-		$componentName = $att['name'];
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $att = $reader->parseAttributes();
37
+        $componentName = $att['name'];
38 38
 
39
-		$reader->parseInnerTree();
39
+        $reader->parseInnerTree();
40 40
 
41
-		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
43
-		}
41
+        if (!is_string($componentName)) {
42
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
43
+        }
44 44
 
45
-		return $componentName;
46
-	}
45
+        return $componentName;
46
+    }
47 47
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 
28 28
 class PropFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	static function xmlDeserialize(Reader $reader) {
36
-		$att = $reader->parseAttributes();
37
-		$componentName = $att['name'];
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    static function xmlDeserialize(Reader $reader) {
36
+        $att = $reader->parseAttributes();
37
+        $componentName = $att['name'];
38 38
 
39
-		$reader->parseInnerTree();
39
+        $reader->parseInnerTree();
40 40
 
41
-		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute');
43
-		}
41
+        if (!is_string($componentName)) {
42
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute');
43
+        }
44 44
 
45
-		return $componentName;
46
-	}
45
+        return $componentName;
46
+    }
47 47
 }
Please login to merge, or discard this patch.
apps/dav/lib/Avatars/AvatarNode.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 use Sabre\DAV\File;
28 28
 
29 29
 class AvatarNode extends File {
30
-	private $ext;
31
-	private $size;
32
-	private $avatar;
30
+    private $ext;
31
+    private $size;
32
+    private $avatar;
33 33
 
34
-	/**
35
-	 * AvatarNode constructor.
36
-	 *
37
-	 * @param integer $size
38
-	 * @param string $ext
39
-	 * @param IAvatar $avatar
40
-	 */
41
-	public function __construct($size, $ext, $avatar) {
42
-		$this->size = $size;
43
-		$this->ext = $ext;
44
-		$this->avatar = $avatar;
45
-	}
34
+    /**
35
+     * AvatarNode constructor.
36
+     *
37
+     * @param integer $size
38
+     * @param string $ext
39
+     * @param IAvatar $avatar
40
+     */
41
+    public function __construct($size, $ext, $avatar) {
42
+        $this->size = $size;
43
+        $this->ext = $ext;
44
+        $this->avatar = $avatar;
45
+    }
46 46
 
47
-	/**
48
-	 * Returns the name of the node.
49
-	 *
50
-	 * This is used to generate the url.
51
-	 *
52
-	 * @return string
53
-	 */
54
-	public function getName() {
55
-		return "$this->size.$this->ext";
56
-	}
47
+    /**
48
+     * Returns the name of the node.
49
+     *
50
+     * This is used to generate the url.
51
+     *
52
+     * @return string
53
+     */
54
+    public function getName() {
55
+        return "$this->size.$this->ext";
56
+    }
57 57
 
58
-	public function get() {
59
-		$image = $this->avatar->get($this->size);
60
-		$res = $image->resource();
58
+    public function get() {
59
+        $image = $this->avatar->get($this->size);
60
+        $res = $image->resource();
61 61
 
62
-		ob_start();
63
-		if ($this->ext === 'png') {
64
-			imagepng($res);
65
-		} else {
66
-			imagejpeg($res);
67
-		}
62
+        ob_start();
63
+        if ($this->ext === 'png') {
64
+            imagepng($res);
65
+        } else {
66
+            imagejpeg($res);
67
+        }
68 68
 
69
-		return ob_get_clean();
70
-	}
69
+        return ob_get_clean();
70
+    }
71 71
 
72
-	/**
73
-	 * Returns the mime-type for a file
74
-	 *
75
-	 * If null is returned, we'll assume application/octet-stream
76
-	 *
77
-	 * @return string|null
78
-	 */
79
-	public function getContentType() {
80
-		if ($this->ext === 'png') {
81
-			return 'image/png';
82
-		}
83
-		return 'image/jpeg';
84
-	}
72
+    /**
73
+     * Returns the mime-type for a file
74
+     *
75
+     * If null is returned, we'll assume application/octet-stream
76
+     *
77
+     * @return string|null
78
+     */
79
+    public function getContentType() {
80
+        if ($this->ext === 'png') {
81
+            return 'image/png';
82
+        }
83
+        return 'image/jpeg';
84
+    }
85 85
 
86
-	public function getETag() {
87
-		return $this->avatar->getFile($this->size)->getEtag();
88
-	}
86
+    public function getETag() {
87
+        return $this->avatar->getFile($this->size)->getEtag();
88
+    }
89 89
 
90
-	public function getLastModified() {
91
-		$timestamp = $this->avatar->getFile($this->size)->getMTime();
92
-		if (!empty($timestamp)) {
93
-			return (int)$timestamp;
94
-		}
95
-		return $timestamp;
90
+    public function getLastModified() {
91
+        $timestamp = $this->avatar->getFile($this->size)->getMTime();
92
+        if (!empty($timestamp)) {
93
+            return (int)$timestamp;
94
+        }
95
+        return $timestamp;
96 96
 
97
-	}
97
+    }
98 98
 }
Please login to merge, or discard this patch.
lib/private/Cache/CappedMemoryCache.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -31,66 +31,66 @@
 block discarded – undo
31 31
  */
32 32
 class CappedMemoryCache implements ICache, \ArrayAccess {
33 33
 
34
-	private $capacity;
35
-	private $cache = [];
36
-
37
-	public function __construct($capacity = 512) {
38
-		$this->capacity = $capacity;
39
-	}
40
-
41
-	public function hasKey($key) {
42
-		return isset($this->cache[$key]);
43
-	}
44
-
45
-	public function get($key) {
46
-		return isset($this->cache[$key]) ? $this->cache[$key] : null;
47
-	}
48
-
49
-	public function set($key, $value, $ttl = 0) {
50
-		if (is_null($key)) {
51
-			$this->cache[] = $value;
52
-		} else {
53
-			$this->cache[$key] = $value;
54
-		}
55
-		$this->garbageCollect();
56
-	}
57
-
58
-	public function remove($key) {
59
-		unset($this->cache[$key]);
60
-		return true;
61
-	}
62
-
63
-	public function clear($prefix = '') {
64
-		$this->cache = [];
65
-		return true;
66
-	}
67
-
68
-	public function offsetExists($offset) {
69
-		return $this->hasKey($offset);
70
-	}
71
-
72
-	public function &offsetGet($offset) {
73
-		return $this->cache[$offset];
74
-	}
75
-
76
-	public function offsetSet($offset, $value) {
77
-		$this->set($offset, $value);
78
-	}
79
-
80
-	public function offsetUnset($offset) {
81
-		$this->remove($offset);
82
-	}
83
-
84
-	public function getData() {
85
-		return $this->cache;
86
-	}
87
-
88
-
89
-	private function garbageCollect() {
90
-		while (count($this->cache) > $this->capacity) {
91
-			reset($this->cache);
92
-			$key = key($this->cache);
93
-			$this->remove($key);
94
-		}
95
-	}
34
+    private $capacity;
35
+    private $cache = [];
36
+
37
+    public function __construct($capacity = 512) {
38
+        $this->capacity = $capacity;
39
+    }
40
+
41
+    public function hasKey($key) {
42
+        return isset($this->cache[$key]);
43
+    }
44
+
45
+    public function get($key) {
46
+        return isset($this->cache[$key]) ? $this->cache[$key] : null;
47
+    }
48
+
49
+    public function set($key, $value, $ttl = 0) {
50
+        if (is_null($key)) {
51
+            $this->cache[] = $value;
52
+        } else {
53
+            $this->cache[$key] = $value;
54
+        }
55
+        $this->garbageCollect();
56
+    }
57
+
58
+    public function remove($key) {
59
+        unset($this->cache[$key]);
60
+        return true;
61
+    }
62
+
63
+    public function clear($prefix = '') {
64
+        $this->cache = [];
65
+        return true;
66
+    }
67
+
68
+    public function offsetExists($offset) {
69
+        return $this->hasKey($offset);
70
+    }
71
+
72
+    public function &offsetGet($offset) {
73
+        return $this->cache[$offset];
74
+    }
75
+
76
+    public function offsetSet($offset, $value) {
77
+        $this->set($offset, $value);
78
+    }
79
+
80
+    public function offsetUnset($offset) {
81
+        $this->remove($offset);
82
+    }
83
+
84
+    public function getData() {
85
+        return $this->cache;
86
+    }
87
+
88
+
89
+    private function garbageCollect() {
90
+        while (count($this->cache) > $this->capacity) {
91
+            reset($this->cache);
92
+            $key = key($this->cache);
93
+            $this->remove($key);
94
+        }
95
+    }
96 96
 }
Please login to merge, or discard this patch.
lib/private/Lockdown/LockdownManager.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,56 +24,56 @@
 block discarded – undo
24 24
 use OCP\Lockdown\ILockdownManager;
25 25
 
26 26
 class LockdownManager implements ILockdownManager {
27
-	/** @var ISession */
28
-	private $sessionCallback;
27
+    /** @var ISession */
28
+    private $sessionCallback;
29 29
 
30
-	private $enabled = false;
30
+    private $enabled = false;
31 31
 
32
-	/** @var array|null */
33
-	private $scope;
32
+    /** @var array|null */
33
+    private $scope;
34 34
 
35
-	/**
36
-	 * LockdownManager constructor.
37
-	 *
38
-	 * @param callable $sessionCallback we need to inject the session lazily to avoid dependency loops
39
-	 */
40
-	public function __construct(callable $sessionCallback) {
41
-		$this->sessionCallback = $sessionCallback;
42
-	}
35
+    /**
36
+     * LockdownManager constructor.
37
+     *
38
+     * @param callable $sessionCallback we need to inject the session lazily to avoid dependency loops
39
+     */
40
+    public function __construct(callable $sessionCallback) {
41
+        $this->sessionCallback = $sessionCallback;
42
+    }
43 43
 
44 44
 
45
-	public function enable() {
46
-		$this->enabled = true;
47
-	}
45
+    public function enable() {
46
+        $this->enabled = true;
47
+    }
48 48
 
49
-	/**
50
-	 * @return ISession
51
-	 */
52
-	private function getSession() {
53
-		$callback = $this->sessionCallback;
54
-		return $callback();
55
-	}
49
+    /**
50
+     * @return ISession
51
+     */
52
+    private function getSession() {
53
+        $callback = $this->sessionCallback;
54
+        return $callback();
55
+    }
56 56
 
57
-	private function getScopeAsArray() {
58
-		if (!$this->scope) {
59
-			$session = $this->getSession();
60
-			$sessionScope = $session->get('token_scope');
61
-			if ($sessionScope) {
62
-				$this->scope = $sessionScope;
63
-			}
64
-		}
65
-		return $this->scope;
66
-	}
57
+    private function getScopeAsArray() {
58
+        if (!$this->scope) {
59
+            $session = $this->getSession();
60
+            $sessionScope = $session->get('token_scope');
61
+            if ($sessionScope) {
62
+                $this->scope = $sessionScope;
63
+            }
64
+        }
65
+        return $this->scope;
66
+    }
67 67
 
68
-	public function setToken(IToken $token) {
69
-		$this->scope = $token->getScopeAsArray();
70
-		$session = $this->getSession();
71
-		$session->set('token_scope', $this->scope);
72
-		$this->enable();
73
-	}
68
+    public function setToken(IToken $token) {
69
+        $this->scope = $token->getScopeAsArray();
70
+        $session = $this->getSession();
71
+        $session->set('token_scope', $this->scope);
72
+        $this->enable();
73
+    }
74 74
 
75
-	public function canAccessFilesystem() {
76
-		$scope = $this->getScopeAsArray();
77
-		return !$scope || $scope['filesystem'];
78
-	}
75
+    public function canAccessFilesystem() {
76
+        $scope = $this->getScopeAsArray();
77
+        return !$scope || $scope['filesystem'];
78
+    }
79 79
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IProvider.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
  */
30 30
 interface IProvider {
31 31
 
32
-	/**
33
-	 * @since 12.0
34
-	 * @param IEntry $entry
35
-	 * @return void
36
-	 */
37
-	public function process(IEntry $entry);
32
+    /**
33
+     * @since 12.0
34
+     * @param IEntry $entry
35
+     * @return void
36
+     */
37
+    public function process(IEntry $entry);
38 38
 }
Please login to merge, or discard this patch.
lib/public/Share/IShareHelper.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
  */
33 33
 interface IShareHelper {
34 34
 
35
-	/**
36
-	 * @param Node $node
37
-	 * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]]
38
-	 * @since 12
39
-	 */
40
-	public function getPathsForAccessList(Node $node);
35
+    /**
36
+     * @param Node $node
37
+     * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]]
38
+     * @since 12
39
+     */
40
+    public function getPathsForAccessList(Node $node);
41 41
 }
Please login to merge, or discard this patch.
apps/sharebymail/lib/Capabilities.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,24 +27,24 @@
 block discarded – undo
27 27
 
28 28
 class Capabilities implements ICapability {
29 29
 
30
-	/**
31
-	 * Function an app uses to return the capabilities
32
-	 *
33
-	 * @return array Array containing the apps capabilities
34
-	 * @since 8.2.0
35
-	 */
36
-	public function getCapabilities() {
37
-		return [
38
-			'files_sharing' =>
39
-				[
40
-					'sharebymail' =>
41
-						[
42
-							'enabled' => true,
43
-							'upload_files_drop' => ['enabled' => true],
44
-							'password' => ['enabled' => true],
45
-							'expire_date' => ['enabled' => true]
46
-						]
47
-				]
48
-		];
49
-	}
30
+    /**
31
+     * Function an app uses to return the capabilities
32
+     *
33
+     * @return array Array containing the apps capabilities
34
+     * @since 8.2.0
35
+     */
36
+    public function getCapabilities() {
37
+        return [
38
+            'files_sharing' =>
39
+                [
40
+                    'sharebymail' =>
41
+                        [
42
+                            'enabled' => true,
43
+                            'upload_files_drop' => ['enabled' => true],
44
+                            'password' => ['enabled' => true],
45
+                            'expire_date' => ['enabled' => true]
46
+                        ]
47
+                ]
48
+        ];
49
+    }
50 50
 }
Please login to merge, or discard this patch.