diff --git a/src/applications/people/storage/user/PhabricatorUser.php b/src/applications/people/storage/user/PhabricatorUser.php index 7a21d30594..f63690034c 100644 --- a/src/applications/people/storage/user/PhabricatorUser.php +++ b/src/applications/people/storage/user/PhabricatorUser.php @@ -41,15 +41,25 @@ class PhabricatorUser extends PhabricatorUserDAO { private $preferences = null; - public function getProfileImagePHID() { - return nonempty( - $this->profileImagePHID, - PhabricatorEnv::getEnvConfig('user.default-profile-image-phid')); + protected function readField($field) { + if ($field === 'profileImagePHID') { + return nonempty( + $this->profileImagePHID, + PhabricatorEnv::getEnvConfig('user.default-profile-image-phid')); + } + if ($field === 'timezoneIdentifier') { + // If the user hasn't set one, guess the server's time. + return nonempty( + $this->timezoneIdentifier, + date_default_timezone_get()); + } + return parent::readField($field); } public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, + self::CONFIG_PARTIAL_OBJECTS => true, ) + parent::getConfiguration(); } @@ -76,8 +86,8 @@ class PhabricatorUser extends PhabricatorUserDAO { } public function save() { - if (!$this->conduitCertificate) { - $this->conduitCertificate = $this->generateConduitCertificate(); + if (!$this->getConduitCertificate()) { + $this->setConduitCertificate($this->generateConduitCertificate()); } $result = parent::save(); @@ -169,7 +179,7 @@ class PhabricatorUser extends PhabricatorUserDAO { private function generateToken($epoch, $frequency, $key, $len) { $time_block = floor($epoch / $frequency); - $vec = $this->getPHID().$this->passwordHash.$key.$time_block; + $vec = $this->getPHID().$this->getPasswordHash().$key.$time_block; return substr(sha1($vec), 0, $len); } @@ -343,11 +353,4 @@ class PhabricatorUser extends PhabricatorUserDAO { return $preferences; } - public function getTimezoneIdentifier() { - // If the user hasn't set one, guess the server's time. - return nonempty( - $this->timezoneIdentifier, - date_default_timezone_get()); - } - } diff --git a/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php index 051c7122fc..686f14f001 100644 --- a/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php +++ b/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php @@ -73,15 +73,21 @@ class PhabricatorTypeaheadCommonDatasourceController } if ($need_users) { + $columns = array( + 'isSystemAgent', + 'isDisabled', + 'userName', + 'realName', + 'phid'); if ($query) { // TODO: We probably need to split last names here. Workaround until // we get that up and running is to not enable server-side datasources. - $users = id(new PhabricatorUser())->loadAllWhere( + $users = id(new PhabricatorUser())->loadColumnsWhere($columns, '(userName LIKE %> OR realName LIKE %>)', $query, $query); } else { - $users = id(new PhabricatorUser())->loadAll(); + $users = id(new PhabricatorUser())->loadColumns($columns); } foreach ($users as $user) { if (!$need_all_users) { diff --git a/src/storage/lisk/dao/LiskDAO.php b/src/storage/lisk/dao/LiskDAO.php index 603cf985c1..045b22c2e3 100644 --- a/src/storage/lisk/dao/LiskDAO.php +++ b/src/storage/lisk/dao/LiskDAO.php @@ -360,14 +360,12 @@ abstract class LiskDAO { /** * Loads all objects, but only fetches the specified columns. * - * @param string Column name. - * @param ... More column names. - * @return dict Dictionary of all objects, keyed by ID. + * @param array Array of canonical column names as strings + * @return dict Dictionary of all objects, keyed by ID. * * @task load */ - public function loadColumns($column1/*, $column2, ... */) { - $columns = func_get_args(); + public function loadColumns(array $columns) { return $this->loadColumnsWhere($columns, '1 = 1'); } @@ -406,7 +404,7 @@ abstract class LiskDAO { * * @task load */ - public function loadColumnsWhere($columns, $pattern/*, $arg, $arg, ... */) { + public function loadColumnsWhere(array $columns, $pattern/*, $args... */) { if (!$this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) { throw new BadMethodCallException( "This class does not support partial objects."); @@ -452,7 +450,7 @@ abstract class LiskDAO { } - protected function loadRawDataWhere($columns, $pattern/*, $arg, $arg ... */) { + protected function loadRawDataWhere(array $columns, $pattern/*, $args... */) { $connection = $this->establishConnection('r'); $lock_clause = '';