X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOpenID%2FUser_openid.php;h=1beff9ea304afebbeeec5c1391137ae0c802c2df;hb=b1c5cb9db99993fcea7c060bffa6d5d50f22a41f;hp=c3624118e7b6991ae4b684a68614854ab8c9e1ee;hpb=003e4e2a23054af3b5dc554664d655cf88ad4799;p=quix0rs-gnu-social.git diff --git a/plugins/OpenID/User_openid.php b/plugins/OpenID/User_openid.php index c3624118e7..1beff9ea30 100644 --- a/plugins/OpenID/User_openid.php +++ b/plugins/OpenID/User_openid.php @@ -2,9 +2,9 @@ /** * Table Definition for user_openid */ -require_once INSTALLDIR.'/classes/Plugin_DataObject.php'; +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class User_openid extends Plugin_DataObject +class User_openid extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -23,32 +23,52 @@ class User_openid extends Plugin_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - static function hasOpenID($user_id) + function table() { - $oid = new User_openid(); - $oid->user_id = $user_id; + $db = $this->getDatabaseConnection(); + $dbtype = $db->phptype; // Database type is stored here. Crazy but true. - $cnt = $oid->find(); + return array('canonical' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, + 'display' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, + 'user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, + 'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL, + 'modified' => ($dbtype == 'mysql' || $dbtype == 'mysqli') ? + DB_DATAOBJECT_MYSQLTIMESTAMP + DB_DATAOBJECT_NOTNULL : + DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + ); + } - return ($cnt > 0); + /** + * List primary and unique keys in this table. + * Unique keys used for lookup *MUST* be listed to ensure proper caching. + */ + function keys() + { + return array_keys($this->keyTypes()); + } + + function keyTypes() + { + return array('canonical' => 'K', 'display' => 'U', 'user_id' => 'U'); } /** - * Get the TableDef object that represents the table backing this class - * @return TableDef TableDef instance - */ - function tableDef() + * No sequence keys in this table. + */ + function sequenceKey() { - return new TableDef($this->__table, - array(new ColumnDef('canonical', 'varchar', - '255', false, 'PRI'), - new ColumnDef('display', 'varchar', - '255', false), - new ColumnDef('user_id', 'integer', - null, false, 'MUL'), - new ColumnDef('created', 'datetime', - null, false), - new ColumnDef('modified', 'timestamp'))); + return array(false, false, false); + } + + Static function hasOpenID($user_id) + { + $oid = new User_openid(); + + $oid->user_id = $user_id; + + $cnt = $oid->find(); + + return ($cnt > 0); } }