Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUser.php
| Show First 20 Lines • Show All 488 Lines • ▼ Show 20 Lines | final class PhabricatorUser | ||||
| public function loadPreferences() { | public function loadPreferences() { | ||||
| if ($this->preferences) { | if ($this->preferences) { | ||||
| return $this->preferences; | return $this->preferences; | ||||
| } | } | ||||
| $preferences = null; | $preferences = null; | ||||
| if ($this->getPHID()) { | if ($this->getPHID()) { | ||||
| $preferences = id(new PhabricatorUserPreferences())->loadOneWhere( | $preferences = id(new PhabricatorUserPreferencesQuery()) | ||||
| 'userPHID = %s', | ->setViewer($this) | ||||
| $this->getPHID()); | ->withUsers(array($this)) | ||||
| ->executeOne(); | |||||
| } | } | ||||
| if (!$preferences) { | if (!$preferences) { | ||||
| $preferences = new PhabricatorUserPreferences(); | $preferences = new PhabricatorUserPreferences(); | ||||
| $preferences->setUserPHID($this->getPHID()); | $preferences->setUserPHID($this->getPHID()); | ||||
| $default_dict = array( | $default_dict = array( | ||||
| PhabricatorUserPreferences::PREFERENCE_TITLES => 'glyph', | PhabricatorUserPreferences::PREFERENCE_TITLES => 'glyph', | ||||
| ▲ Show 20 Lines • Show All 780 Lines • ▼ Show 20 Lines | $this->openTransaction(); | ||||
| $externals = id(new PhabricatorExternalAccount())->loadAllWhere( | $externals = id(new PhabricatorExternalAccount())->loadAllWhere( | ||||
| 'userPHID = %s', | 'userPHID = %s', | ||||
| $this->getPHID()); | $this->getPHID()); | ||||
| foreach ($externals as $external) { | foreach ($externals as $external) { | ||||
| $external->delete(); | $external->delete(); | ||||
| } | } | ||||
| $prefs = id(new PhabricatorUserPreferences())->loadAllWhere( | $prefs = id(new PhabricatorUserPreferencesQuery()) | ||||
| 'userPHID = %s', | ->setViewer($engine->getViewer()) | ||||
| $this->getPHID()); | ->withUsers(array($this)) | ||||
| ->execute(); | |||||
| foreach ($prefs as $pref) { | foreach ($prefs as $pref) { | ||||
| $pref->delete(); | $engine->destroyObject($pref); | ||||
| } | } | ||||
| $profiles = id(new PhabricatorUserProfile())->loadAllWhere( | $profiles = id(new PhabricatorUserProfile())->loadAllWhere( | ||||
| 'userPHID = %s', | 'userPHID = %s', | ||||
| $this->getPHID()); | $this->getPHID()); | ||||
| foreach ($profiles as $profile) { | foreach ($profiles as $profile) { | ||||
| $profile->delete(); | $profile->delete(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines | |||||