]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/User_openid.php
Logic to have group joins turn into pending joins automatically when group is set...
[quix0rs-gnu-social.git] / plugins / OpenID / User_openid.php
index c3624118e7b6991ae4b684a68614854ab8c9e1ee..e34cf21f2cd142db5015c81d6d77a74e3b1e2d6a 100644 (file)
@@ -2,9 +2,12 @@
 /**
  * Table Definition for user_openid
  */
-require_once INSTALLDIR.'/classes/Plugin_DataObject.php';
 
-class User_openid extends Plugin_DataObject
+if (!defined('STATUSNET')) {
+    exit(1);
+}
+
+class User_openid extends Memcached_DataObject
 {
     ###START_AUTOCODE
     /* the code below is auto generated do not remove the above tag */
@@ -23,32 +26,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 array(false, false, false);
+    }
+
+    Static function hasOpenID($user_id)
     {
-        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')));
+        $oid = new User_openid();
+
+        $oid->user_id = $user_id;
+
+        $cnt = $oid->find();
+
+        return ($cnt > 0);
     }
 }