3 * Table Definition for consumer
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
7 class Consumer extends Memcached_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'consumer'; // table name
13 public $consumer_key; // varchar(255) primary_key not_null
14 public $consumer_secret; // varchar(255) not_null
15 public $seed; // char(32) not_null
16 public $created; // datetime not_null
17 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
20 function staticGet($k,$v=null)
21 { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
23 /* the code above is auto generated do not remove the tag below */
26 static function generateNew()
28 $cons = new Consumer();
29 $rand = common_good_rand(16);
32 $cons->consumer_key = md5(time() + $rand);
33 $cons->consumer_secret = md5(md5(time() + time() + $rand));
34 $cons->created = common_sql_now();
40 * Delete a Consumer and related tokens and nonces
42 * XXX: Should this happen in an OAuthDataStore instead?
47 // XXX: Is there any reason NOT to do this kind of cleanup?
49 $this->_deleteTokens();
50 $this->_deleteNonces();
55 function _deleteTokens()
58 $token->consumer_key = $this->consumer_key;
62 function _deleteNonces()
65 $nonce->consumer_key = $this->consumer_key;