2011-02-20 03:28:41 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-14 00:21:04 +01:00
|
|
|
final class PhabricatorUserProfile extends PhabricatorUserDAO {
|
2011-02-20 03:28:41 +01:00
|
|
|
|
|
|
|
protected $userPHID;
|
|
|
|
protected $title;
|
|
|
|
protected $blurb;
|
|
|
|
protected $profileImagePHID;
|
2016-01-24 14:43:57 +01:00
|
|
|
protected $icon;
|
|
|
|
|
|
|
|
public static function initializeNewProfile(PhabricatorUser $user) {
|
|
|
|
$default_icon = PhabricatorPeopleIconSet::getDefaultIconKey();
|
|
|
|
|
|
|
|
return id(new self())
|
|
|
|
->setUserPHID($user->getPHID())
|
|
|
|
->setIcon($default_icon);
|
|
|
|
}
|
2011-02-20 03:28:41 +01:00
|
|
|
|
2015-01-13 20:47:05 +01:00
|
|
|
protected function getConfiguration() {
|
Generate expected schemata for User/People tables
Summary:
Ref T1191. Some notes here:
- Drops the old LDAP and OAuth info tables. These were migrated to the ExternalAccount table a very long time ago.
- Separates surplus/missing keys from other types of surplus/missing things. In the long run, my plan is to have only two notice levels:
- Error: something we can't fix (missing database, table, or column; overlong key).
- Warning: something we can fix (surplus anything, missing key, bad column type, bad key columns, bad uniqueness, bad collation or charset).
- For now, retaining three levels is helpful in generating all the expected scheamta.
Test Plan:
- Saw ~200 issues resolve, leaving ~1,300.
- Grepped for removed tables.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T1191
Differential Revision: https://secure.phabricator.com/D10580
2014-10-01 16:36:47 +02:00
|
|
|
return array(
|
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
|
|
'title' => 'text255',
|
|
|
|
'blurb' => 'text',
|
|
|
|
'profileImagePHID' => 'phid?',
|
2016-01-24 14:43:57 +01:00
|
|
|
'icon' => 'text32',
|
Generate expected schemata for User/People tables
Summary:
Ref T1191. Some notes here:
- Drops the old LDAP and OAuth info tables. These were migrated to the ExternalAccount table a very long time ago.
- Separates surplus/missing keys from other types of surplus/missing things. In the long run, my plan is to have only two notice levels:
- Error: something we can't fix (missing database, table, or column; overlong key).
- Warning: something we can fix (surplus anything, missing key, bad column type, bad key columns, bad uniqueness, bad collation or charset).
- For now, retaining three levels is helpful in generating all the expected scheamta.
Test Plan:
- Saw ~200 issues resolve, leaving ~1,300.
- Grepped for removed tables.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T1191
Differential Revision: https://secure.phabricator.com/D10580
2014-10-01 16:36:47 +02:00
|
|
|
),
|
|
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
|
|
'userPHID' => array(
|
|
|
|
'columns' => array('userPHID'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
2016-01-24 14:43:57 +01:00
|
|
|
public function getDisplayTitle() {
|
|
|
|
$title = $this->getTitle();
|
|
|
|
if (strlen($title)) {
|
|
|
|
return $title;
|
|
|
|
}
|
|
|
|
|
|
|
|
$icon_key = $this->getIcon();
|
|
|
|
return PhabricatorPeopleIconSet::getIconName($icon_key);
|
|
|
|
}
|
|
|
|
|
2011-02-20 03:28:41 +01:00
|
|
|
}
|