X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOStatus%2Fclasses%2FOstatus_source.php;h=d122a7e7f4f06622f2ea13b1ea43e19af02fc855;hb=c00491cd7a29a9ef16d6e6bfa54505d4c9a522fe;hp=e6ce7d442bc0914f1c371608ab0a1a7ec9b59f0c;hpb=8e06b932af93b8fbd66610c948bdde4fafd4f300;p=quix0rs-gnu-social.git
diff --git a/plugins/OStatus/classes/Ostatus_source.php b/plugins/OStatus/classes/Ostatus_source.php
index e6ce7d442b..d122a7e7f4 100644
--- a/plugins/OStatus/classes/Ostatus_source.php
+++ b/plugins/OStatus/classes/Ostatus_source.php
@@ -17,82 +17,44 @@
* along with this program. If not, see .
*/
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
/**
* @package OStatusPlugin
* @maintainer Brion Vibber
*/
-
-class Ostatus_source extends Memcached_DataObject
+class Ostatus_source extends Managed_DataObject
{
public $__table = 'ostatus_source';
public $notice_id; // notice we're referring to
public $profile_uri; // uri of the ostatus_profile this came through -- may be a group feed
public $method; // push or salmon
+ public $created;
+ public $modified;
- public /*static*/ function staticGet($k, $v=null)
- {
- return parent::staticGet(__CLASS__, $k, $v);
- }
-
- /**
- * return table definition for DB_DataObject
- *
- * DB_DataObject needs to know something about the table to manipulate
- * instances. This method provides all the DB_DataObject needs to know.
- *
- * @return array array of column definitions
- */
-
- function table()
- {
- return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
- 'profile_uri' => DB_DATAOBJECT_STR,
- 'method' => DB_DATAOBJECT_STR);
- }
-
- static function schemaDef()
- {
- return array(new ColumnDef('notice_id', 'integer',
- null, false, 'PRI'),
- new ColumnDef('profile_uri', 'varchar',
- 255, false),
- new ColumnDef('method', "ENUM('push','salmon')",
- null, false));
- }
-
- /**
- * return key definitions for DB_DataObject
- *
- * DB_DataObject needs to know about keys that the table has; this function
- * defines them.
- *
- * @return array key definitions
- */
-
- function keys()
- {
- return array_keys($this->keyTypes());
- }
-
- /**
- * return key definitions for Memcached_DataObject
- *
- * Our caching system uses the same key definitions, but uses a different
- * method to get them.
- *
- * @return array key definitions
- */
-
- function keyTypes()
+ public static function schemaDef()
{
- return array('notice_id' => 'K');
- }
-
- function sequenceKey()
- {
- return array(false, false, false);
- }
+ return array(
+ 'fields' => array(
+ 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'Notice ID relation'),
+ 'profile_uri' => array('type' => 'varchar', 'not null' => true, 'length' => 255, 'description' => 'Profile URI'),
+ 'method' => array('type' => 'enum("push","salmon")', 'not null' => true, 'description' => 'source method'),
+ 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
+ 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
+ ),
+ 'primary key' => array('notice_id'),
+ 'foreign keys' => array(
+ 'ostatus_source_notice_id_fkey' => array('notice', array('notice_id' => 'id')),
+ // not in profile table yet 'ostatus_source_profile_uri_fkey' => array('profile', array('profile_uri' => 'uri')),
+ ),
+ 'indexes' => array(
+ 'ostatus_source_profile_uri_idx' => array('profile_uri'),
+ ),
+ );
+ }
/**
* Save a remote notice source record; this helps indicate how trusted we are.