summaryrefslogtreecommitdiffstats
path: root/inc/lib_user.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2010-07-05 11:37:50 +0200
committerRobin Appelman <icewind1991@gmail.com>2010-07-05 11:37:50 +0200
commitd96793f14f810f9d6f1641922aad03cb84f4647f (patch)
tree3758d3b66811930ddea6e4b175278bea0fb476f2 /inc/lib_user.php
parente4a83b68e905347330f8c997c8f72daefadb031e (diff)
downloadnextcloud-server-d96793f14f810f9d6f1641922aad03cb84f4647f.tar.gz
nextcloud-server-d96793f14f810f9d6f1641922aad03cb84f4647f.zip
Fix some database problems, do not use the cache when creating users
Diffstat (limited to 'inc/lib_user.php')
-rwxr-xr-xinc/lib_user.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/inc/lib_user.php b/inc/lib_user.php
index 089d0cb54a1..5a7b92d4781 100755
--- a/inc/lib_user.php
+++ b/inc/lib_user.php
@@ -63,7 +63,7 @@ class OC_USER {
*
*/
public static function createuser($username,$password){
- if(OC_USER::getuserid($username)!=0){
+ if(OC_USER::getuserid($username,true)!=0){
return false;
}else{
$usernameclean=strtolower($username);
@@ -124,7 +124,7 @@ class OC_USER {
*
*/
public static function creategroup($groupname){
- if(OC_USER::getgroupid($groupname)==0){
+ if(OC_USER::getgroupid($groupname,true)==0){
$groupname=OC_DB::escape($groupname);
$query="INSERT INTO `groups` (`group_name`) VALUES ('$groupname')";
$result=OC_DB::query($query);
@@ -138,9 +138,9 @@ class OC_USER {
* get the id of a user
*
*/
- public static function getuserid($username){
+ public static function getuserid($username,$nocache=false){
$usernameclean=strtolower($username);
- if(isset($_SESSION['user_id_cache'][$usernameclean])){//try to use cached value to save an sql query
+ if(!$nocache and isset($_SESSION['user_id_cache'][$usernameclean])){//try to use cached value to save an sql query
return $_SESSION['user_id_cache'][$usernameclean];
}
$usernameclean=OC_DB::escape($usernameclean);
@@ -161,8 +161,8 @@ class OC_USER {
* get the id of a group
*
*/
- public static function getgroupid($groupname){
- if(isset($_SESSION['group_id_cache'][$groupname])){//try to use cached value to save an sql query
+ public static function getgroupid($groupname,$nocache=false){
+ if(!$nocache and isset($_SESSION['group_id_cache'][$groupname])){//try to use cached value to save an sql query
return $_SESSION['group_id_cache'][$groupname];
}
$groupname=OC_DB::escape($groupname);
@@ -183,8 +183,8 @@ class OC_USER {
* get the name of a group
*
*/
- public static function getgroupname($groupid){
- if($name=array_search($groupid,$_SESSION['group_id_cache'])){//try to use cached value to save an sql query
+ public static function getgroupname($groupid,$nocache=false){
+ if($nocache and $name=array_search($groupid,$_SESSION['group_id_cache'])){//try to use cached value to save an sql query
return $name;
}
$groupid=(integer)$groupid;