Passed
Push — master ( 730af0...3b14ce )
by Roeland
12:25 queued 11s
created
apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -36,59 +36,59 @@
 block discarded – undo
36 36
 
37 37
 class SystemTagsRelationsCollection extends SimpleCollection {
38 38
 
39
-	/**
40
-	 * SystemTagsRelationsCollection constructor.
41
-	 *
42
-	 * @param ISystemTagManager $tagManager
43
-	 * @param ISystemTagObjectMapper $tagMapper
44
-	 * @param IUserSession $userSession
45
-	 * @param IGroupManager $groupManager
46
-	 * @param EventDispatcherInterface $dispatcher
47
-	 */
48
-	public function __construct(
49
-		ISystemTagManager $tagManager,
50
-		ISystemTagObjectMapper $tagMapper,
51
-		IUserSession $userSession,
52
-		IGroupManager $groupManager,
53
-		EventDispatcherInterface $dispatcher
54
-	) {
55
-		$children = [
56
-			new SystemTagsObjectTypeCollection(
57
-				'files',
58
-				$tagManager,
59
-				$tagMapper,
60
-				$userSession,
61
-				$groupManager,
62
-				function($name) {
63
-					$nodes = \OC::$server->getUserFolder()->getById((int)$name);
64
-					return !empty($nodes);
65
-				}
66
-			),
67
-		];
39
+    /**
40
+     * SystemTagsRelationsCollection constructor.
41
+     *
42
+     * @param ISystemTagManager $tagManager
43
+     * @param ISystemTagObjectMapper $tagMapper
44
+     * @param IUserSession $userSession
45
+     * @param IGroupManager $groupManager
46
+     * @param EventDispatcherInterface $dispatcher
47
+     */
48
+    public function __construct(
49
+        ISystemTagManager $tagManager,
50
+        ISystemTagObjectMapper $tagMapper,
51
+        IUserSession $userSession,
52
+        IGroupManager $groupManager,
53
+        EventDispatcherInterface $dispatcher
54
+    ) {
55
+        $children = [
56
+            new SystemTagsObjectTypeCollection(
57
+                'files',
58
+                $tagManager,
59
+                $tagMapper,
60
+                $userSession,
61
+                $groupManager,
62
+                function($name) {
63
+                    $nodes = \OC::$server->getUserFolder()->getById((int)$name);
64
+                    return !empty($nodes);
65
+                }
66
+            ),
67
+        ];
68 68
 
69
-		$event = new SystemTagsEntityEvent(SystemTagsEntityEvent::EVENT_ENTITY);
70
-		$dispatcher->dispatch(SystemTagsEntityEvent::EVENT_ENTITY, $event);
69
+        $event = new SystemTagsEntityEvent(SystemTagsEntityEvent::EVENT_ENTITY);
70
+        $dispatcher->dispatch(SystemTagsEntityEvent::EVENT_ENTITY, $event);
71 71
 
72
-		foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) {
73
-			$children[] = new SystemTagsObjectTypeCollection(
74
-				$entity,
75
-				$tagManager,
76
-				$tagMapper,
77
-				$userSession,
78
-				$groupManager,
79
-				$entityExistsFunction
80
-			);
81
-		}
72
+        foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) {
73
+            $children[] = new SystemTagsObjectTypeCollection(
74
+                $entity,
75
+                $tagManager,
76
+                $tagMapper,
77
+                $userSession,
78
+                $groupManager,
79
+                $entityExistsFunction
80
+            );
81
+        }
82 82
 
83
-		parent::__construct('root', $children);
84
-	}
83
+        parent::__construct('root', $children);
84
+    }
85 85
 
86
-	function getName() {
87
-		return 'systemtags-relations';
88
-	}
86
+    function getName() {
87
+        return 'systemtags-relations';
88
+    }
89 89
 
90
-	function setName($name) {
91
-		throw new Forbidden('Permission denied to rename this collection');
92
-	}
90
+    function setName($name) {
91
+        throw new Forbidden('Permission denied to rename this collection');
92
+    }
93 93
 
94 94
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Expiration.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -27,173 +27,173 @@
 block discarded – undo
27 27
 
28 28
 class Expiration {
29 29
 
30
-	// how long do we keep files a version if no other value is defined in the config file (unit: days)
31
-	const NO_OBLIGATION = -1;
32
-
33
-	/** @var ITimeFactory */
34
-	private $timeFactory;
35
-
36
-	/** @var string */
37
-	private $retentionObligation;
38
-
39
-	/** @var int */
40
-	private $minAge;
41
-
42
-	/** @var int */
43
-	private $maxAge;
44
-
45
-	/** @var bool */
46
-	private $canPurgeToSaveSpace;
47
-
48
-	public function __construct(IConfig $config,ITimeFactory $timeFactory){
49
-		$this->timeFactory = $timeFactory;
50
-		$this->retentionObligation = $config->getSystemValue('versions_retention_obligation', 'auto');
51
-
52
-		if ($this->retentionObligation !== 'disabled') {
53
-			$this->parseRetentionObligation();
54
-		}
55
-	}
56
-
57
-	/**
58
-	 * Is versions expiration enabled
59
-	 * @return bool
60
-	 */
61
-	public function isEnabled(){
62
-		return $this->retentionObligation !== 'disabled';
63
-	}
64
-
65
-	/**
66
-	 * Is default expiration active
67
-	 */
68
-	public function shouldAutoExpire(){
69
-		return $this->minAge === self::NO_OBLIGATION
70
-				|| $this->maxAge === self::NO_OBLIGATION;
71
-	}
72
-
73
-	/**
74
-	 * Check if given timestamp in expiration range
75
-	 * @param int $timestamp
76
-	 * @param bool $quotaExceeded
77
-	 * @return bool
78
-	 */
79
-	public function isExpired($timestamp, $quotaExceeded = false){
80
-		// No expiration if disabled
81
-		if (!$this->isEnabled()) {
82
-			return false;
83
-		}
84
-
85
-		// Purge to save space (if allowed)
86
-		if ($quotaExceeded && $this->canPurgeToSaveSpace) {
87
-			return true;
88
-		}
89
-
90
-		$time = $this->timeFactory->getTime();
91
-		// Never expire dates in future e.g. misconfiguration or negative time
92
-		// adjustment
93
-		if ($time<$timestamp) {
94
-			return false;
95
-		}
96
-
97
-		// Purge as too old
98
-		if ($this->maxAge !== self::NO_OBLIGATION) {
99
-			$maxTimestamp = $time - ($this->maxAge * 86400);
100
-			$isOlderThanMax = $timestamp < $maxTimestamp;
101
-		} else {
102
-			$isOlderThanMax = false;
103
-		}
104
-
105
-		if ($this->minAge !== self::NO_OBLIGATION) {
106
-			// older than Min obligation and we are running out of quota?
107
-			$minTimestamp = $time - ($this->minAge * 86400);
108
-			$isMinReached = ($timestamp < $minTimestamp) && $quotaExceeded;
109
-		} else {
110
-			$isMinReached = false;
111
-		}
112
-
113
-		return $isOlderThanMax || $isMinReached;
114
-	}
115
-
116
-	/**
117
-	 * Get maximal retention obligation as a timestamp
118
-	 * @return int
119
-	 */
120
-	public function getMaxAgeAsTimestamp(){
121
-		$maxAge = false;
122
-		if ($this->isEnabled() && $this->maxAge !== self::NO_OBLIGATION) {
123
-			$time = $this->timeFactory->getTime();
124
-			$maxAge = $time - ($this->maxAge * 86400);
125
-		}
126
-		return $maxAge;
127
-	}
128
-
129
-	/**
130
-	* Read versions_retention_obligation, validate it 
131
-	* and set private members accordingly
132
-	*/
133
-	private function parseRetentionObligation(){
134
-		$splitValues = explode(',', $this->retentionObligation);
135
-		if (!isset($splitValues[0])) {
136
-			$minValue = 'auto';
137
-		} else {
138
-			$minValue = trim($splitValues[0]);
139
-		}
140
-
141
-		if (!isset($splitValues[1])) {
142
-			$maxValue = 'auto';
143
-		} else {
144
-			$maxValue = trim($splitValues[1]);
145
-		}
146
-
147
-		$isValid = true;
148
-		// Validate
149
-		if (!ctype_digit($minValue) && $minValue !== 'auto') {
150
-			$isValid = false;
151
-			\OC::$server->getLogger()->warning(
152
-					$minValue . ' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
153
-					['app'=>'files_versions']
154
-			);
155
-		}
156
-
157
-		if (!ctype_digit($maxValue) && $maxValue !== 'auto') {
158
-			$isValid = false;
159
-			\OC::$server->getLogger()->warning(
160
-					$maxValue . ' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
161
-					['app'=>'files_versions']
162
-			);
163
-		}
164
-
165
-		if (!$isValid){
166
-			$minValue = 'auto';
167
-			$maxValue = 'auto';
168
-		}
169
-
170
-
171
-		if ($minValue === 'auto' && $maxValue === 'auto') {
172
-			// Default: Delete anytime if space needed
173
-			$this->minAge = self::NO_OBLIGATION;
174
-			$this->maxAge = self::NO_OBLIGATION;
175
-			$this->canPurgeToSaveSpace = true;
176
-		} elseif ($minValue !== 'auto' && $maxValue === 'auto') {
177
-			// Keep for X days but delete anytime if space needed
178
-			$this->minAge = (int)$minValue;
179
-			$this->maxAge = self::NO_OBLIGATION;
180
-			$this->canPurgeToSaveSpace = true;
181
-		} elseif ($minValue === 'auto' && $maxValue !== 'auto') {
182
-			// Delete anytime if space needed, Delete all older than max automatically
183
-			$this->minAge = self::NO_OBLIGATION;
184
-			$this->maxAge = (int)$maxValue;
185
-			$this->canPurgeToSaveSpace = true;
186
-		} elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
187
-			// Delete all older than max OR older than min if space needed
188
-
189
-			// Max < Min as per https://github.com/owncloud/core/issues/16301
190
-			if ($maxValue < $minValue) {
191
-				$maxValue = $minValue;
192
-			}
193
-
194
-			$this->minAge = (int)$minValue;
195
-			$this->maxAge = (int)$maxValue;
196
-			$this->canPurgeToSaveSpace = false;
197
-		}
198
-	}
30
+    // how long do we keep files a version if no other value is defined in the config file (unit: days)
31
+    const NO_OBLIGATION = -1;
32
+
33
+    /** @var ITimeFactory */
34
+    private $timeFactory;
35
+
36
+    /** @var string */
37
+    private $retentionObligation;
38
+
39
+    /** @var int */
40
+    private $minAge;
41
+
42
+    /** @var int */
43
+    private $maxAge;
44
+
45
+    /** @var bool */
46
+    private $canPurgeToSaveSpace;
47
+
48
+    public function __construct(IConfig $config,ITimeFactory $timeFactory){
49
+        $this->timeFactory = $timeFactory;
50
+        $this->retentionObligation = $config->getSystemValue('versions_retention_obligation', 'auto');
51
+
52
+        if ($this->retentionObligation !== 'disabled') {
53
+            $this->parseRetentionObligation();
54
+        }
55
+    }
56
+
57
+    /**
58
+     * Is versions expiration enabled
59
+     * @return bool
60
+     */
61
+    public function isEnabled(){
62
+        return $this->retentionObligation !== 'disabled';
63
+    }
64
+
65
+    /**
66
+     * Is default expiration active
67
+     */
68
+    public function shouldAutoExpire(){
69
+        return $this->minAge === self::NO_OBLIGATION
70
+                || $this->maxAge === self::NO_OBLIGATION;
71
+    }
72
+
73
+    /**
74
+     * Check if given timestamp in expiration range
75
+     * @param int $timestamp
76
+     * @param bool $quotaExceeded
77
+     * @return bool
78
+     */
79
+    public function isExpired($timestamp, $quotaExceeded = false){
80
+        // No expiration if disabled
81
+        if (!$this->isEnabled()) {
82
+            return false;
83
+        }
84
+
85
+        // Purge to save space (if allowed)
86
+        if ($quotaExceeded && $this->canPurgeToSaveSpace) {
87
+            return true;
88
+        }
89
+
90
+        $time = $this->timeFactory->getTime();
91
+        // Never expire dates in future e.g. misconfiguration or negative time
92
+        // adjustment
93
+        if ($time<$timestamp) {
94
+            return false;
95
+        }
96
+
97
+        // Purge as too old
98
+        if ($this->maxAge !== self::NO_OBLIGATION) {
99
+            $maxTimestamp = $time - ($this->maxAge * 86400);
100
+            $isOlderThanMax = $timestamp < $maxTimestamp;
101
+        } else {
102
+            $isOlderThanMax = false;
103
+        }
104
+
105
+        if ($this->minAge !== self::NO_OBLIGATION) {
106
+            // older than Min obligation and we are running out of quota?
107
+            $minTimestamp = $time - ($this->minAge * 86400);
108
+            $isMinReached = ($timestamp < $minTimestamp) && $quotaExceeded;
109
+        } else {
110
+            $isMinReached = false;
111
+        }
112
+
113
+        return $isOlderThanMax || $isMinReached;
114
+    }
115
+
116
+    /**
117
+     * Get maximal retention obligation as a timestamp
118
+     * @return int
119
+     */
120
+    public function getMaxAgeAsTimestamp(){
121
+        $maxAge = false;
122
+        if ($this->isEnabled() && $this->maxAge !== self::NO_OBLIGATION) {
123
+            $time = $this->timeFactory->getTime();
124
+            $maxAge = $time - ($this->maxAge * 86400);
125
+        }
126
+        return $maxAge;
127
+    }
128
+
129
+    /**
130
+     * Read versions_retention_obligation, validate it 
131
+     * and set private members accordingly
132
+     */
133
+    private function parseRetentionObligation(){
134
+        $splitValues = explode(',', $this->retentionObligation);
135
+        if (!isset($splitValues[0])) {
136
+            $minValue = 'auto';
137
+        } else {
138
+            $minValue = trim($splitValues[0]);
139
+        }
140
+
141
+        if (!isset($splitValues[1])) {
142
+            $maxValue = 'auto';
143
+        } else {
144
+            $maxValue = trim($splitValues[1]);
145
+        }
146
+
147
+        $isValid = true;
148
+        // Validate
149
+        if (!ctype_digit($minValue) && $minValue !== 'auto') {
150
+            $isValid = false;
151
+            \OC::$server->getLogger()->warning(
152
+                    $minValue . ' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
153
+                    ['app'=>'files_versions']
154
+            );
155
+        }
156
+
157
+        if (!ctype_digit($maxValue) && $maxValue !== 'auto') {
158
+            $isValid = false;
159
+            \OC::$server->getLogger()->warning(
160
+                    $maxValue . ' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
161
+                    ['app'=>'files_versions']
162
+            );
163
+        }
164
+
165
+        if (!$isValid){
166
+            $minValue = 'auto';
167
+            $maxValue = 'auto';
168
+        }
169
+
170
+
171
+        if ($minValue === 'auto' && $maxValue === 'auto') {
172
+            // Default: Delete anytime if space needed
173
+            $this->minAge = self::NO_OBLIGATION;
174
+            $this->maxAge = self::NO_OBLIGATION;
175
+            $this->canPurgeToSaveSpace = true;
176
+        } elseif ($minValue !== 'auto' && $maxValue === 'auto') {
177
+            // Keep for X days but delete anytime if space needed
178
+            $this->minAge = (int)$minValue;
179
+            $this->maxAge = self::NO_OBLIGATION;
180
+            $this->canPurgeToSaveSpace = true;
181
+        } elseif ($minValue === 'auto' && $maxValue !== 'auto') {
182
+            // Delete anytime if space needed, Delete all older than max automatically
183
+            $this->minAge = self::NO_OBLIGATION;
184
+            $this->maxAge = (int)$maxValue;
185
+            $this->canPurgeToSaveSpace = true;
186
+        } elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
187
+            // Delete all older than max OR older than min if space needed
188
+
189
+            // Max < Min as per https://github.com/owncloud/core/issues/16301
190
+            if ($maxValue < $minValue) {
191
+                $maxValue = $minValue;
192
+            }
193
+
194
+            $this->minAge = (int)$minValue;
195
+            $this->maxAge = (int)$maxValue;
196
+            $this->canPurgeToSaveSpace = false;
197
+        }
198
+    }
199 199
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Migration/UUIDFixInsert.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -32,70 +32,70 @@
 block discarded – undo
32 32
 
33 33
 class UUIDFixInsert implements IRepairStep {
34 34
 
35
-	/** @var IConfig */
36
-	protected $config;
35
+    /** @var IConfig */
36
+    protected $config;
37 37
 
38
-	/** @var UserMapping */
39
-	protected $userMapper;
38
+    /** @var UserMapping */
39
+    protected $userMapper;
40 40
 
41
-	/** @var GroupMapping */
42
-	protected $groupMapper;
41
+    /** @var GroupMapping */
42
+    protected $groupMapper;
43 43
 
44
-	/** @var IJobList */
45
-	protected $jobList;
44
+    /** @var IJobList */
45
+    protected $jobList;
46 46
 
47
-	public function __construct(IConfig $config, UserMapping $userMapper, GroupMapping $groupMapper, IJobList $jobList) {
48
-		$this->config = $config;
49
-		$this->userMapper = $userMapper;
50
-		$this->groupMapper = $groupMapper;
51
-		$this->jobList = $jobList;
52
-	}
47
+    public function __construct(IConfig $config, UserMapping $userMapper, GroupMapping $groupMapper, IJobList $jobList) {
48
+        $this->config = $config;
49
+        $this->userMapper = $userMapper;
50
+        $this->groupMapper = $groupMapper;
51
+        $this->jobList = $jobList;
52
+    }
53 53
 
54
-	/**
55
-	 * Returns the step's name
56
-	 *
57
-	 * @return string
58
-	 * @since 9.1.0
59
-	 */
60
-	public function getName() {
61
-		return 'Insert UUIDFix background job for user and group in batches';
62
-	}
54
+    /**
55
+     * Returns the step's name
56
+     *
57
+     * @return string
58
+     * @since 9.1.0
59
+     */
60
+    public function getName() {
61
+        return 'Insert UUIDFix background job for user and group in batches';
62
+    }
63 63
 
64
-	/**
65
-	 * Run repair step.
66
-	 * Must throw exception on error.
67
-	 *
68
-	 * @param IOutput $output
69
-	 * @throws \Exception in case of failure
70
-	 * @since 9.1.0
71
-	 */
72
-	public function run(IOutput $output) {
73
-		$installedVersion = $this->config->getAppValue('user_ldap', 'installed_version', '1.2.1');
74
-		if(version_compare($installedVersion, '1.2.1') !== -1) {
75
-			return;
76
-		}
64
+    /**
65
+     * Run repair step.
66
+     * Must throw exception on error.
67
+     *
68
+     * @param IOutput $output
69
+     * @throws \Exception in case of failure
70
+     * @since 9.1.0
71
+     */
72
+    public function run(IOutput $output) {
73
+        $installedVersion = $this->config->getAppValue('user_ldap', 'installed_version', '1.2.1');
74
+        if(version_compare($installedVersion, '1.2.1') !== -1) {
75
+            return;
76
+        }
77 77
 
78
-		foreach ([$this->userMapper, $this->groupMapper] as $mapper) {
79
-			$offset = 0;
80
-			$batchSize = 50;
81
-			$jobClass = $mapper instanceof UserMapping ? UUIDFixUser::class : UUIDFixGroup::class;
82
-			do {
83
-				$retry = false;
84
-				$records = $mapper->getList($offset, $batchSize);
85
-				if(count($records) === 0){
86
-					continue;
87
-				}
88
-				try {
89
-					$this->jobList->add($jobClass, ['records' => $records]);
90
-					$offset += $batchSize;
91
-				} catch (\InvalidArgumentException $e) {
92
-					if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) {
93
-						$batchSize = (int)floor(count($records) * 0.8);
94
-						$retry = true;
95
-					}
96
-				}
97
-			} while (count($records) === $batchSize || $retry);
98
-		}
78
+        foreach ([$this->userMapper, $this->groupMapper] as $mapper) {
79
+            $offset = 0;
80
+            $batchSize = 50;
81
+            $jobClass = $mapper instanceof UserMapping ? UUIDFixUser::class : UUIDFixGroup::class;
82
+            do {
83
+                $retry = false;
84
+                $records = $mapper->getList($offset, $batchSize);
85
+                if(count($records) === 0){
86
+                    continue;
87
+                }
88
+                try {
89
+                    $this->jobList->add($jobClass, ['records' => $records]);
90
+                    $offset += $batchSize;
91
+                } catch (\InvalidArgumentException $e) {
92
+                    if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) {
93
+                        $batchSize = (int)floor(count($records) * 0.8);
94
+                        $retry = true;
95
+                    }
96
+                }
97
+            } while (count($records) === $batchSize || $retry);
98
+        }
99 99
 
100
-	}
100
+    }
101 101
 }
Please login to merge, or discard this patch.
apps/sharebymail/lib/AppInfo/Application.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
30 30
 
31 31
 class Application extends App {
32 32
 
33
-	public function __construct(array $urlParams = array()) {
34
-		parent::__construct('sharebymail', $urlParams);
33
+    public function __construct(array $urlParams = array()) {
34
+        parent::__construct('sharebymail', $urlParams);
35 35
 
36
-		$settingsManager = \OC::$server->query(Settings\SettingsManager::class);
37
-		$settings = new Settings($settingsManager);
36
+        $settingsManager = \OC::$server->query(Settings\SettingsManager::class);
37
+        $settings = new Settings($settingsManager);
38 38
 
39
-		/** register capabilities */
40
-		$container = $this->getContainer();
41
-		$container->registerCapability(Capabilities::class);
39
+        /** register capabilities */
40
+        $container = $this->getContainer();
41
+        $container->registerCapability(Capabilities::class);
42 42
 
43
-		/** register hooks */
44
-		Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareProvider');
45
-		Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareByMailSettings');
46
-	}
43
+        /** register hooks */
44
+        Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareProvider');
45
+        Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareByMailSettings');
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
apps/files/lib/Helper.php 1 patch
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -39,232 +39,232 @@
 block discarded – undo
39 39
  * Helper class for manipulating file information
40 40
  */
41 41
 class Helper {
42
-	/**
43
-	 * @param string $dir
44
-	 * @return array
45
-	 * @throws \OCP\Files\NotFoundException
46
-	 */
47
-	public static function buildFileStorageStatistics($dir) {
48
-		// information about storage capacities
49
-		$storageInfo = \OC_Helper::getStorageInfo($dir);
50
-		$l = \OC::$server->getL10N('files');
51
-		$maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
52
-		$maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);
53
-		$maxHumanFileSize = $l->t('Upload (max. %s)', array($maxHumanFileSize));
42
+    /**
43
+     * @param string $dir
44
+     * @return array
45
+     * @throws \OCP\Files\NotFoundException
46
+     */
47
+    public static function buildFileStorageStatistics($dir) {
48
+        // information about storage capacities
49
+        $storageInfo = \OC_Helper::getStorageInfo($dir);
50
+        $l = \OC::$server->getL10N('files');
51
+        $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
52
+        $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);
53
+        $maxHumanFileSize = $l->t('Upload (max. %s)', array($maxHumanFileSize));
54 54
 
55
-		return [
56
-			'uploadMaxFilesize' => $maxUploadFileSize,
57
-			'maxHumanFilesize'  => $maxHumanFileSize,
58
-			'freeSpace' => $storageInfo['free'],
59
-			'quota' => $storageInfo['quota'],
60
-			'used' => $storageInfo['used'],
61
-			'usedSpacePercent'  => (int)$storageInfo['relative'],
62
-			'owner' => $storageInfo['owner'],
63
-			'ownerDisplayName' => $storageInfo['ownerDisplayName'],
64
-		];
65
-	}
55
+        return [
56
+            'uploadMaxFilesize' => $maxUploadFileSize,
57
+            'maxHumanFilesize'  => $maxHumanFileSize,
58
+            'freeSpace' => $storageInfo['free'],
59
+            'quota' => $storageInfo['quota'],
60
+            'used' => $storageInfo['used'],
61
+            'usedSpacePercent'  => (int)$storageInfo['relative'],
62
+            'owner' => $storageInfo['owner'],
63
+            'ownerDisplayName' => $storageInfo['ownerDisplayName'],
64
+        ];
65
+    }
66 66
 
67
-	/**
68
-	 * Determine icon for a given file
69
-	 *
70
-	 * @param \OCP\Files\FileInfo $file file info
71
-	 * @return string icon URL
72
-	 */
73
-	public static function determineIcon($file) {
74
-		if($file['type'] === 'dir') {
75
-			$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir');
76
-			// TODO: move this part to the client side, using mountType
77
-			if ($file->isShared()) {
78
-				$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-shared');
79
-			} elseif ($file->isMounted()) {
80
-				$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-external');
81
-			}
82
-		}else{
83
-			$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon($file->getMimetype());
84
-		}
67
+    /**
68
+     * Determine icon for a given file
69
+     *
70
+     * @param \OCP\Files\FileInfo $file file info
71
+     * @return string icon URL
72
+     */
73
+    public static function determineIcon($file) {
74
+        if($file['type'] === 'dir') {
75
+            $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir');
76
+            // TODO: move this part to the client side, using mountType
77
+            if ($file->isShared()) {
78
+                $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-shared');
79
+            } elseif ($file->isMounted()) {
80
+                $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-external');
81
+            }
82
+        }else{
83
+            $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon($file->getMimetype());
84
+        }
85 85
 
86
-		return substr($icon, 0, -3) . 'svg';
87
-	}
86
+        return substr($icon, 0, -3) . 'svg';
87
+    }
88 88
 
89
-	/**
90
-	 * Comparator function to sort files alphabetically and have
91
-	 * the directories appear first
92
-	 *
93
-	 * @param \OCP\Files\FileInfo $a file
94
-	 * @param \OCP\Files\FileInfo $b file
95
-	 * @return int -1 if $a must come before $b, 1 otherwise
96
-	 */
97
-	public static function compareFileNames(FileInfo $a, FileInfo $b) {
98
-		$aType = $a->getType();
99
-		$bType = $b->getType();
100
-		if ($aType === 'dir' and $bType !== 'dir') {
101
-			return -1;
102
-		} elseif ($aType !== 'dir' and $bType === 'dir') {
103
-			return 1;
104
-		} else {
105
-			return \OCP\Util::naturalSortCompare($a->getName(), $b->getName());
106
-		}
107
-	}
89
+    /**
90
+     * Comparator function to sort files alphabetically and have
91
+     * the directories appear first
92
+     *
93
+     * @param \OCP\Files\FileInfo $a file
94
+     * @param \OCP\Files\FileInfo $b file
95
+     * @return int -1 if $a must come before $b, 1 otherwise
96
+     */
97
+    public static function compareFileNames(FileInfo $a, FileInfo $b) {
98
+        $aType = $a->getType();
99
+        $bType = $b->getType();
100
+        if ($aType === 'dir' and $bType !== 'dir') {
101
+            return -1;
102
+        } elseif ($aType !== 'dir' and $bType === 'dir') {
103
+            return 1;
104
+        } else {
105
+            return \OCP\Util::naturalSortCompare($a->getName(), $b->getName());
106
+        }
107
+    }
108 108
 
109
-	/**
110
-	 * Comparator function to sort files by date
111
-	 *
112
-	 * @param \OCP\Files\FileInfo $a file
113
-	 * @param \OCP\Files\FileInfo $b file
114
-	 * @return int -1 if $a must come before $b, 1 otherwise
115
-	 */
116
-	public static function compareTimestamp(FileInfo $a, FileInfo $b) {
117
-		$aTime = $a->getMTime();
118
-		$bTime = $b->getMTime();
119
-		return ($aTime < $bTime) ? -1 : 1;
120
-	}
109
+    /**
110
+     * Comparator function to sort files by date
111
+     *
112
+     * @param \OCP\Files\FileInfo $a file
113
+     * @param \OCP\Files\FileInfo $b file
114
+     * @return int -1 if $a must come before $b, 1 otherwise
115
+     */
116
+    public static function compareTimestamp(FileInfo $a, FileInfo $b) {
117
+        $aTime = $a->getMTime();
118
+        $bTime = $b->getMTime();
119
+        return ($aTime < $bTime) ? -1 : 1;
120
+    }
121 121
 
122
-	/**
123
-	 * Comparator function to sort files by size
124
-	 *
125
-	 * @param \OCP\Files\FileInfo $a file
126
-	 * @param \OCP\Files\FileInfo $b file
127
-	 * @return int -1 if $a must come before $b, 1 otherwise
128
-	 */
129
-	public static function compareSize(FileInfo $a, FileInfo $b) {
130
-		$aSize = $a->getSize();
131
-		$bSize = $b->getSize();
132
-		return ($aSize < $bSize) ? -1 : 1;
133
-	}
122
+    /**
123
+     * Comparator function to sort files by size
124
+     *
125
+     * @param \OCP\Files\FileInfo $a file
126
+     * @param \OCP\Files\FileInfo $b file
127
+     * @return int -1 if $a must come before $b, 1 otherwise
128
+     */
129
+    public static function compareSize(FileInfo $a, FileInfo $b) {
130
+        $aSize = $a->getSize();
131
+        $bSize = $b->getSize();
132
+        return ($aSize < $bSize) ? -1 : 1;
133
+    }
134 134
 
135
-	/**
136
-	 * Formats the file info to be returned as JSON to the client.
137
-	 *
138
-	 * @param \OCP\Files\FileInfo $i
139
-	 * @return array formatted file info
140
-	 */
141
-	public static function formatFileInfo(FileInfo $i) {
142
-		$entry = array();
135
+    /**
136
+     * Formats the file info to be returned as JSON to the client.
137
+     *
138
+     * @param \OCP\Files\FileInfo $i
139
+     * @return array formatted file info
140
+     */
141
+    public static function formatFileInfo(FileInfo $i) {
142
+        $entry = array();
143 143
 
144
-		$entry['id'] = $i['fileid'];
145
-		$entry['parentId'] = $i['parent'];
146
-		$entry['mtime'] = $i['mtime'] * 1000;
147
-		// only pick out the needed attributes
148
-		$entry['name'] = $i->getName();
149
-		$entry['permissions'] = $i['permissions'];
150
-		$entry['mimetype'] = $i['mimetype'];
151
-		$entry['size'] = $i['size'];
152
-		$entry['type'] = $i['type'];
153
-		$entry['etag'] = $i['etag'];
154
-		if (isset($i['tags'])) {
155
-			$entry['tags'] = $i['tags'];
156
-		}
157
-		if (isset($i['displayname_owner'])) {
158
-			$entry['shareOwner'] = $i['displayname_owner'];
159
-		}
160
-		if (isset($i['is_share_mount_point'])) {
161
-			$entry['isShareMountPoint'] = $i['is_share_mount_point'];
162
-		}
163
-		$mountType = null;
164
-		$mount = $i->getMountPoint();
165
-		$mountType = $mount->getMountType();
166
-		if ($mountType !== '') {
167
-			if ($i->getInternalPath() === '') {
168
-				$mountType .= '-root';
169
-			}
170
-			$entry['mountType'] = $mountType;
171
-		}
172
-		if (isset($i['extraData'])) {
173
-			$entry['extraData'] = $i['extraData'];
174
-		}
175
-		return $entry;
176
-	}
144
+        $entry['id'] = $i['fileid'];
145
+        $entry['parentId'] = $i['parent'];
146
+        $entry['mtime'] = $i['mtime'] * 1000;
147
+        // only pick out the needed attributes
148
+        $entry['name'] = $i->getName();
149
+        $entry['permissions'] = $i['permissions'];
150
+        $entry['mimetype'] = $i['mimetype'];
151
+        $entry['size'] = $i['size'];
152
+        $entry['type'] = $i['type'];
153
+        $entry['etag'] = $i['etag'];
154
+        if (isset($i['tags'])) {
155
+            $entry['tags'] = $i['tags'];
156
+        }
157
+        if (isset($i['displayname_owner'])) {
158
+            $entry['shareOwner'] = $i['displayname_owner'];
159
+        }
160
+        if (isset($i['is_share_mount_point'])) {
161
+            $entry['isShareMountPoint'] = $i['is_share_mount_point'];
162
+        }
163
+        $mountType = null;
164
+        $mount = $i->getMountPoint();
165
+        $mountType = $mount->getMountType();
166
+        if ($mountType !== '') {
167
+            if ($i->getInternalPath() === '') {
168
+                $mountType .= '-root';
169
+            }
170
+            $entry['mountType'] = $mountType;
171
+        }
172
+        if (isset($i['extraData'])) {
173
+            $entry['extraData'] = $i['extraData'];
174
+        }
175
+        return $entry;
176
+    }
177 177
 
178
-	/**
179
-	 * Format file info for JSON
180
-	 * @param \OCP\Files\FileInfo[] $fileInfos file infos
181
-	 * @return array
182
-	 */
183
-	public static function formatFileInfos($fileInfos) {
184
-		$files = array();
185
-		foreach ($fileInfos as $i) {
186
-			$files[] = self::formatFileInfo($i);
187
-		}
178
+    /**
179
+     * Format file info for JSON
180
+     * @param \OCP\Files\FileInfo[] $fileInfos file infos
181
+     * @return array
182
+     */
183
+    public static function formatFileInfos($fileInfos) {
184
+        $files = array();
185
+        foreach ($fileInfos as $i) {
186
+            $files[] = self::formatFileInfo($i);
187
+        }
188 188
 
189
-		return $files;
190
-	}
189
+        return $files;
190
+    }
191 191
 
192
-	/**
193
-	 * Retrieves the contents of the given directory and
194
-	 * returns it as a sorted array of FileInfo.
195
-	 *
196
-	 * @param string $dir path to the directory
197
-	 * @param string $sortAttribute attribute to sort on
198
-	 * @param bool $sortDescending true for descending sort, false otherwise
199
-	 * @param string $mimetypeFilter limit returned content to this mimetype or mimepart
200
-	 * @return \OCP\Files\FileInfo[] files
201
-	 */
202
-	public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = false, $mimetypeFilter = '') {
203
-		$content = \OC\Files\Filesystem::getDirectoryContent($dir, $mimetypeFilter);
192
+    /**
193
+     * Retrieves the contents of the given directory and
194
+     * returns it as a sorted array of FileInfo.
195
+     *
196
+     * @param string $dir path to the directory
197
+     * @param string $sortAttribute attribute to sort on
198
+     * @param bool $sortDescending true for descending sort, false otherwise
199
+     * @param string $mimetypeFilter limit returned content to this mimetype or mimepart
200
+     * @return \OCP\Files\FileInfo[] files
201
+     */
202
+    public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = false, $mimetypeFilter = '') {
203
+        $content = \OC\Files\Filesystem::getDirectoryContent($dir, $mimetypeFilter);
204 204
 
205
-		return self::sortFiles($content, $sortAttribute, $sortDescending);
206
-	}
205
+        return self::sortFiles($content, $sortAttribute, $sortDescending);
206
+    }
207 207
 
208
-	/**
209
-	 * Populate the result set with file tags
210
-	 *
211
-	 * @param array $fileList
212
-	 * @param string $fileIdentifier identifier attribute name for values in $fileList
213
-	 * @param ITagManager $tagManager
214
-	 * @return array file list populated with tags
215
-	 */
216
-	public static function populateTags(array $fileList, $fileIdentifier = 'fileid', ITagManager $tagManager) {
217
-		$ids = [];
218
-		foreach ($fileList as $fileData) {
219
-			$ids[] = $fileData[$fileIdentifier];
220
-		}
221
-		$tagger = $tagManager->load('files');
222
-		$tags = $tagger->getTagsForObjects($ids);
208
+    /**
209
+     * Populate the result set with file tags
210
+     *
211
+     * @param array $fileList
212
+     * @param string $fileIdentifier identifier attribute name for values in $fileList
213
+     * @param ITagManager $tagManager
214
+     * @return array file list populated with tags
215
+     */
216
+    public static function populateTags(array $fileList, $fileIdentifier = 'fileid', ITagManager $tagManager) {
217
+        $ids = [];
218
+        foreach ($fileList as $fileData) {
219
+            $ids[] = $fileData[$fileIdentifier];
220
+        }
221
+        $tagger = $tagManager->load('files');
222
+        $tags = $tagger->getTagsForObjects($ids);
223 223
 
224
-		if (!is_array($tags)) {
225
-			throw new \UnexpectedValueException('$tags must be an array');
226
-		}
224
+        if (!is_array($tags)) {
225
+            throw new \UnexpectedValueException('$tags must be an array');
226
+        }
227 227
 
228
-		// Set empty tag array
229
-		foreach ($fileList as $key => $fileData) {
230
-			$fileList[$key]['tags'] = [];
231
-		}
228
+        // Set empty tag array
229
+        foreach ($fileList as $key => $fileData) {
230
+            $fileList[$key]['tags'] = [];
231
+        }
232 232
 
233
-		if (!empty($tags)) {
234
-			foreach ($tags as $fileId => $fileTags) {
233
+        if (!empty($tags)) {
234
+            foreach ($tags as $fileId => $fileTags) {
235 235
 
236
-				foreach ($fileList as $key => $fileData) {
237
-					if ($fileId !== $fileData[$fileIdentifier]) {
238
-						continue;
239
-					}
236
+                foreach ($fileList as $key => $fileData) {
237
+                    if ($fileId !== $fileData[$fileIdentifier]) {
238
+                        continue;
239
+                    }
240 240
 
241
-					$fileList[$key]['tags'] = $fileTags;
242
-				}
243
-			}
244
-		}
241
+                    $fileList[$key]['tags'] = $fileTags;
242
+                }
243
+            }
244
+        }
245 245
 
246
-		return $fileList;
247
-	}
246
+        return $fileList;
247
+    }
248 248
 
249
-	/**
250
-	 * Sort the given file info array
251
-	 *
252
-	 * @param \OCP\Files\FileInfo[] $files files to sort
253
-	 * @param string $sortAttribute attribute to sort on
254
-	 * @param bool $sortDescending true for descending sort, false otherwise
255
-	 * @return \OCP\Files\FileInfo[] sorted files
256
-	 */
257
-	public static function sortFiles($files, $sortAttribute = 'name', $sortDescending = false) {
258
-		$sortFunc = 'compareFileNames';
259
-		if ($sortAttribute === 'mtime') {
260
-			$sortFunc = 'compareTimestamp';
261
-		} else if ($sortAttribute === 'size') {
262
-			$sortFunc = 'compareSize';
263
-		}
264
-		usort($files, array(Helper::class, $sortFunc));
265
-		if ($sortDescending) {
266
-			$files = array_reverse($files);
267
-		}
268
-		return $files;
269
-	}
249
+    /**
250
+     * Sort the given file info array
251
+     *
252
+     * @param \OCP\Files\FileInfo[] $files files to sort
253
+     * @param string $sortAttribute attribute to sort on
254
+     * @param bool $sortDescending true for descending sort, false otherwise
255
+     * @return \OCP\Files\FileInfo[] sorted files
256
+     */
257
+    public static function sortFiles($files, $sortAttribute = 'name', $sortDescending = false) {
258
+        $sortFunc = 'compareFileNames';
259
+        if ($sortAttribute === 'mtime') {
260
+            $sortFunc = 'compareTimestamp';
261
+        } else if ($sortAttribute === 'size') {
262
+            $sortFunc = 'compareSize';
263
+        }
264
+        usort($files, array(Helper::class, $sortFunc));
265
+        if ($sortDescending) {
266
+            $files = array_reverse($files);
267
+        }
268
+        return $files;
269
+    }
270 270
 }
Please login to merge, or discard this patch.
apps/files_external/appinfo/app.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@
 block discarded – undo
37 37
 $appContainer = \OC_Mount_Config::$app->getContainer();
38 38
 
39 39
 \OCA\Files\App::getNavigationManager()->add(function () {
40
-	$l = \OC::$server->getL10N('files_external');
41
-	return [
42
-		'id' => 'extstoragemounts',
43
-		'appname' => 'files_external',
44
-		'script' => 'list.php',
45
-		'order' => 30,
46
-		'name' => $l->t('External storages'),
47
-	];
40
+    $l = \OC::$server->getL10N('files_external');
41
+    return [
42
+        'id' => 'extstoragemounts',
43
+        'appname' => 'files_external',
44
+        'script' => 'list.php',
45
+        'order' => 30,
46
+        'name' => $l->t('External storages'),
47
+    ];
48 48
 });
49 49
 
50 50
 $mountProvider = $appContainer->query(ConfigAdapter::class);
Please login to merge, or discard this patch.
apps/federation/lib/AppInfo/Application.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -36,48 +36,48 @@
 block discarded – undo
36 36
 
37 37
 class Application extends App {
38 38
 
39
-	/**
40
-	 * @param array $urlParams
41
-	 */
42
-	public function __construct($urlParams = []) {
43
-		parent::__construct('federation', $urlParams);
44
-		$this->registerMiddleware();
45
-	}
39
+    /**
40
+     * @param array $urlParams
41
+     */
42
+    public function __construct($urlParams = []) {
43
+        parent::__construct('federation', $urlParams);
44
+        $this->registerMiddleware();
45
+    }
46 46
 
47
-	private function registerMiddleware() {
48
-		$container = $this->getContainer();
49
-		$container->registerAlias('AddServerMiddleware', AddServerMiddleware::class);
50
-		$container->registerMiddleWare('AddServerMiddleware');
51
-	}
47
+    private function registerMiddleware() {
48
+        $container = $this->getContainer();
49
+        $container->registerAlias('AddServerMiddleware', AddServerMiddleware::class);
50
+        $container->registerMiddleWare('AddServerMiddleware');
51
+    }
52 52
 
53
-	/**
54
-	 * listen to federated_share_added hooks to auto-add new servers to the
55
-	 * list of trusted servers.
56
-	 */
57
-	public function registerHooks() {
53
+    /**
54
+     * listen to federated_share_added hooks to auto-add new servers to the
55
+     * list of trusted servers.
56
+     */
57
+    public function registerHooks() {
58 58
 
59
-		$container = $this->getContainer();
60
-		$hooksManager = $container->query(Hooks::class);
59
+        $container = $this->getContainer();
60
+        $hooksManager = $container->query(Hooks::class);
61 61
 
62
-		Util::connectHook(
63
-				Share::class,
64
-				'federated_share_added',
65
-				$hooksManager,
66
-				'addServerHook'
67
-		);
62
+        Util::connectHook(
63
+                Share::class,
64
+                'federated_share_added',
65
+                $hooksManager,
66
+                'addServerHook'
67
+        );
68 68
 
69
-		$dispatcher = $container->getServer()->getEventDispatcher();
70
-		$dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function($event) use($container) {
71
-			if ($event instanceof SabrePluginEvent) {
72
-				$server = $event->getServer();
73
-				if ($server instanceof Server) {
74
-					$authPlugin = $server->getPlugin('auth');
75
-					if ($authPlugin instanceof Plugin) {
76
-						$authPlugin->addBackend($container->query(FedAuth::class));
77
-					}
78
-				}
79
-			}
80
-		});
81
-	}
69
+        $dispatcher = $container->getServer()->getEventDispatcher();
70
+        $dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function($event) use($container) {
71
+            if ($event instanceof SabrePluginEvent) {
72
+                $server = $event->getServer();
73
+                if ($server instanceof Server) {
74
+                    $authPlugin = $server->getPlugin('auth');
75
+                    if ($authPlugin instanceof Plugin) {
76
+                        $authPlugin->addBackend($container->query(FedAuth::class));
77
+                    }
78
+                }
79
+            }
80
+        });
81
+    }
82 82
 
83 83
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Token/DefaultTokenCleanupJob.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
 
28 28
 class DefaultTokenCleanupJob extends Job {
29 29
 
30
-	protected function run($argument) {
31
-		/* @var $provider IProvider */
32
-		$provider = OC::$server->query(IProvider::class);
33
-		$provider->invalidateOldTokens();
34
-	}
30
+    protected function run($argument) {
31
+        /* @var $provider IProvider */
32
+        $provider = OC::$server->query(IProvider::class);
33
+        $provider->invalidateOldTokens();
34
+    }
35 35
 
36 36
 }
Please login to merge, or discard this patch.
lib/private/Tagging/TagMapper.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,47 +33,47 @@
 block discarded – undo
33 33
  */
34 34
 class TagMapper extends Mapper {
35 35
 
36
-	/**
37
-	* Constructor.
38
-	*
39
-	* @param IDBConnection $db Instance of the Db abstraction layer.
40
-	*/
41
-	public function __construct(IDBConnection $db) {
42
-		parent::__construct($db, 'vcategory', Tag::class);
43
-	}
36
+    /**
37
+     * Constructor.
38
+     *
39
+     * @param IDBConnection $db Instance of the Db abstraction layer.
40
+     */
41
+    public function __construct(IDBConnection $db) {
42
+        parent::__construct($db, 'vcategory', Tag::class);
43
+    }
44 44
 
45
-	/**
46
-	* Load tags from the database.
47
-	*
48
-	* @param array|string $owners The user(s) whose tags we are going to load.
49
-	* @param string $type The type of item for which we are loading tags.
50
-	* @return array An array of Tag objects.
51
-	*/
52
-	public function loadTags($owners, $type) {
53
-		if(!is_array($owners)) {
54
-			$owners = array($owners);
55
-		}
45
+    /**
46
+     * Load tags from the database.
47
+     *
48
+     * @param array|string $owners The user(s) whose tags we are going to load.
49
+     * @param string $type The type of item for which we are loading tags.
50
+     * @return array An array of Tag objects.
51
+     */
52
+    public function loadTags($owners, $type) {
53
+        if(!is_array($owners)) {
54
+            $owners = array($owners);
55
+        }
56 56
 
57
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
58
-			. 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`';
59
-		return $this->findEntities($sql, array_merge($owners, array($type)));
60
-	}
57
+        $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
58
+            . 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`';
59
+        return $this->findEntities($sql, array_merge($owners, array($type)));
60
+    }
61 61
 
62
-	/**
63
-	* Check if a given Tag object already exists in the database.
64
-	*
65
-	* @param Tag $tag The tag to look for in the database.
66
-	* @return bool
67
-	*/
68
-	public function tagExists($tag) {
69
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
70
-			. 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
71
-		try {
72
-			$this->findEntity($sql, array($tag->getOwner(), $tag->getType(), $tag->getName()));
73
-		} catch (DoesNotExistException $e) {
74
-			return false;
75
-		}
76
-		return true;
77
-	}
62
+    /**
63
+     * Check if a given Tag object already exists in the database.
64
+     *
65
+     * @param Tag $tag The tag to look for in the database.
66
+     * @return bool
67
+     */
68
+    public function tagExists($tag) {
69
+        $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
70
+            . 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
71
+        try {
72
+            $this->findEntity($sql, array($tag->getOwner(), $tag->getType(), $tag->getName()));
73
+        } catch (DoesNotExistException $e) {
74
+            return false;
75
+        }
76
+        return true;
77
+    }
78 78
 }
79 79
 
Please login to merge, or discard this patch.