123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- if (!defined('STATUSNET')) {
- exit(1);
- }
- class Ostatus_source extends Managed_DataObject
- {
- public $__table = 'ostatus_source';
- public $notice_id;
- public $profile_uri;
- public $method;
- public $created;
- public $modified;
- public static function schemaDef()
- {
- 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' => 191, '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')),
-
- ),
- 'indexes' => array(
- 'ostatus_source_profile_uri_idx' => array('profile_uri'),
- ),
- );
- }
-
- public static function saveNew(Notice $notice, Ostatus_profile $oprofile, $method)
- {
- $osource = new Ostatus_source();
- $osource->notice_id = $notice->id;
- $osource->profile_uri = $oprofile->uri;
- $osource->method = $method;
- $osource->created = common_sql_now();
- if ($osource->insert()) {
- return true;
- } else {
- common_log_db_error($osource, 'INSERT', __FILE__);
- return false;
- }
- }
- }
|