summaryrefslogtreecommitdiffstats
path: root/lib/private/group
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/group')
-rw-r--r--lib/private/group/dummy.php2
-rw-r--r--lib/private/group/manager.php14
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/private/group/dummy.php b/lib/private/group/dummy.php
index 9516fd52ff8..da26e1b910e 100644
--- a/lib/private/group/dummy.php
+++ b/lib/private/group/dummy.php
@@ -28,7 +28,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
private $groups=array();
/**
* @brief Try to create a new group
- * @param $gid The name of the group to create
+ * @param string $gid The name of the group to create
* @returns true/false
*
* Trys to create a new group. If the group name already exists, false will
diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php
index bf469d51d12..9b433b64fd4 100644
--- a/lib/private/group/manager.php
+++ b/lib/private/group/manager.php
@@ -76,12 +76,7 @@ class Manager extends PublicEmitter {
if (isset($this->cachedGroups[$gid])) {
return $this->cachedGroups[$gid];
}
- foreach ($this->backends as $backend) {
- if ($backend->groupExists($gid)) {
- return $this->getGroupObject($gid);
- }
- }
- return null;
+ return $this->getGroupObject($gid);
}
protected function getGroupObject($gid) {
@@ -91,6 +86,9 @@ class Manager extends PublicEmitter {
$backends[] = $backend;
}
}
+ if (count($backends) === 0) {
+ return null;
+ }
$this->cachedGroups[$gid] = new Group($gid, $backends, $this->userManager, $this);
return $this->cachedGroups[$gid];
}
@@ -110,8 +108,8 @@ class Manager extends PublicEmitter {
public function createGroup($gid) {
if (!$gid) {
return false;
- } else if ($this->groupExists($gid)) {
- return $this->get($gid);
+ } else if ($group = $this->get($gid)) {
+ return $group;
} else {
$this->emit('\OC\Group', 'preCreate', array($gid));
foreach ($this->backends as $backend) {