Passed
Push — master ( b6c034...979f40 )
by John
40:53 queued 23:59
created
lib/private/Files/Storage/LocalRootStorage.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
 use OC\Files\Cache\LocalRootScanner;
27 27
 
28 28
 class LocalRootStorage extends Local {
29
-	public function getScanner($path = '', $storage = null) {
30
-		if (!$storage) {
31
-			$storage = $this;
32
-		}
33
-		if (!isset($storage->scanner)) {
34
-			$storage->scanner = new LocalRootScanner($storage);
35
-		}
36
-		return $storage->scanner;
37
-	}
29
+    public function getScanner($path = '', $storage = null) {
30
+        if (!$storage) {
31
+            $storage = $this;
32
+        }
33
+        if (!isset($storage->scanner)) {
34
+            $storage->scanner = new LocalRootScanner($storage);
35
+        }
36
+        return $storage->scanner;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
lib/private/Files/Cache/LocalRootScanner.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@
 block discarded – undo
24 24
 namespace OC\Files\Cache;
25 25
 
26 26
 class LocalRootScanner extends Scanner {
27
-	public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
28
-		if ($this->shouldScanPath($file)) {
29
-			return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock, $data);
30
-		} else {
31
-			return null;
32
-		}
33
-	}
27
+    public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
28
+        if ($this->shouldScanPath($file)) {
29
+            return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock, $data);
30
+        } else {
31
+            return null;
32
+        }
33
+    }
34 34
 
35
-	public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
36
-		if ($this->shouldScanPath($path)) {
37
-			return parent::scan($path, $recursive, $reuse, $lock);
38
-		} else {
39
-			return null;
40
-		}
41
-	}
35
+    public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
36
+        if ($this->shouldScanPath($path)) {
37
+            return parent::scan($path, $recursive, $reuse, $lock);
38
+        } else {
39
+            return null;
40
+        }
41
+    }
42 42
 
43
-	private function shouldScanPath(string $path): bool {
44
-		$path = trim($path, '/');
45
-		return $path === '' || strpos($path, 'appdata_') === 0 || strpos($path, '__groupfolders') === 0;
46
-	}
43
+    private function shouldScanPath(string $path): bool {
44
+        $path = trim($path, '/');
45
+        return $path === '' || strpos($path, 'appdata_') === 0 || strpos($path, '__groupfolders') === 0;
46
+    }
47 47
 }
Please login to merge, or discard this patch.
apps/sharebymail/lib/AppInfo/Application.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 use OCP\AppFramework\Bootstrap\IRegistrationContext;
36 36
 
37 37
 class Application extends App implements IBootstrap {
38
-	public const APP_ID = 'sharebymail';
38
+    public const APP_ID = 'sharebymail';
39 39
 
40
-	public function __construct() {
41
-		parent::__construct(self::APP_ID);
42
-	}
40
+    public function __construct() {
41
+        parent::__construct(self::APP_ID);
42
+    }
43 43
 
44
-	public function register(IRegistrationContext $context): void {
45
-		$context->registerCapability(Capabilities::class);
46
-	}
44
+    public function register(IRegistrationContext $context): void {
45
+        $context->registerCapability(Capabilities::class);
46
+    }
47 47
 
48
-	public function boot(IBootContext $context): void {
49
-	}
48
+    public function boot(IBootContext $context): void {
49
+    }
50 50
 }
Please login to merge, or discard this patch.
lib/public/Notification/IDeferrableApp.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@
 block discarded – undo
32 32
  * @since 20.0.0
33 33
  */
34 34
 interface IDeferrableApp extends IApp {
35
-	/**
36
-	 * Start deferring notifications until `flush()` is called
37
-	 *
38
-	 * @since 20.0.0
39
-	 */
40
-	public function defer(): void;
35
+    /**
36
+     * Start deferring notifications until `flush()` is called
37
+     *
38
+     * @since 20.0.0
39
+     */
40
+    public function defer(): void;
41 41
 
42
-	/**
43
-	 * Send all deferred notifications that have been stored since `defer()` was called
44
-	 *
45
-	 * @since 20.0.0
46
-	 */
47
-	public function flush(): void;
42
+    /**
43
+     * Send all deferred notifications that have been stored since `defer()` was called
44
+     *
45
+     * @since 20.0.0
46
+     */
47
+    public function flush(): void;
48 48
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/LockPlugin.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -34,67 +34,67 @@
 block discarded – undo
34 34
 use Sabre\HTTP\RequestInterface;
35 35
 
36 36
 class LockPlugin extends ServerPlugin {
37
-	/**
38
-	 * Reference to main server object
39
-	 *
40
-	 * @var \Sabre\DAV\Server
41
-	 */
42
-	private $server;
37
+    /**
38
+     * Reference to main server object
39
+     *
40
+     * @var \Sabre\DAV\Server
41
+     */
42
+    private $server;
43 43
 
44
-	/**
45
-	 * State of the lock
46
-	 *
47
-	 * @var bool
48
-	 */
49
-	private $isLocked;
44
+    /**
45
+     * State of the lock
46
+     *
47
+     * @var bool
48
+     */
49
+    private $isLocked;
50 50
 
51
-	/**
52
-	 * {@inheritdoc}
53
-	 */
54
-	public function initialize(\Sabre\DAV\Server $server) {
55
-		$this->server = $server;
56
-		$this->server->on('beforeMethod:*', [$this, 'getLock'], 50);
57
-		$this->server->on('afterMethod:*', [$this, 'releaseLock'], 50);
58
-		$this->isLocked = false;
59
-	}
51
+    /**
52
+     * {@inheritdoc}
53
+     */
54
+    public function initialize(\Sabre\DAV\Server $server) {
55
+        $this->server = $server;
56
+        $this->server->on('beforeMethod:*', [$this, 'getLock'], 50);
57
+        $this->server->on('afterMethod:*', [$this, 'releaseLock'], 50);
58
+        $this->isLocked = false;
59
+    }
60 60
 
61
-	public function getLock(RequestInterface $request) {
62
-		// we can't listen on 'beforeMethod:PUT' due to order of operations with setting up the tree
63
-		// so instead we limit ourselves to the PUT method manually
64
-		if ($request->getMethod() !== 'PUT' || isset($_SERVER['HTTP_OC_CHUNKED'])) {
65
-			return;
66
-		}
67
-		try {
68
-			$node = $this->server->tree->getNodeForPath($request->getPath());
69
-		} catch (NotFound $e) {
70
-			return;
71
-		}
72
-		if ($node instanceof Node) {
73
-			try {
74
-				$node->acquireLock(ILockingProvider::LOCK_SHARED);
75
-			} catch (LockedException $e) {
76
-				throw new FileLocked($e->getMessage(), $e->getCode(), $e);
77
-			}
78
-			$this->isLocked = true;
79
-		}
80
-	}
61
+    public function getLock(RequestInterface $request) {
62
+        // we can't listen on 'beforeMethod:PUT' due to order of operations with setting up the tree
63
+        // so instead we limit ourselves to the PUT method manually
64
+        if ($request->getMethod() !== 'PUT' || isset($_SERVER['HTTP_OC_CHUNKED'])) {
65
+            return;
66
+        }
67
+        try {
68
+            $node = $this->server->tree->getNodeForPath($request->getPath());
69
+        } catch (NotFound $e) {
70
+            return;
71
+        }
72
+        if ($node instanceof Node) {
73
+            try {
74
+                $node->acquireLock(ILockingProvider::LOCK_SHARED);
75
+            } catch (LockedException $e) {
76
+                throw new FileLocked($e->getMessage(), $e->getCode(), $e);
77
+            }
78
+            $this->isLocked = true;
79
+        }
80
+    }
81 81
 
82
-	public function releaseLock(RequestInterface $request) {
83
-		// don't try to release the lock if we never locked one
84
-		if ($this->isLocked === false) {
85
-			return;
86
-		}
87
-		if ($request->getMethod() !== 'PUT' || isset($_SERVER['HTTP_OC_CHUNKED'])) {
88
-			return;
89
-		}
90
-		try {
91
-			$node = $this->server->tree->getNodeForPath($request->getPath());
92
-		} catch (NotFound $e) {
93
-			return;
94
-		}
95
-		if ($node instanceof Node) {
96
-			$node->releaseLock(ILockingProvider::LOCK_SHARED);
97
-			$this->isLocked = false;
98
-		}
99
-	}
82
+    public function releaseLock(RequestInterface $request) {
83
+        // don't try to release the lock if we never locked one
84
+        if ($this->isLocked === false) {
85
+            return;
86
+        }
87
+        if ($request->getMethod() !== 'PUT' || isset($_SERVER['HTTP_OC_CHUNKED'])) {
88
+            return;
89
+        }
90
+        try {
91
+            $node = $this->server->tree->getNodeForPath($request->getPath());
92
+        } catch (NotFound $e) {
93
+            return;
94
+        }
95
+        if ($node instanceof Node) {
96
+            $node->releaseLock(ILockingProvider::LOCK_SHARED);
97
+            $this->isLocked = false;
98
+        }
99
+    }
100 100
 }
Please login to merge, or discard this patch.
apps/federation/lib/Migration/Version1010Date20200630191302.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -33,51 +33,51 @@
 block discarded – undo
33 33
 
34 34
 class Version1010Date20200630191302 extends SimpleMigrationStep {
35 35
 
36
-	/**
37
-	 * @param IOutput $output
38
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
-	 * @param array $options
40
-	 * @return null|ISchemaWrapper
41
-	 */
42
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
-		/** @var ISchemaWrapper $schema */
44
-		$schema = $schemaClosure();
36
+    /**
37
+     * @param IOutput $output
38
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
+     * @param array $options
40
+     * @return null|ISchemaWrapper
41
+     */
42
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
+        /** @var ISchemaWrapper $schema */
44
+        $schema = $schemaClosure();
45 45
 
46
-		if (!$schema->hasTable('trusted_servers')) {
47
-			$table = $schema->createTable('trusted_servers');
48
-			$table->addColumn('id', Types::INTEGER, [
49
-				'autoincrement' => true,
50
-				'notnull' => true,
51
-				'length' => 4,
52
-			]);
53
-			$table->addColumn('url', Types::STRING, [
54
-				'notnull' => true,
55
-				'length' => 512,
56
-			]);
57
-			$table->addColumn('url_hash', Types::STRING, [
58
-				'notnull' => true,
59
-				'default' => '',
60
-			]);
61
-			$table->addColumn('token', Types::STRING, [
62
-				'notnull' => false,
63
-				'length' => 128,
64
-			]);
65
-			$table->addColumn('shared_secret', Types::STRING, [
66
-				'notnull' => false,
67
-				'length' => 256,
68
-			]);
69
-			$table->addColumn('status', Types::INTEGER, [
70
-				'notnull' => true,
71
-				'length' => 4,
72
-				'default' => 2,
73
-			]);
74
-			$table->addColumn('sync_token', Types::STRING, [
75
-				'notnull' => false,
76
-				'length' => 512,
77
-			]);
78
-			$table->setPrimaryKey(['id']);
79
-			$table->addUniqueIndex(['url_hash'], 'url_hash');
80
-		}
81
-		return $schema;
82
-	}
46
+        if (!$schema->hasTable('trusted_servers')) {
47
+            $table = $schema->createTable('trusted_servers');
48
+            $table->addColumn('id', Types::INTEGER, [
49
+                'autoincrement' => true,
50
+                'notnull' => true,
51
+                'length' => 4,
52
+            ]);
53
+            $table->addColumn('url', Types::STRING, [
54
+                'notnull' => true,
55
+                'length' => 512,
56
+            ]);
57
+            $table->addColumn('url_hash', Types::STRING, [
58
+                'notnull' => true,
59
+                'default' => '',
60
+            ]);
61
+            $table->addColumn('token', Types::STRING, [
62
+                'notnull' => false,
63
+                'length' => 128,
64
+            ]);
65
+            $table->addColumn('shared_secret', Types::STRING, [
66
+                'notnull' => false,
67
+                'length' => 256,
68
+            ]);
69
+            $table->addColumn('status', Types::INTEGER, [
70
+                'notnull' => true,
71
+                'length' => 4,
72
+                'default' => 2,
73
+            ]);
74
+            $table->addColumn('sync_token', Types::STRING, [
75
+                'notnull' => false,
76
+                'length' => 512,
77
+            ]);
78
+            $table->setPrimaryKey(['id']);
79
+            $table->addUniqueIndex(['url_hash'], 'url_hash');
80
+        }
81
+        return $schema;
82
+    }
83 83
 }
Please login to merge, or discard this patch.
apps/contactsinteraction/lib/AppInfo/Application.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@
 block discarded – undo
33 33
 use OCP\Contacts\Events\ContactInteractedWithEvent;
34 34
 
35 35
 class Application extends App implements IBootstrap {
36
-	public const APP_ID = 'contactsinteraction';
36
+    public const APP_ID = 'contactsinteraction';
37 37
 
38
-	public function __construct() {
39
-		parent::__construct(self::APP_ID);
40
-	}
38
+    public function __construct() {
39
+        parent::__construct(self::APP_ID);
40
+    }
41 41
 
42
-	public function register(IRegistrationContext $context): void {
43
-		$context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
44
-	}
42
+    public function register(IRegistrationContext $context): void {
43
+        $context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
44
+    }
45 45
 
46
-	public function boot(IBootContext $context): void {
47
-	}
46
+    public function boot(IBootContext $context): void {
47
+    }
48 48
 }
Please login to merge, or discard this patch.
apps/files/lib/Command/DeleteOrphanedFiles.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -33,84 +33,84 @@
 block discarded – undo
33 33
  * Delete all file entries that have no matching entries in the storage table.
34 34
  */
35 35
 class DeleteOrphanedFiles extends Command {
36
-	public const CHUNK_SIZE = 200;
37
-
38
-	/**
39
-	 * @var IDBConnection
40
-	 */
41
-	protected $connection;
42
-
43
-	public function __construct(IDBConnection $connection) {
44
-		$this->connection = $connection;
45
-		parent::__construct();
46
-	}
47
-
48
-	protected function configure() {
49
-		$this
50
-			->setName('files:cleanup')
51
-			->setDescription('cleanup filecache');
52
-	}
53
-
54
-	public function execute(InputInterface $input, OutputInterface $output): int {
55
-		$deletedEntries = 0;
56
-
57
-		$query = $this->connection->getQueryBuilder();
58
-		$query->select('fc.fileid')
59
-			->from('filecache', 'fc')
60
-			->where($query->expr()->isNull('s.numeric_id'))
61
-			->leftJoin('fc', 'storages', 's', $query->expr()->eq('fc.storage', 's.numeric_id'))
62
-			->setMaxResults(self::CHUNK_SIZE);
63
-
64
-		$deleteQuery = $this->connection->getQueryBuilder();
65
-		$deleteQuery->delete('filecache')
66
-			->where($deleteQuery->expr()->eq('fileid', $deleteQuery->createParameter('objectid')));
67
-
68
-		$deletedInLastChunk = self::CHUNK_SIZE;
69
-		while ($deletedInLastChunk === self::CHUNK_SIZE) {
70
-			$deletedInLastChunk = 0;
71
-			$result = $query->execute();
72
-			while ($row = $result->fetch()) {
73
-				$deletedInLastChunk++;
74
-				$deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid'])
75
-					->execute();
76
-			}
77
-			$result->closeCursor();
78
-		}
79
-
80
-		$output->writeln("$deletedEntries orphaned file cache entries deleted");
81
-
82
-		$deletedMounts = $this->cleanupOrphanedMounts();
83
-		$output->writeln("$deletedMounts orphaned mount entries deleted");
84
-		return 0;
85
-	}
86
-
87
-	private function cleanupOrphanedMounts() {
88
-		$deletedEntries = 0;
89
-
90
-		$query = $this->connection->getQueryBuilder();
91
-		$query->select('m.storage_id')
92
-			->from('mounts', 'm')
93
-			->where($query->expr()->isNull('s.numeric_id'))
94
-			->leftJoin('m', 'storages', 's', $query->expr()->eq('m.storage_id', 's.numeric_id'))
95
-			->groupBy('storage_id')
96
-			->setMaxResults(self::CHUNK_SIZE);
97
-
98
-		$deleteQuery = $this->connection->getQueryBuilder();
99
-		$deleteQuery->delete('mounts')
100
-			->where($deleteQuery->expr()->eq('storage_id', $deleteQuery->createParameter('storageid')));
101
-
102
-		$deletedInLastChunk = self::CHUNK_SIZE;
103
-		while ($deletedInLastChunk === self::CHUNK_SIZE) {
104
-			$deletedInLastChunk = 0;
105
-			$result = $query->execute();
106
-			while ($row = $result->fetch()) {
107
-				$deletedInLastChunk++;
108
-				$deletedEntries += $deleteQuery->setParameter('storageid', (int) $row['storage_id'])
109
-					->execute();
110
-			}
111
-			$result->closeCursor();
112
-		}
113
-
114
-		return $deletedEntries;
115
-	}
36
+    public const CHUNK_SIZE = 200;
37
+
38
+    /**
39
+     * @var IDBConnection
40
+     */
41
+    protected $connection;
42
+
43
+    public function __construct(IDBConnection $connection) {
44
+        $this->connection = $connection;
45
+        parent::__construct();
46
+    }
47
+
48
+    protected function configure() {
49
+        $this
50
+            ->setName('files:cleanup')
51
+            ->setDescription('cleanup filecache');
52
+    }
53
+
54
+    public function execute(InputInterface $input, OutputInterface $output): int {
55
+        $deletedEntries = 0;
56
+
57
+        $query = $this->connection->getQueryBuilder();
58
+        $query->select('fc.fileid')
59
+            ->from('filecache', 'fc')
60
+            ->where($query->expr()->isNull('s.numeric_id'))
61
+            ->leftJoin('fc', 'storages', 's', $query->expr()->eq('fc.storage', 's.numeric_id'))
62
+            ->setMaxResults(self::CHUNK_SIZE);
63
+
64
+        $deleteQuery = $this->connection->getQueryBuilder();
65
+        $deleteQuery->delete('filecache')
66
+            ->where($deleteQuery->expr()->eq('fileid', $deleteQuery->createParameter('objectid')));
67
+
68
+        $deletedInLastChunk = self::CHUNK_SIZE;
69
+        while ($deletedInLastChunk === self::CHUNK_SIZE) {
70
+            $deletedInLastChunk = 0;
71
+            $result = $query->execute();
72
+            while ($row = $result->fetch()) {
73
+                $deletedInLastChunk++;
74
+                $deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid'])
75
+                    ->execute();
76
+            }
77
+            $result->closeCursor();
78
+        }
79
+
80
+        $output->writeln("$deletedEntries orphaned file cache entries deleted");
81
+
82
+        $deletedMounts = $this->cleanupOrphanedMounts();
83
+        $output->writeln("$deletedMounts orphaned mount entries deleted");
84
+        return 0;
85
+    }
86
+
87
+    private function cleanupOrphanedMounts() {
88
+        $deletedEntries = 0;
89
+
90
+        $query = $this->connection->getQueryBuilder();
91
+        $query->select('m.storage_id')
92
+            ->from('mounts', 'm')
93
+            ->where($query->expr()->isNull('s.numeric_id'))
94
+            ->leftJoin('m', 'storages', 's', $query->expr()->eq('m.storage_id', 's.numeric_id'))
95
+            ->groupBy('storage_id')
96
+            ->setMaxResults(self::CHUNK_SIZE);
97
+
98
+        $deleteQuery = $this->connection->getQueryBuilder();
99
+        $deleteQuery->delete('mounts')
100
+            ->where($deleteQuery->expr()->eq('storage_id', $deleteQuery->createParameter('storageid')));
101
+
102
+        $deletedInLastChunk = self::CHUNK_SIZE;
103
+        while ($deletedInLastChunk === self::CHUNK_SIZE) {
104
+            $deletedInLastChunk = 0;
105
+            $result = $query->execute();
106
+            while ($row = $result->fetch()) {
107
+                $deletedInLastChunk++;
108
+                $deletedEntries += $deleteQuery->setParameter('storageid', (int) $row['storage_id'])
109
+                    ->execute();
110
+            }
111
+            $result->closeCursor();
112
+        }
113
+
114
+        return $deletedEntries;
115
+    }
116 116
 }
Please login to merge, or discard this patch.
apps/cloud_federation_api/lib/AppInfo/Application.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@
 block discarded – undo
33 33
 use OCP\AppFramework\Bootstrap\IRegistrationContext;
34 34
 
35 35
 class Application extends App implements IBootstrap {
36
-	public const APP_ID = 'cloud_federation_api';
36
+    public const APP_ID = 'cloud_federation_api';
37 37
 
38
-	public function __construct() {
39
-		parent::__construct(self::APP_ID);
40
-	}
38
+    public function __construct() {
39
+        parent::__construct(self::APP_ID);
40
+    }
41 41
 
42
-	public function register(IRegistrationContext $context): void {
43
-		$context->registerCapability(Capabilities::class);
44
-	}
42
+    public function register(IRegistrationContext $context): void {
43
+        $context->registerCapability(Capabilities::class);
44
+    }
45 45
 
46
-	public function boot(IBootContext $context): void {
47
-	}
46
+    public function boot(IBootContext $context): void {
47
+    }
48 48
 }
Please login to merge, or discard this patch.