Passed
Push — master ( 09b38b...db0bda )
by Lukas
16:06 queued 14s
created
apps/files_external/lib/Command/Delete.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 		try {
69 69
 			$mount = $this->globalService->getStorage($mountId);
70 70
 		} catch (NotFoundException $e) {
71
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
71
+			$output->writeln('<error>Mount with id "'.$mountId.' not found, check "occ files_external:list" to get available mounts"</error>');
72 72
 			return 404;
73 73
 		}
74 74
 
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -39,77 +39,77 @@
 block discarded – undo
39 39
 use Symfony\Component\Console\Question\ConfirmationQuestion;
40 40
 
41 41
 class Delete extends Base {
42
-	/**
43
-	 * @var GlobalStoragesService
44
-	 */
45
-	protected $globalService;
42
+    /**
43
+     * @var GlobalStoragesService
44
+     */
45
+    protected $globalService;
46 46
 
47
-	/**
48
-	 * @var UserStoragesService
49
-	 */
50
-	protected $userService;
47
+    /**
48
+     * @var UserStoragesService
49
+     */
50
+    protected $userService;
51 51
 
52
-	/**
53
-	 * @var IUserSession
54
-	 */
55
-	protected $userSession;
52
+    /**
53
+     * @var IUserSession
54
+     */
55
+    protected $userSession;
56 56
 
57
-	/**
58
-	 * @var IUserManager
59
-	 */
60
-	protected $userManager;
57
+    /**
58
+     * @var IUserManager
59
+     */
60
+    protected $userManager;
61 61
 
62
-	public function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
63
-		parent::__construct();
64
-		$this->globalService = $globalService;
65
-		$this->userService = $userService;
66
-		$this->userSession = $userSession;
67
-		$this->userManager = $userManager;
68
-	}
62
+    public function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
63
+        parent::__construct();
64
+        $this->globalService = $globalService;
65
+        $this->userService = $userService;
66
+        $this->userSession = $userSession;
67
+        $this->userManager = $userManager;
68
+    }
69 69
 
70
-	protected function configure() {
71
-		$this
72
-			->setName('files_external:delete')
73
-			->setDescription('Delete an external mount')
74
-			->addArgument(
75
-				'mount_id',
76
-				InputArgument::REQUIRED,
77
-				'The id of the mount to edit'
78
-			)->addOption(
79
-				'yes',
80
-				'y',
81
-				InputOption::VALUE_NONE,
82
-				'Skip confirmation'
83
-			);
84
-		parent::configure();
85
-	}
70
+    protected function configure() {
71
+        $this
72
+            ->setName('files_external:delete')
73
+            ->setDescription('Delete an external mount')
74
+            ->addArgument(
75
+                'mount_id',
76
+                InputArgument::REQUIRED,
77
+                'The id of the mount to edit'
78
+            )->addOption(
79
+                'yes',
80
+                'y',
81
+                InputOption::VALUE_NONE,
82
+                'Skip confirmation'
83
+            );
84
+        parent::configure();
85
+    }
86 86
 
87
-	protected function execute(InputInterface $input, OutputInterface $output): int {
88
-		$mountId = $input->getArgument('mount_id');
89
-		try {
90
-			$mount = $this->globalService->getStorage($mountId);
91
-		} catch (NotFoundException $e) {
92
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
93
-			return 404;
94
-		}
87
+    protected function execute(InputInterface $input, OutputInterface $output): int {
88
+        $mountId = $input->getArgument('mount_id');
89
+        try {
90
+            $mount = $this->globalService->getStorage($mountId);
91
+        } catch (NotFoundException $e) {
92
+            $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
93
+            return 404;
94
+        }
95 95
 
96
-		$noConfirm = $input->getOption('yes');
96
+        $noConfirm = $input->getOption('yes');
97 97
 
98
-		if (!$noConfirm) {
99
-			$listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
100
-			$listInput = new ArrayInput([], $listCommand->getDefinition());
101
-			$listInput->setOption('output', $input->getOption('output'));
102
-			$listCommand->listMounts(null, [$mount], $listInput, $output);
98
+        if (!$noConfirm) {
99
+            $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
100
+            $listInput = new ArrayInput([], $listCommand->getDefinition());
101
+            $listInput->setOption('output', $input->getOption('output'));
102
+            $listCommand->listMounts(null, [$mount], $listInput, $output);
103 103
 
104
-			$questionHelper = $this->getHelper('question');
105
-			$question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
104
+            $questionHelper = $this->getHelper('question');
105
+            $question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
106 106
 
107
-			if (!$questionHelper->ask($input, $output, $question)) {
108
-				return 1;
109
-			}
110
-		}
107
+            if (!$questionHelper->ask($input, $output, $question)) {
108
+                return 1;
109
+            }
110
+        }
111 111
 
112
-		$this->globalService->removeStorage($mountId);
113
-		return 0;
114
-	}
112
+        $this->globalService->removeStorage($mountId);
113
+        return 0;
114
+    }
115 115
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IAction.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -33,33 +33,33 @@
 block discarded – undo
33 33
  */
34 34
 interface IAction extends JsonSerializable {
35 35
 
36
-	/**
37
-	 * @param string $icon absolute URI to an icon
38
-	 * @since 12.0
39
-	 */
40
-	public function setIcon($icon);
36
+    /**
37
+     * @param string $icon absolute URI to an icon
38
+     * @since 12.0
39
+     */
40
+    public function setIcon($icon);
41 41
 
42
-	/**
43
-	 * @return string localized action name, e.g. 'Call'
44
-	 * @since 12.0
45
-	 */
46
-	public function getName();
42
+    /**
43
+     * @return string localized action name, e.g. 'Call'
44
+     * @since 12.0
45
+     */
46
+    public function getName();
47 47
 
48
-	/**
49
-	 * @param string $name localized action name, e.g. 'Call'
50
-	 * @since 12.0
51
-	 */
52
-	public function setName($name);
48
+    /**
49
+     * @param string $name localized action name, e.g. 'Call'
50
+     * @since 12.0
51
+     */
52
+    public function setName($name);
53 53
 
54
-	/**
55
-	 * @param int $priority priorize actions, high order ones are shown on top
56
-	 * @since 12.0
57
-	 */
58
-	public function setPriority($priority);
54
+    /**
55
+     * @param int $priority priorize actions, high order ones are shown on top
56
+     * @since 12.0
57
+     */
58
+    public function setPriority($priority);
59 59
 
60
-	/**
61
-	 * @return int priority to priorize actions, high order ones are shown on top
62
-	 * @since 12.0
63
-	 */
64
-	public function getPriority();
60
+    /**
61
+     * @return int priority to priorize actions, high order ones are shown on top
62
+     * @since 12.0
63
+     */
64
+    public function getPriority();
65 65
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IActionFactory.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@
 block discarded – undo
28 28
  */
29 29
 interface IActionFactory {
30 30
 
31
-	/**
32
-	 * Construct and return a new link action for the contacts menu
33
-	 *
34
-	 * @since 12.0
35
-	 *
36
-	 * @param string $icon full path to the action's icon
37
-	 * @param string $name localized name of the action
38
-	 * @param string $href target URL
39
-	 * @return ILinkAction
40
-	 */
41
-	public function newLinkAction($icon, $name, $href);
31
+    /**
32
+     * Construct and return a new link action for the contacts menu
33
+     *
34
+     * @since 12.0
35
+     *
36
+     * @param string $icon full path to the action's icon
37
+     * @param string $name localized name of the action
38
+     * @param string $href target URL
39
+     * @return ILinkAction
40
+     */
41
+    public function newLinkAction($icon, $name, $href);
42 42
 
43
-	/**
44
-	 * Construct and return a new email action for the contacts menu
45
-	 *
46
-	 * @since 12.0
47
-	 *
48
-	 * @param string $icon full path to the action's icon
49
-	 * @param string $name localized name of the action
50
-	 * @param string $email target e-mail address
51
-	 * @return ILinkAction
52
-	 */
53
-	public function newEMailAction($icon, $name, $email);
43
+    /**
44
+     * Construct and return a new email action for the contacts menu
45
+     *
46
+     * @since 12.0
47
+     *
48
+     * @param string $icon full path to the action's icon
49
+     * @param string $name localized name of the action
50
+     * @param string $email target e-mail address
51
+     * @return ILinkAction
52
+     */
53
+    public function newEMailAction($icon, $name, $email);
54 54
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/ILinkAction.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
  */
30 30
 interface ILinkAction extends IAction {
31 31
 
32
-	/**
33
-	 * @since 12.0
34
-	 * @param string $href the target URL of the action
35
-	 */
36
-	public function setHref($href);
32
+    /**
33
+     * @since 12.0
34
+     * @param string $href the target URL of the action
35
+     */
36
+    public function setHref($href);
37 37
 
38
-	/**
39
-	 * @since 12.0
40
-	 * @return string
41
-	 */
42
-	public function getHref();
38
+    /**
39
+     * @since 12.0
40
+     * @return string
41
+     */
42
+    public function getHref();
43 43
 }
Please login to merge, or discard this patch.
lib/private/Files/Search/SearchComparison.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -24,44 +24,44 @@
 block discarded – undo
24 24
 use OCP\Files\Search\ISearchComparison;
25 25
 
26 26
 class SearchComparison implements ISearchComparison {
27
-	/** @var string */
28
-	private $type;
29
-	/** @var string */
30
-	private $field;
31
-	/** @var string|integer|\DateTime */
32
-	private $value;
27
+    /** @var string */
28
+    private $type;
29
+    /** @var string */
30
+    private $field;
31
+    /** @var string|integer|\DateTime */
32
+    private $value;
33 33
 
34
-	/**
35
-	 * SearchComparison constructor.
36
-	 *
37
-	 * @param string $type
38
-	 * @param string $field
39
-	 * @param \DateTime|int|string $value
40
-	 */
41
-	public function __construct($type, $field, $value) {
42
-		$this->type = $type;
43
-		$this->field = $field;
44
-		$this->value = $value;
45
-	}
34
+    /**
35
+     * SearchComparison constructor.
36
+     *
37
+     * @param string $type
38
+     * @param string $field
39
+     * @param \DateTime|int|string $value
40
+     */
41
+    public function __construct($type, $field, $value) {
42
+        $this->type = $type;
43
+        $this->field = $field;
44
+        $this->value = $value;
45
+    }
46 46
 
47
-	/**
48
-	 * @return string
49
-	 */
50
-	public function getType() {
51
-		return $this->type;
52
-	}
47
+    /**
48
+     * @return string
49
+     */
50
+    public function getType() {
51
+        return $this->type;
52
+    }
53 53
 
54
-	/**
55
-	 * @return string
56
-	 */
57
-	public function getField() {
58
-		return $this->field;
59
-	}
54
+    /**
55
+     * @return string
56
+     */
57
+    public function getField() {
58
+        return $this->field;
59
+    }
60 60
 
61
-	/**
62
-	 * @return \DateTime|int|string
63
-	 */
64
-	public function getValue() {
65
-		return $this->value;
66
-	}
61
+    /**
62
+     * @return \DateTime|int|string
63
+     */
64
+    public function getValue() {
65
+        return $this->value;
66
+    }
67 67
 }
Please login to merge, or discard this patch.
lib/private/Files/Search/SearchBinaryOperator.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,33 +25,33 @@
 block discarded – undo
25 25
 use OCP\Files\Search\ISearchOperator;
26 26
 
27 27
 class SearchBinaryOperator implements ISearchBinaryOperator {
28
-	/** @var string */
29
-	private $type;
30
-	/** @var ISearchOperator[] */
31
-	private $arguments;
28
+    /** @var string */
29
+    private $type;
30
+    /** @var ISearchOperator[] */
31
+    private $arguments;
32 32
 
33
-	/**
34
-	 * SearchBinaryOperator constructor.
35
-	 *
36
-	 * @param string $type
37
-	 * @param ISearchOperator[] $arguments
38
-	 */
39
-	public function __construct($type, array $arguments) {
40
-		$this->type = $type;
41
-		$this->arguments = $arguments;
42
-	}
33
+    /**
34
+     * SearchBinaryOperator constructor.
35
+     *
36
+     * @param string $type
37
+     * @param ISearchOperator[] $arguments
38
+     */
39
+    public function __construct($type, array $arguments) {
40
+        $this->type = $type;
41
+        $this->arguments = $arguments;
42
+    }
43 43
 
44
-	/**
45
-	 * @return string
46
-	 */
47
-	public function getType() {
48
-		return $this->type;
49
-	}
44
+    /**
45
+     * @return string
46
+     */
47
+    public function getType() {
48
+        return $this->type;
49
+    }
50 50
 
51
-	/**
52
-	 * @return ISearchOperator[]
53
-	 */
54
-	public function getArguments() {
55
-		return $this->arguments;
56
-	}
51
+    /**
52
+     * @return ISearchOperator[]
53
+     */
54
+    public function getArguments() {
55
+        return $this->arguments;
56
+    }
57 57
 }
Please login to merge, or discard this patch.
lib/private/Repair/RepairInvalidShares.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 		$updatedEntries = $builder->execute();
73 73
 		if ($updatedEntries > 0) {
74
-			$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
+			$out->info('Fixed file share permissions for '.$updatedEntries.' shares');
75 75
 		}
76 76
 	}
77 77
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 
109 109
 		if ($deletedEntries) {
110
-			$out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
+			$out->info('Removed '.$deletedEntries.' shares where the parent did not exist');
111 111
 		}
112 112
 	}
113 113
 
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -33,89 +33,89 @@
 block discarded – undo
33 33
  * Repairs shares with invalid data
34 34
  */
35 35
 class RepairInvalidShares implements IRepairStep {
36
-	public const CHUNK_SIZE = 200;
37
-
38
-	/** @var \OCP\IConfig */
39
-	protected $config;
40
-
41
-	/** @var \OCP\IDBConnection */
42
-	protected $connection;
43
-
44
-	/**
45
-	 * @param \OCP\IConfig $config
46
-	 * @param \OCP\IDBConnection $connection
47
-	 */
48
-	public function __construct($config, $connection) {
49
-		$this->connection = $connection;
50
-		$this->config = $config;
51
-	}
52
-
53
-	public function getName() {
54
-		return 'Repair invalid shares';
55
-	}
56
-
57
-	/**
58
-	 * Adjust file share permissions
59
-	 */
60
-	private function adjustFileSharePermissions(IOutput $out) {
61
-		$mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
62
-		$builder = $this->connection->getQueryBuilder();
63
-
64
-		$permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
65
-		$builder
66
-			->update('share')
67
-			->set('permissions', $permsFunc)
68
-			->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
69
-			->andWhere($builder->expr()->neq('permissions', $permsFunc));
70
-
71
-		$updatedEntries = $builder->execute();
72
-		if ($updatedEntries > 0) {
73
-			$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
-		}
75
-	}
76
-
77
-	/**
78
-	 * Remove shares where the parent share does not exist anymore
79
-	 */
80
-	private function removeSharesNonExistingParent(IOutput $out) {
81
-		$deletedEntries = 0;
82
-
83
-		$query = $this->connection->getQueryBuilder();
84
-		$query->select('s1.parent')
85
-			->from('share', 's1')
86
-			->where($query->expr()->isNotNull('s1.parent'))
87
-				->andWhere($query->expr()->isNull('s2.id'))
88
-			->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
89
-			->groupBy('s1.parent')
90
-			->setMaxResults(self::CHUNK_SIZE);
91
-
92
-		$deleteQuery = $this->connection->getQueryBuilder();
93
-		$deleteQuery->delete('share')
94
-			->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
95
-
96
-		$deletedInLastChunk = self::CHUNK_SIZE;
97
-		while ($deletedInLastChunk === self::CHUNK_SIZE) {
98
-			$deletedInLastChunk = 0;
99
-			$result = $query->execute();
100
-			while ($row = $result->fetch()) {
101
-				$deletedInLastChunk++;
102
-				$deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
103
-					->execute();
104
-			}
105
-			$result->closeCursor();
106
-		}
107
-
108
-		if ($deletedEntries) {
109
-			$out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
-		}
111
-	}
112
-
113
-	public function run(IOutput $out) {
114
-		$ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
115
-		if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
116
-			$this->adjustFileSharePermissions($out);
117
-		}
118
-
119
-		$this->removeSharesNonExistingParent($out);
120
-	}
36
+    public const CHUNK_SIZE = 200;
37
+
38
+    /** @var \OCP\IConfig */
39
+    protected $config;
40
+
41
+    /** @var \OCP\IDBConnection */
42
+    protected $connection;
43
+
44
+    /**
45
+     * @param \OCP\IConfig $config
46
+     * @param \OCP\IDBConnection $connection
47
+     */
48
+    public function __construct($config, $connection) {
49
+        $this->connection = $connection;
50
+        $this->config = $config;
51
+    }
52
+
53
+    public function getName() {
54
+        return 'Repair invalid shares';
55
+    }
56
+
57
+    /**
58
+     * Adjust file share permissions
59
+     */
60
+    private function adjustFileSharePermissions(IOutput $out) {
61
+        $mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
62
+        $builder = $this->connection->getQueryBuilder();
63
+
64
+        $permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
65
+        $builder
66
+            ->update('share')
67
+            ->set('permissions', $permsFunc)
68
+            ->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
69
+            ->andWhere($builder->expr()->neq('permissions', $permsFunc));
70
+
71
+        $updatedEntries = $builder->execute();
72
+        if ($updatedEntries > 0) {
73
+            $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
+        }
75
+    }
76
+
77
+    /**
78
+     * Remove shares where the parent share does not exist anymore
79
+     */
80
+    private function removeSharesNonExistingParent(IOutput $out) {
81
+        $deletedEntries = 0;
82
+
83
+        $query = $this->connection->getQueryBuilder();
84
+        $query->select('s1.parent')
85
+            ->from('share', 's1')
86
+            ->where($query->expr()->isNotNull('s1.parent'))
87
+                ->andWhere($query->expr()->isNull('s2.id'))
88
+            ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
89
+            ->groupBy('s1.parent')
90
+            ->setMaxResults(self::CHUNK_SIZE);
91
+
92
+        $deleteQuery = $this->connection->getQueryBuilder();
93
+        $deleteQuery->delete('share')
94
+            ->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
95
+
96
+        $deletedInLastChunk = self::CHUNK_SIZE;
97
+        while ($deletedInLastChunk === self::CHUNK_SIZE) {
98
+            $deletedInLastChunk = 0;
99
+            $result = $query->execute();
100
+            while ($row = $result->fetch()) {
101
+                $deletedInLastChunk++;
102
+                $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
103
+                    ->execute();
104
+            }
105
+            $result->closeCursor();
106
+        }
107
+
108
+        if ($deletedEntries) {
109
+            $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
+        }
111
+    }
112
+
113
+    public function run(IOutput $out) {
114
+        $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
115
+        if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
116
+            $this->adjustFileSharePermissions($out);
117
+        }
118
+
119
+        $this->removeSharesNonExistingParent($out);
120
+    }
121 121
 }
Please login to merge, or discard this patch.
apps/dav/appinfo/v2/remote.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 // no php execution timeout for webdav
23 23
 if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
24
-	@set_time_limit(0);
24
+    @set_time_limit(0);
25 25
 }
26 26
 ignore_user_abort(true);
27 27
 
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 
216 216
 		if ($provider === null) {
217
-			throw new ProviderException('No provider with id .' . $id . ' found.');
217
+			throw new ProviderException('No provider with id .'.$id.' found.');
218 218
 		}
219 219
 
220 220
 		return $provider;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 		if ($provider === null) {
244
-			throw new ProviderException('No share provider for share type ' . $shareType);
244
+			throw new ProviderException('No share provider for share type '.$shareType);
245 245
 		}
246 246
 
247 247
 		return $provider;
Please login to merge, or discard this patch.
Indentation   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -55,311 +55,311 @@
 block discarded – undo
55 55
  */
56 56
 class ProviderFactory implements IProviderFactory {
57 57
 
58
-	/** @var IServerContainer */
59
-	private $serverContainer;
60
-	/** @var DefaultShareProvider */
61
-	private $defaultProvider = null;
62
-	/** @var FederatedShareProvider */
63
-	private $federatedProvider = null;
64
-	/** @var  ShareByMailProvider */
65
-	private $shareByMailProvider;
66
-	/** @var  \OCA\Circles\ShareByCircleProvider */
67
-	private $shareByCircleProvider = null;
68
-	/** @var bool */
69
-	private $circlesAreNotAvailable = false;
70
-	/** @var \OCA\Talk\Share\RoomShareProvider */
71
-	private $roomShareProvider = null;
72
-
73
-	private $registeredShareProviders = [];
74
-
75
-	private $shareProviders = [];
76
-
77
-	/**
78
-	 * IProviderFactory constructor.
79
-	 *
80
-	 * @param IServerContainer $serverContainer
81
-	 */
82
-	public function __construct(IServerContainer $serverContainer) {
83
-		$this->serverContainer = $serverContainer;
84
-	}
85
-
86
-	public function registerProvider(string $shareProviderClass): void {
87
-		$this->registeredShareProviders[] = $shareProviderClass;
88
-	}
89
-
90
-	/**
91
-	 * Create the default share provider.
92
-	 *
93
-	 * @return DefaultShareProvider
94
-	 */
95
-	protected function defaultShareProvider() {
96
-		if ($this->defaultProvider === null) {
97
-			$this->defaultProvider = new DefaultShareProvider(
98
-				$this->serverContainer->getDatabaseConnection(),
99
-				$this->serverContainer->getUserManager(),
100
-				$this->serverContainer->getGroupManager(),
101
-				$this->serverContainer->getLazyRootFolder(),
102
-				$this->serverContainer->getMailer(),
103
-				$this->serverContainer->query(Defaults::class),
104
-				$this->serverContainer->getL10NFactory(),
105
-				$this->serverContainer->getURLGenerator(),
106
-				$this->serverContainer->getConfig()
107
-			);
108
-		}
109
-
110
-		return $this->defaultProvider;
111
-	}
112
-
113
-	/**
114
-	 * Create the federated share provider
115
-	 *
116
-	 * @return FederatedShareProvider
117
-	 */
118
-	protected function federatedShareProvider() {
119
-		if ($this->federatedProvider === null) {
120
-			/*
58
+    /** @var IServerContainer */
59
+    private $serverContainer;
60
+    /** @var DefaultShareProvider */
61
+    private $defaultProvider = null;
62
+    /** @var FederatedShareProvider */
63
+    private $federatedProvider = null;
64
+    /** @var  ShareByMailProvider */
65
+    private $shareByMailProvider;
66
+    /** @var  \OCA\Circles\ShareByCircleProvider */
67
+    private $shareByCircleProvider = null;
68
+    /** @var bool */
69
+    private $circlesAreNotAvailable = false;
70
+    /** @var \OCA\Talk\Share\RoomShareProvider */
71
+    private $roomShareProvider = null;
72
+
73
+    private $registeredShareProviders = [];
74
+
75
+    private $shareProviders = [];
76
+
77
+    /**
78
+     * IProviderFactory constructor.
79
+     *
80
+     * @param IServerContainer $serverContainer
81
+     */
82
+    public function __construct(IServerContainer $serverContainer) {
83
+        $this->serverContainer = $serverContainer;
84
+    }
85
+
86
+    public function registerProvider(string $shareProviderClass): void {
87
+        $this->registeredShareProviders[] = $shareProviderClass;
88
+    }
89
+
90
+    /**
91
+     * Create the default share provider.
92
+     *
93
+     * @return DefaultShareProvider
94
+     */
95
+    protected function defaultShareProvider() {
96
+        if ($this->defaultProvider === null) {
97
+            $this->defaultProvider = new DefaultShareProvider(
98
+                $this->serverContainer->getDatabaseConnection(),
99
+                $this->serverContainer->getUserManager(),
100
+                $this->serverContainer->getGroupManager(),
101
+                $this->serverContainer->getLazyRootFolder(),
102
+                $this->serverContainer->getMailer(),
103
+                $this->serverContainer->query(Defaults::class),
104
+                $this->serverContainer->getL10NFactory(),
105
+                $this->serverContainer->getURLGenerator(),
106
+                $this->serverContainer->getConfig()
107
+            );
108
+        }
109
+
110
+        return $this->defaultProvider;
111
+    }
112
+
113
+    /**
114
+     * Create the federated share provider
115
+     *
116
+     * @return FederatedShareProvider
117
+     */
118
+    protected function federatedShareProvider() {
119
+        if ($this->federatedProvider === null) {
120
+            /*
121 121
 			 * Check if the app is enabled
122 122
 			 */
123
-			$appManager = $this->serverContainer->getAppManager();
124
-			if (!$appManager->isEnabledForUser('federatedfilesharing')) {
125
-				return null;
126
-			}
123
+            $appManager = $this->serverContainer->getAppManager();
124
+            if (!$appManager->isEnabledForUser('federatedfilesharing')) {
125
+                return null;
126
+            }
127 127
 
128
-			/*
128
+            /*
129 129
 			 * TODO: add factory to federated sharing app
130 130
 			 */
131
-			$l = $this->serverContainer->getL10N('federatedfilesharing');
132
-			$addressHandler = new AddressHandler(
133
-				$this->serverContainer->getURLGenerator(),
134
-				$l,
135
-				$this->serverContainer->getCloudIdManager()
136
-			);
137
-			$notifications = new Notifications(
138
-				$addressHandler,
139
-				$this->serverContainer->getHTTPClientService(),
140
-				$this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
141
-				$this->serverContainer->getLogger(),
142
-				$this->serverContainer->getJobList(),
143
-				\OC::$server->getCloudFederationProviderManager(),
144
-				\OC::$server->getCloudFederationFactory(),
145
-				$this->serverContainer->query(IEventDispatcher::class)
146
-			);
147
-			$tokenHandler = new TokenHandler(
148
-				$this->serverContainer->getSecureRandom()
149
-			);
150
-
151
-			$this->federatedProvider = new FederatedShareProvider(
152
-				$this->serverContainer->getDatabaseConnection(),
153
-				$addressHandler,
154
-				$notifications,
155
-				$tokenHandler,
156
-				$l,
157
-				$this->serverContainer->getLogger(),
158
-				$this->serverContainer->getLazyRootFolder(),
159
-				$this->serverContainer->getConfig(),
160
-				$this->serverContainer->getUserManager(),
161
-				$this->serverContainer->getCloudIdManager(),
162
-				$this->serverContainer->getGlobalScaleConfig(),
163
-				$this->serverContainer->getCloudFederationProviderManager()
164
-			);
165
-		}
166
-
167
-		return $this->federatedProvider;
168
-	}
169
-
170
-	/**
171
-	 * Create the federated share provider
172
-	 *
173
-	 * @return ShareByMailProvider
174
-	 */
175
-	protected function getShareByMailProvider() {
176
-		if ($this->shareByMailProvider === null) {
177
-			/*
131
+            $l = $this->serverContainer->getL10N('federatedfilesharing');
132
+            $addressHandler = new AddressHandler(
133
+                $this->serverContainer->getURLGenerator(),
134
+                $l,
135
+                $this->serverContainer->getCloudIdManager()
136
+            );
137
+            $notifications = new Notifications(
138
+                $addressHandler,
139
+                $this->serverContainer->getHTTPClientService(),
140
+                $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
141
+                $this->serverContainer->getLogger(),
142
+                $this->serverContainer->getJobList(),
143
+                \OC::$server->getCloudFederationProviderManager(),
144
+                \OC::$server->getCloudFederationFactory(),
145
+                $this->serverContainer->query(IEventDispatcher::class)
146
+            );
147
+            $tokenHandler = new TokenHandler(
148
+                $this->serverContainer->getSecureRandom()
149
+            );
150
+
151
+            $this->federatedProvider = new FederatedShareProvider(
152
+                $this->serverContainer->getDatabaseConnection(),
153
+                $addressHandler,
154
+                $notifications,
155
+                $tokenHandler,
156
+                $l,
157
+                $this->serverContainer->getLogger(),
158
+                $this->serverContainer->getLazyRootFolder(),
159
+                $this->serverContainer->getConfig(),
160
+                $this->serverContainer->getUserManager(),
161
+                $this->serverContainer->getCloudIdManager(),
162
+                $this->serverContainer->getGlobalScaleConfig(),
163
+                $this->serverContainer->getCloudFederationProviderManager()
164
+            );
165
+        }
166
+
167
+        return $this->federatedProvider;
168
+    }
169
+
170
+    /**
171
+     * Create the federated share provider
172
+     *
173
+     * @return ShareByMailProvider
174
+     */
175
+    protected function getShareByMailProvider() {
176
+        if ($this->shareByMailProvider === null) {
177
+            /*
178 178
 			 * Check if the app is enabled
179 179
 			 */
180
-			$appManager = $this->serverContainer->getAppManager();
181
-			if (!$appManager->isEnabledForUser('sharebymail')) {
182
-				return null;
183
-			}
184
-
185
-			$settingsManager = new SettingsManager($this->serverContainer->getConfig());
186
-
187
-			$this->shareByMailProvider = new ShareByMailProvider(
188
-				$this->serverContainer->getDatabaseConnection(),
189
-				$this->serverContainer->getSecureRandom(),
190
-				$this->serverContainer->getUserManager(),
191
-				$this->serverContainer->getLazyRootFolder(),
192
-				$this->serverContainer->getL10N('sharebymail'),
193
-				$this->serverContainer->getLogger(),
194
-				$this->serverContainer->getMailer(),
195
-				$this->serverContainer->getURLGenerator(),
196
-				$this->serverContainer->getActivityManager(),
197
-				$settingsManager,
198
-				$this->serverContainer->query(Defaults::class),
199
-				$this->serverContainer->getHasher(),
200
-				$this->serverContainer->get(IEventDispatcher::class),
201
-				$this->serverContainer->get(IManager::class)
202
-			);
203
-		}
204
-
205
-		return $this->shareByMailProvider;
206
-	}
207
-
208
-
209
-	/**
210
-	 * Create the circle share provider
211
-	 *
212
-	 * @return FederatedShareProvider
213
-	 *
214
-	 * @suppress PhanUndeclaredClassMethod
215
-	 */
216
-	protected function getShareByCircleProvider() {
217
-		if ($this->circlesAreNotAvailable) {
218
-			return null;
219
-		}
220
-
221
-		if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
222
-			!class_exists('\OCA\Circles\ShareByCircleProvider')
223
-		) {
224
-			$this->circlesAreNotAvailable = true;
225
-			return null;
226
-		}
227
-
228
-		if ($this->shareByCircleProvider === null) {
229
-			$this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
230
-				$this->serverContainer->getDatabaseConnection(),
231
-				$this->serverContainer->getSecureRandom(),
232
-				$this->serverContainer->getUserManager(),
233
-				$this->serverContainer->getLazyRootFolder(),
234
-				$this->serverContainer->getL10N('circles'),
235
-				$this->serverContainer->getLogger(),
236
-				$this->serverContainer->getURLGenerator()
237
-			);
238
-		}
239
-
240
-		return $this->shareByCircleProvider;
241
-	}
242
-
243
-	/**
244
-	 * Create the room share provider
245
-	 *
246
-	 * @return RoomShareProvider
247
-	 */
248
-	protected function getRoomShareProvider() {
249
-		if ($this->roomShareProvider === null) {
250
-			/*
180
+            $appManager = $this->serverContainer->getAppManager();
181
+            if (!$appManager->isEnabledForUser('sharebymail')) {
182
+                return null;
183
+            }
184
+
185
+            $settingsManager = new SettingsManager($this->serverContainer->getConfig());
186
+
187
+            $this->shareByMailProvider = new ShareByMailProvider(
188
+                $this->serverContainer->getDatabaseConnection(),
189
+                $this->serverContainer->getSecureRandom(),
190
+                $this->serverContainer->getUserManager(),
191
+                $this->serverContainer->getLazyRootFolder(),
192
+                $this->serverContainer->getL10N('sharebymail'),
193
+                $this->serverContainer->getLogger(),
194
+                $this->serverContainer->getMailer(),
195
+                $this->serverContainer->getURLGenerator(),
196
+                $this->serverContainer->getActivityManager(),
197
+                $settingsManager,
198
+                $this->serverContainer->query(Defaults::class),
199
+                $this->serverContainer->getHasher(),
200
+                $this->serverContainer->get(IEventDispatcher::class),
201
+                $this->serverContainer->get(IManager::class)
202
+            );
203
+        }
204
+
205
+        return $this->shareByMailProvider;
206
+    }
207
+
208
+
209
+    /**
210
+     * Create the circle share provider
211
+     *
212
+     * @return FederatedShareProvider
213
+     *
214
+     * @suppress PhanUndeclaredClassMethod
215
+     */
216
+    protected function getShareByCircleProvider() {
217
+        if ($this->circlesAreNotAvailable) {
218
+            return null;
219
+        }
220
+
221
+        if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
222
+            !class_exists('\OCA\Circles\ShareByCircleProvider')
223
+        ) {
224
+            $this->circlesAreNotAvailable = true;
225
+            return null;
226
+        }
227
+
228
+        if ($this->shareByCircleProvider === null) {
229
+            $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
230
+                $this->serverContainer->getDatabaseConnection(),
231
+                $this->serverContainer->getSecureRandom(),
232
+                $this->serverContainer->getUserManager(),
233
+                $this->serverContainer->getLazyRootFolder(),
234
+                $this->serverContainer->getL10N('circles'),
235
+                $this->serverContainer->getLogger(),
236
+                $this->serverContainer->getURLGenerator()
237
+            );
238
+        }
239
+
240
+        return $this->shareByCircleProvider;
241
+    }
242
+
243
+    /**
244
+     * Create the room share provider
245
+     *
246
+     * @return RoomShareProvider
247
+     */
248
+    protected function getRoomShareProvider() {
249
+        if ($this->roomShareProvider === null) {
250
+            /*
251 251
 			 * Check if the app is enabled
252 252
 			 */
253
-			$appManager = $this->serverContainer->getAppManager();
254
-			if (!$appManager->isEnabledForUser('spreed')) {
255
-				return null;
256
-			}
257
-
258
-			try {
259
-				$this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
260
-			} catch (\OCP\AppFramework\QueryException $e) {
261
-				return null;
262
-			}
263
-		}
264
-
265
-		return $this->roomShareProvider;
266
-	}
267
-
268
-	/**
269
-	 * @inheritdoc
270
-	 */
271
-	public function getProvider($id) {
272
-		$provider = null;
273
-		if (isset($this->shareProviders[$id])) {
274
-			return $this->shareProviders[$id];
275
-		}
276
-
277
-		if ($id === 'ocinternal') {
278
-			$provider = $this->defaultShareProvider();
279
-		} elseif ($id === 'ocFederatedSharing') {
280
-			$provider = $this->federatedShareProvider();
281
-		} elseif ($id === 'ocMailShare') {
282
-			$provider = $this->getShareByMailProvider();
283
-		} elseif ($id === 'ocCircleShare') {
284
-			$provider = $this->getShareByCircleProvider();
285
-		} elseif ($id === 'ocRoomShare') {
286
-			$provider = $this->getRoomShareProvider();
287
-		}
288
-
289
-		foreach ($this->registeredShareProviders as $shareProvider) {
290
-			/** @var IShareProvider $instance */
291
-			$instance = $this->serverContainer->get($shareProvider);
292
-			$this->shareProviders[$instance->identifier()] = $instance;
293
-		}
294
-
295
-		if (isset($this->shareProviders[$id])) {
296
-			$provider = $this->shareProviders[$id];
297
-		}
298
-
299
-		if ($provider === null) {
300
-			throw new ProviderException('No provider with id .' . $id . ' found.');
301
-		}
302
-
303
-		return $provider;
304
-	}
305
-
306
-	/**
307
-	 * @inheritdoc
308
-	 */
309
-	public function getProviderForType($shareType) {
310
-		$provider = null;
311
-
312
-		if ($shareType === IShare::TYPE_USER ||
313
-			$shareType === IShare::TYPE_GROUP ||
314
-			$shareType === IShare::TYPE_LINK
315
-		) {
316
-			$provider = $this->defaultShareProvider();
317
-		} elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
318
-			$provider = $this->federatedShareProvider();
319
-		} elseif ($shareType === IShare::TYPE_EMAIL) {
320
-			$provider = $this->getShareByMailProvider();
321
-		} elseif ($shareType === IShare::TYPE_CIRCLE) {
322
-			$provider = $this->getShareByCircleProvider();
323
-		} elseif ($shareType === IShare::TYPE_ROOM) {
324
-			$provider = $this->getRoomShareProvider();
325
-		} elseif ($shareType === IShare::TYPE_DECK) {
326
-			$provider = $this->getProvider('deck');
327
-		}
328
-
329
-
330
-		if ($provider === null) {
331
-			throw new ProviderException('No share provider for share type ' . $shareType);
332
-		}
333
-
334
-		return $provider;
335
-	}
336
-
337
-	public function getAllProviders() {
338
-		$shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
339
-		$shareByMail = $this->getShareByMailProvider();
340
-		if ($shareByMail !== null) {
341
-			$shares[] = $shareByMail;
342
-		}
343
-		$shareByCircle = $this->getShareByCircleProvider();
344
-		if ($shareByCircle !== null) {
345
-			$shares[] = $shareByCircle;
346
-		}
347
-		$roomShare = $this->getRoomShareProvider();
348
-		if ($roomShare !== null) {
349
-			$shares[] = $roomShare;
350
-		}
351
-
352
-		foreach ($this->registeredShareProviders as $shareProvider) {
353
-			/** @var IShareProvider $instance */
354
-			$instance = $this->serverContainer->get($shareProvider);
355
-			if (!isset($this->shareProviders[$instance->identifier()])) {
356
-				$this->shareProviders[$instance->identifier()] = $instance;
357
-			}
358
-			$shares[] = $this->shareProviders[$instance->identifier()];
359
-		}
360
-
361
-
362
-
363
-		return $shares;
364
-	}
253
+            $appManager = $this->serverContainer->getAppManager();
254
+            if (!$appManager->isEnabledForUser('spreed')) {
255
+                return null;
256
+            }
257
+
258
+            try {
259
+                $this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
260
+            } catch (\OCP\AppFramework\QueryException $e) {
261
+                return null;
262
+            }
263
+        }
264
+
265
+        return $this->roomShareProvider;
266
+    }
267
+
268
+    /**
269
+     * @inheritdoc
270
+     */
271
+    public function getProvider($id) {
272
+        $provider = null;
273
+        if (isset($this->shareProviders[$id])) {
274
+            return $this->shareProviders[$id];
275
+        }
276
+
277
+        if ($id === 'ocinternal') {
278
+            $provider = $this->defaultShareProvider();
279
+        } elseif ($id === 'ocFederatedSharing') {
280
+            $provider = $this->federatedShareProvider();
281
+        } elseif ($id === 'ocMailShare') {
282
+            $provider = $this->getShareByMailProvider();
283
+        } elseif ($id === 'ocCircleShare') {
284
+            $provider = $this->getShareByCircleProvider();
285
+        } elseif ($id === 'ocRoomShare') {
286
+            $provider = $this->getRoomShareProvider();
287
+        }
288
+
289
+        foreach ($this->registeredShareProviders as $shareProvider) {
290
+            /** @var IShareProvider $instance */
291
+            $instance = $this->serverContainer->get($shareProvider);
292
+            $this->shareProviders[$instance->identifier()] = $instance;
293
+        }
294
+
295
+        if (isset($this->shareProviders[$id])) {
296
+            $provider = $this->shareProviders[$id];
297
+        }
298
+
299
+        if ($provider === null) {
300
+            throw new ProviderException('No provider with id .' . $id . ' found.');
301
+        }
302
+
303
+        return $provider;
304
+    }
305
+
306
+    /**
307
+     * @inheritdoc
308
+     */
309
+    public function getProviderForType($shareType) {
310
+        $provider = null;
311
+
312
+        if ($shareType === IShare::TYPE_USER ||
313
+            $shareType === IShare::TYPE_GROUP ||
314
+            $shareType === IShare::TYPE_LINK
315
+        ) {
316
+            $provider = $this->defaultShareProvider();
317
+        } elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
318
+            $provider = $this->federatedShareProvider();
319
+        } elseif ($shareType === IShare::TYPE_EMAIL) {
320
+            $provider = $this->getShareByMailProvider();
321
+        } elseif ($shareType === IShare::TYPE_CIRCLE) {
322
+            $provider = $this->getShareByCircleProvider();
323
+        } elseif ($shareType === IShare::TYPE_ROOM) {
324
+            $provider = $this->getRoomShareProvider();
325
+        } elseif ($shareType === IShare::TYPE_DECK) {
326
+            $provider = $this->getProvider('deck');
327
+        }
328
+
329
+
330
+        if ($provider === null) {
331
+            throw new ProviderException('No share provider for share type ' . $shareType);
332
+        }
333
+
334
+        return $provider;
335
+    }
336
+
337
+    public function getAllProviders() {
338
+        $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
339
+        $shareByMail = $this->getShareByMailProvider();
340
+        if ($shareByMail !== null) {
341
+            $shares[] = $shareByMail;
342
+        }
343
+        $shareByCircle = $this->getShareByCircleProvider();
344
+        if ($shareByCircle !== null) {
345
+            $shares[] = $shareByCircle;
346
+        }
347
+        $roomShare = $this->getRoomShareProvider();
348
+        if ($roomShare !== null) {
349
+            $shares[] = $roomShare;
350
+        }
351
+
352
+        foreach ($this->registeredShareProviders as $shareProvider) {
353
+            /** @var IShareProvider $instance */
354
+            $instance = $this->serverContainer->get($shareProvider);
355
+            if (!isset($this->shareProviders[$instance->identifier()])) {
356
+                $this->shareProviders[$instance->identifier()] = $instance;
357
+            }
358
+            $shares[] = $this->shareProviders[$instance->identifier()];
359
+        }
360
+
361
+
362
+
363
+        return $shares;
364
+    }
365 365
 }
Please login to merge, or discard this patch.