123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- defined('GNUSOCIAL') || die();
- require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
- class User_username extends Managed_DataObject
- {
-
-
- public $__table = 'user_username';
- public $user_id;
- public $provider_name;
- public $username;
- public $created;
- public $modified;
-
-
- public static function schemaDef()
- {
- return array(
- 'fields' => array(
- 'provider_name' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'provider name'),
- 'username' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'username'),
- 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice id this title relates to'),
- 'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
- 'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
- ),
- 'primary key' => array('provider_name', 'username'),
- 'indexes' => array(
- 'user_id_idx' => array('user_id')
- ),
- 'foreign keys' => array(
- 'user_username_user_id_fkey' => array('user', array('user_id' => 'id')),
- ),
- );
- }
-
- public static function register($user, $username, $provider_name)
- {
- $user_username = new User_username();
- $user_username->user_id = $user->id;
- $user_username->provider_name = $provider_name;
- $user_username->username = $username;
- $user_username->created = common_sql_now();
- if ($user_username->insert()) {
- return $user_username;
- } else {
- return false;
- }
- }
- }
|