/**
  * Update db entry of 'user' table with values in object
  * @param PFUser $user
  */
 public function updateDb(PFUser $user)
 {
     if (!$user->isAnonymous()) {
         $old_user = $this->getUserByIdWithoutCache($user->getId());
         $userRow = $user->toRow();
         if ($user->getPassword() != '') {
             $password_handler = PasswordHandlerFactory::getPasswordHandler();
             if (!$password_handler->verifyHashPassword($user->getPassword(), $user->getUserPw()) || $password_handler->isPasswordNeedRehash($user->getUserPw())) {
                 // Update password
                 $userRow['clear_password'] = $user->getPassword();
             }
         }
         if ($user->getLegacyUserPw() !== '' && !ForgeConfig::get('sys_keep_md5_hashed_password')) {
             $userRow['user_pw'] = '';
         }
         $result = $this->getDao()->updateByRow($userRow);
         if ($result) {
             if ($user->isSuspended() || $user->isDeleted()) {
                 $this->getDao()->deleteAllUserSessions($user->getId());
             }
             $this->_getEventManager()->processEvent(Event::USER_MANAGER_UPDATE_DB, array('old_user' => $old_user, 'new_user' => &$user));
         }
         return $result;
     }
     return false;
 }
 private function checkPasswordStorageConformity(PFUser $user)
 {
     $hashed_password = $user->getUserPw();
     $legacy_hashed_password = $user->getLegacyUserPw();
     if ($this->isPasswordUpdatingNeeded($hashed_password) || $this->isLegacyPasswordRemovalNeeded($legacy_hashed_password)) {
         $this->user_manager->updateDb($user);
     }
 }