Compare commits
2 commits
d8c47aebb0
...
951c6acfcb
Author | SHA1 | Date | |
---|---|---|---|
|
951c6acfcb | ||
|
8b4206579c |
1 changed files with 2 additions and 10 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace EesyPHP\Auth;
|
||||
|
||||
use EesyPHP\Hook;
|
||||
use EesyPHP\Log;
|
||||
use function EesyPHP\ensure_is_array;
|
||||
use function EesyPHP\vardump;
|
||||
|
@ -136,24 +135,17 @@ class User {
|
|||
*/
|
||||
public function save() {
|
||||
if (!isset($this -> original_user)) {
|
||||
Log::debug("%s->save(): original_user not set, no change to save.", $this);
|
||||
Log::debug("%s->save(): no change to save", $this);
|
||||
return true;
|
||||
}
|
||||
$changes = [];
|
||||
foreach ($this->info as $attr => $value)
|
||||
if ($this->original_user->$attr != $value)
|
||||
$changes[$attr] = $value;
|
||||
if (!$changes) {
|
||||
Log::debug("%s->save(): no info updated, no change to save", $this);
|
||||
return true;
|
||||
}
|
||||
$result = call_user_func(
|
||||
return call_user_func(
|
||||
array($this -> backend, 'update_user'),
|
||||
$this -> original_user, $changes, true
|
||||
);
|
||||
if ($result)
|
||||
Hook::trigger("user_updated", ["user" => $this, "changes" => $changes]);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue