Index: kernel/classes/datatypes/ezuser/ezldapuser.php
===================================================================
--- kernel/classes/datatypes/ezuser/ezldapuser.php	(revision 21405)
+++ kernel/classes/datatypes/ezuser/ezldapuser.php	(working copy)
@@ -79,9 +79,9 @@
 
         $ini = eZINI::instance();
         $LDAPIni = eZINI::instance( 'ldap.ini' );
-        $databaseImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
-        // if mysql
-        if ( $databaseImplementation == "ezmysql" )
+        $dbImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
+        // if mysql or mysqli
+        if ( $dbImplementation === 'ezmysql' or $dbImplementation === 'ezmysqli' )
         {
             $query = "SELECT contentobject_id, password_hash, password_hash_type, email, login
                       FROM ezuser, ezcontentobject
@@ -102,6 +102,7 @@
         $exists = false;
         if ( count( $users ) >= 1 )
         {
+            $updateHash = strtolower( $ini->variable( 'UserSettings', 'UpdateHash' ) );
             foreach ( $users as $userRow )
             {
                 $userID = $userRow['contentobject_id'];
@@ -112,7 +113,7 @@
                                                     $hash );
 
                 // If hash type is MySql
-                if ( $hashType == eZUser::PASSWORD_HASH_MYSQL and $databaseImplementation == "ezmysql" )
+                if ( $hashType == eZUser::PASSWORD_HASH_MYSQL and ( $dbImplementation === 'ezmysql' or $dbImplementation === 'ezmysqli' ) )
                 {
                     $queryMysqlUser = "SELECT contentobject_id, password_hash, password_hash_type, email, login
                                        FROM ezuser, ezcontentobject
@@ -137,7 +138,7 @@
                     $userSetting = eZUserSetting::fetch( $userID );
                     $isEnabled = $userSetting->attribute( "is_enabled" );
                     if ( $hashType != eZUser::hashType() and
-                         strtolower( $ini->variable( 'UserSettings', 'UpdateHash' ) ) == 'true' )
+                         $updateHash === 'true' )
                     {
                         $hashType = eZUser::hashType();
                         $hash = eZUser::createHash( $login, $password, eZUser::site(),
Index: kernel/classes/datatypes/ezuser/eztextfileuser.php
===================================================================
--- kernel/classes/datatypes/ezuser/eztextfileuser.php	(revision 21405)
+++ kernel/classes/datatypes/ezuser/eztextfileuser.php	(working copy)
@@ -88,9 +88,9 @@
 
         $ini = eZINI::instance();
         $textFileIni = eZINI::instance( 'textfile.ini' );
-        $databaseImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
-        // if mysql
-        if ( $databaseImplementation == "ezmysql" )
+        $dbImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
+        // if mysql or mysqli
+        if ( $dbImplementation === 'ezmysql' or $dbImplementation === 'ezmysqli' )
         {
             $query = "SELECT contentobject_id, password_hash, password_hash_type, email, login
                       FROM ezuser, ezcontentobject
@@ -111,6 +111,7 @@
         $exists = false;
         if ( count( $users ) >= 1 )
         {
+            $updateHash = strtolower( $ini->variable( 'UserSettings', 'UpdateHash' ) );
             foreach ( $users as $userRow )
             {
                 $userID = $userRow['contentobject_id'];
@@ -121,7 +122,7 @@
                                                     $hash );
 
                 // If hash type is MySql
-                if ( $hashType == eZUser::PASSWORD_HASH_MYSQL and $databaseImplementation == "ezmysql" )
+                if ( $hashType == eZUser::PASSWORD_HASH_MYSQL and ( $dbImplementation === 'ezmysql' or $dbImplementation === 'ezmysqli' ) )
                 {
                     $queryMysqlUser = "SELECT contentobject_id, password_hash, password_hash_type, email, login
                                        FROM ezuser, ezcontentobject
@@ -146,7 +147,7 @@
                     $userSetting = eZUserSetting::fetch( $userID );
                     $isEnabled = $userSetting->attribute( "is_enabled" );
                     if ( $hashType != eZUser::hashType() and
-                         strtolower( $ini->variable( 'UserSettings', 'UpdateHash' ) ) == 'true' )
+                         $updateHash === 'true' )
                     {
                         $hashType = eZUser::hashType();
                         $hash = eZUser::createHash( $login, $password, eZUser::site(),
Index: kernel/classes/datatypes/ezuser/ezuser.php
===================================================================
--- kernel/classes/datatypes/ezuser/ezuser.php	(revision 21405)
+++ kernel/classes/datatypes/ezuser/ezuser.php	(working copy)
@@ -292,9 +292,13 @@
 
     static function fetchByName( $login, $asObject = true )
     {
+        $ini              = eZINI::instance();
+        $dbImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
+        $sqlString        = $dbImplementation === 'ezpostgresql' ? 'LOWER( login )' : 'login';
+
         return eZPersistentObject::fetchObject( eZUser::definition(),
                                                 null,
-                                                array( 'LOWER( login )' => strtolower( $login ) ),
+                                                array( $sqlString => strtolower( $login ) ),
                                                 $asObject );
     }
 
@@ -300,9 +304,13 @@
 
     static function fetchByEmail( $email, $asObject = true )
     {
+        $ini              = eZINI::instance();
+        $dbImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
+        $sqlString        = $dbImplementation === 'ezpostgresql' ? 'LOWER( email )' : 'email';
+
         return eZPersistentObject::fetchObject( eZUser::definition(),
                                                   null,
-                                                  array( 'LOWER( email )' => strtolower( $email ) ),
+                                                  array( $sqlString => strtolower( $email ) ),
                                                   $asObject );
     }
 
@@ -709,10 +717,10 @@
 
         $contentObjectStatus = eZContentObject::STATUS_PUBLISHED;
 
-        $ini = eZINI::instance();
-        $databaseImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
-        // if mysql
-        if ( $databaseImplementation == "ezmysql" )
+        $ini              = eZINI::instance();
+        $dbImplementation = $ini->variable( 'DatabaseSettings', 'DatabaseImplementation' );
+        // if mysql or mysqli
+        if ( $dbImplementation === 'ezmysql' or $dbImplementation === 'ezmysqli' )
         {
             $query = "SELECT contentobject_id, password_hash, password_hash_type, email, login
                       FROM ezuser, ezcontentobject
@@ -735,8 +743,7 @@
         $exists = false;
         if ( $users !== false and count( $users ) >= 1 )
         {
-            //include_once( 'lib/ezutils/classes/ezini.php' );
-            $ini = eZINI::instance();
+            $updateHash = strtolower( $ini->variable( 'UserSettings', 'UpdateHash' ) );
             foreach ( $users as $userRow )
             {
                 $userID = $userRow['contentobject_id'];
@@ -747,7 +754,7 @@
                                                     $hash );
 
                 // If hash type is MySql
-                if ( $hashType == self::PASSWORD_HASH_MYSQL and $databaseImplementation == "ezmysql" )
+                if ( $hashType == self::PASSWORD_HASH_MYSQL and ( $dbImplementation === 'ezmysql' or $dbImplementation === 'ezmysqli' ) )
                 {
                     $queryMysqlUser = "SELECT contentobject_id, password_hash, password_hash_type, email, login
                               FROM ezuser, ezcontentobject
@@ -774,7 +781,7 @@
                     $userSetting = eZUserSetting::fetch( $userID );
                     $isEnabled = $userSetting->attribute( "is_enabled" );
                     if ( $hashType != eZUser::hashType() and
-                         strtolower( $ini->variable( 'UserSettings', 'UpdateHash' ) ) == 'true' )
+                         $updateHash === 'true' )
                     {
                         $hashType = eZUser::hashType();
                         $hash = eZUser::createHash( $login, $password, eZUser::site(),
